[sr-dev] git:master: modules_k/auth_diameter : if realm is NULL, do not crash but instead use uri.host (as it was intended)

Marius Zbihlei marius.zbihlei at 1and1.ro
Mon Jan 17 13:45:04 CET 2011


Module: sip-router
Branch: master
Commit: 6c31510e42369f1025f54c53c354b36faa737af0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6c31510e42369f1025f54c53c354b36faa737af0

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Mon Jan 17 14:42:31 2011 +0200

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

---

 modules_k/auth_diameter/authorize.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules_k/auth_diameter/authorize.c b/modules_k/auth_diameter/authorize.c
index dec3902..7b4f67c 100644
--- a/modules_k/auth_diameter/authorize.c
+++ b/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");




More information about the sr-dev mailing list