Browse code

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

Daniel-Constantin Mierla authored on 18/07/2017 13:53:50
Showing 1 changed files
... ...
@@ -485,7 +485,8 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd,
485 485
 {
486 486
 	struct hdr_field* h;
487 487
 	auth_body_t* cred;
488
-	int ret;
488
+	auth_cfg_result_t ret;
489
+	auth_result_t rauth;
489 490
 	str hf = {0, 0};
490 491
 	avp_value_t val;
491 492
 	static char ha1[256];
... ...
@@ -545,8 +546,8 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd,
545 546
 	}
546 547
 
547 548
 	/* Recalculate response, it must be same to authorize successfully */
548
-	ret = auth_check_response(&(cred->digest), method, ha1);
549
-	if(ret==AUTHENTICATED) {
549
+	rauth = auth_check_response(&(cred->digest), method, ha1);
550
+	if(rauth==AUTHENTICATED) {
550 551
 		ret = AUTH_OK;
551 552
 		switch(post_auth(msg, h, ha1)) {
552 553
 			case AUTHENTICATED:
... ...
@@ -556,7 +557,7 @@ int pv_authenticate(struct sip_msg *msg, str *realm, str *passwd,
556 557
 				break;
557 558
 		}
558 559
 	} else {
559
-		if(ret==NOT_AUTHENTICATED)
560
+		if(rauth==NOT_AUTHENTICATED)
560 561
 			ret = AUTH_INVALID_PASSWORD;
561 562
 		else
562 563
 			ret = AUTH_ERROR;