Explorar o código

modules_k/auth_diameter : if realm is NULL, do not crash but instead use uri.host (as it was intended)

Marius Zbihlei %!s(int64=14) %!d(string=hai) anos
pai
achega
6c31510e42
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      modules_k/auth_diameter/authorize.c

+ 5 - 3
modules_k/auth_diameter/authorize.c

@@ -151,6 +151,7 @@ auth_diam_result_t diam_pre_auth(struct sip_msg* _m, str* _realm, int _hftype,
 {
 	int ret;
 	struct sip_uri uri;
+	str realm;
 
 	if ((_m->REQ_METHOD == METHOD_ACK) ||  (_m->REQ_METHOD == METHOD_CANCEL))
 		return AUTHORIZED;
@@ -167,11 +168,12 @@ auth_diam_result_t diam_pre_auth(struct sip_msg* _m, str* _realm, int _hftype,
 			}
 			return ERROR;
 		}
-		
-		*_realm = uri.host;
+		realm = uri.host;
+	} else {
+		realm = *_realm;
 	}
 
-	ret = find_credentials(_m, _realm, _hftype, _h);
+	ret = find_credentials(_m, &realm, _hftype, _h);
 	if (ret < 0) 
 	{
 		LM_ERR("credentials not found\n");