浏览代码

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@domain for matching realm, not only for successfull authentication.
Alex Hermann 14 年之前
父节点
当前提交
451eb00507
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      modules/auth/api.c

+ 5 - 5
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;
 }