[sr-dev] git:kamailio_3.0: auth_diameter(k): remove redundant declaration of find_credentials, now in core

Henning Westerholt henning.westerholt at 1und1.de
Thu Jan 7 18:58:13 CET 2010


Module: sip-router
Branch: kamailio_3.0
Commit: 009339a4d040ca0bdc6c98441281addc523d7ba0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=009339a4d040ca0bdc6c98441281addc523d7ba0

Author: Henning Westerholt <henning.westerholt at 1und1.de>
Committer: Henning Westerholt <henning.westerholt at 1und1.de>
Date:   Tue Jan  5 11:27:34 2010 +0100

auth_diameter(k): remove redundant declaration of find_credentials, now in core
(cherry picked from commit fc323d03688bc93560a56cec9b2713c57a72389c)

---

 modules_k/auth_diameter/authorize.c |   82 -----------------------------------
 modules_k/auth_diameter/authorize.h |    3 -
 2 files changed, 0 insertions(+), 85 deletions(-)

diff --git a/modules_k/auth_diameter/authorize.c b/modules_k/auth_diameter/authorize.c
index d8b738c..a8c32d4 100644
--- a/modules_k/auth_diameter/authorize.c
+++ b/modules_k/auth_diameter/authorize.c
@@ -147,88 +147,6 @@ int get_realm(struct sip_msg* m, int hftype, struct sip_uri* u)
 	return 0;
 }
 
-/* Find credentials with given realm in a SIP message header */
-int find_credentials(struct sip_msg* _m, str* _realm, int _hftype, 
-													struct hdr_field** _h)
-{
-	struct hdr_field** hook, *ptr, *prev;
-	int res;
-	hdr_flags_t hdr_flags;
-	str* r;
-
-	switch(_hftype) 
-	{
-		case HDR_AUTHORIZATION_T:
-			hook = &(_m->authorization);
-			hdr_flags=HDR_AUTHORIZATION_F;
-			break;
-		case HDR_PROXYAUTH_T:
-			hook = &(_m->proxy_auth);
-			hdr_flags=HDR_PROXYAUTH_F;
-			break;
-		default:
-			hook = &(_m->authorization);
-			hdr_flags=HDR_T2F(_hftype);
-			break;
-	}
-
-	/* If the credentials haven't been parsed yet, do it now */
-	if (*hook == 0) 
-		if (parse_headers(_m, hdr_flags, 0) == -1) 
-		{
-			LM_ERR("failed to parse headers\n");
-			return -1;
-		}
-	
-	ptr = *hook;
-
-	/* Iterate through the credentials of the message to find 
-		credentials with given realm 
-	*/
-	while(ptr) 
-	{
-		res = parse_credentials(ptr);
-		if (res < 0) 
-		{
-			LM_ERR("failed to parse credentials\n");
-			return (res == -1) ? -2 : -3;
-		}
-		else 
-			if (res == 0) 
-			{
-				r = &(((auth_body_t*)(ptr->parsed))->digest.realm);
-	
-				if (r->len == _realm->len) 
-				{
-					if (!strncasecmp(_realm->s, r->s, r->len)) 
-					{
-						*_h = ptr;
-						return 0;
-					}
-				}
-			}
-			
-			prev = ptr;
-			if (parse_headers(_m, hdr_flags, 1) == -1) 
-			{
-				LM_ERR("failed to parse headers\n");
-				return -4;
-			}
-			else 
-			{	
-				if (prev != _m->last_header) 
-				{
-					if (_m->last_header->type == _hftype) ptr = _m->last_header;
-					else break;
-				} 
-				else break;
-			}
-	}
-	     
-     /* Credentials with given realm not found */
-	return 1;
-}
-
 
 auth_result_t diam_pre_auth(struct sip_msg* _m, str* _realm, int _hftype, 
 													struct hdr_field** _h)
diff --git a/modules_k/auth_diameter/authorize.h b/modules_k/auth_diameter/authorize.h
index bc9ba73..c3f96fb 100644
--- a/modules_k/auth_diameter/authorize.h
+++ b/modules_k/auth_diameter/authorize.h
@@ -45,9 +45,6 @@ int get_realm(struct sip_msg* m, int hftype, struct sip_uri* u);
 auth_result_t diam_pre_auth(struct sip_msg* m, str* realm, int hftype, 
 						struct hdr_field** h);
 
-int find_credentials(struct sip_msg* m, str* realm, int hftype, 
-						struct hdr_field** h);
-
 int authorize(struct sip_msg* msg, pv_elem_t* realm, int hftype);
 
 int diameter_authorize(struct hdr_field* cred, str* p_method, 




More information about the sr-dev mailing list