Skip to content

Commit

Permalink
auth: use the dedicated types for return codes instead of generic int
Browse files Browse the repository at this point in the history
(cherry picked from commit 41e9af5)
  • Loading branch information
miconda committed Aug 30, 2017
1 parent 455d64c commit 0827676
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/auth/auth_mod.c
Expand Up @@ -478,7 +478,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];
Expand Down Expand Up @@ -538,8 +539,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:
Expand All @@ -549,7 +550,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;
Expand Down

0 comments on commit 0827676

Please sign in to comment.