[sr-dev] git:master:41e9af58: auth: use the dedicated types for return codes instead of generic int

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 18 16:07:29 CEST 2017


Module: kamailio
Branch: master
Commit: 41e9af5833ff49e36a646a8cbe47d835f73661f0
URL: https://github.com/kamailio/kamailio/commit/41e9af5833ff49e36a646a8cbe47d835f73661f0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-18T15:53:50+02:00

auth: use the dedicated types for return codes instead of generic int

---

Modified: src/modules/auth/auth_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/41e9af5833ff49e36a646a8cbe47d835f73661f0.diff
Patch: https://github.com/kamailio/kamailio/commit/41e9af5833ff49e36a646a8cbe47d835f73661f0.patch

---

diff --git a/src/modules/auth/auth_mod.c b/src/modules/auth/auth_mod.c
index bdb0d7a229..eb7a7126c4 100644
--- a/src/modules/auth/auth_mod.c
+++ b/src/modules/auth/auth_mod.c
@@ -485,7 +485,8 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd,
 {
 	struct hdr_field* h;
 	auth_body_t* cred;
-	int ret;
+	auth_cfg_result_t ret;
+	auth_result_t rauth;
 	str hf = {0, 0};
 	avp_value_t val;
 	static char ha1[256];
@@ -545,8 +546,8 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd,
 	}
 
 	/* Recalculate response, it must be same to authorize successfully */
-	ret = auth_check_response(&(cred->digest), method, ha1);
-	if(ret==AUTHENTICATED) {
+	rauth = auth_check_response(&(cred->digest), method, ha1);
+	if(rauth==AUTHENTICATED) {
 		ret = AUTH_OK;
 		switch(post_auth(msg, h, ha1)) {
 			case AUTHENTICATED:
@@ -556,7 +557,7 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd,
 				break;
 		}
 	} else {
-		if(ret==NOT_AUTHENTICATED)
+		if(rauth==NOT_AUTHENTICATED)
 			ret = AUTH_INVALID_PASSWORD;
 		else
 			ret = AUTH_ERROR;




More information about the sr-dev mailing list