ソースを参照

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

Henning Westerholt 15 年 前
コミット
7508fe2a91
2 ファイル変更0 行追加85 行削除
  1. 0 82
      modules_k/auth_diameter/authorize.c
  2. 0 3
      modules_k/auth_diameter/authorize.h

+ 0 - 82
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)

+ 0 - 3
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,