[sr-dev] git:master: modules/auth: mark credentials after verifying realm, not only after authentication succeeded

Alex Hermann alex at speakup.nl
Mon Sep 12 13:23:55 CEST 2011


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

Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date:   Mon Sep 12 11:25:26 2011 +0200

modules/auth: mark credentials after verifying realm, not only after authentication succeeded

Make $Au backwards compatible with 1.x. In 1.x $Au would be set to the credentials
username at domain for matching realm, not only for successfull authentication.

---

 modules/auth/api.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/auth/api.c b/modules/auth/api.c
index b7ce413..14281c9 100644
--- a/modules/auth/api.c
+++ b/modules/auth/api.c
@@ -94,6 +94,11 @@ auth_result_t pre_auth(struct sip_msg* msg, str* realm, hdr_types_t hftype,
 			c->digest.alg.alg_str.len, c->digest.alg.alg_str.s,
 			c->digest.alg.alg_parsed);
 
+	if (mark_authorized_cred(msg, *hdr) < 0) {
+		LOG(L_ERR, "auth:pre_auth: Error while marking parsed credentials\n");
+		return ERROR;
+	}
+
 	    /* check authorization header field's validity */
 	if (check_auth_hdr == NULL) {
 		check_hf = auth_check_hdr_md5;
@@ -173,11 +178,6 @@ auth_result_t post_auth(struct sip_msg* msg, struct hdr_field* hdr)
 		}
 	}
 
-	if (mark_authorized_cred(msg, hdr) < 0) {
-		LOG(L_ERR, "auth:post_auth: Error while marking parsed credentials\n");
-		res = ERROR;
-	}
-
 	return res;
 }
 




More information about the sr-dev mailing list