Hello,

in 1.x, $Au was available after any x_authorize() call found a digest with the 
requested realm, regardless of the result of the authgentication. In 3.x, $Au 
is only available after successfull authentication.

I use $Au to get the digest username after pv_xxx_authorize() with dummy 
password, so i can use the username for caching into htable.  This no longer 
works in 3.x

Attached patch fixes this. Opinions on whether is should be committed?
-- 
Alex Hermann
commit 0c2b8f8b99de4340566e5c2e39f362a25869091a
Author: Alex Hermann <[email protected]>
Date:   Mon Sep 5 01:08:04 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 credentails
    username@domain for mathcing realm, not for successfull authentication.

diff --git a/modules/auth/api.c b/modules/auth/api.c
index b7ce413..ca22f44 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;
_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to