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
  • Loading branch information
miconda committed Jul 18, 2017
1 parent 2a19f9e commit 41e9af5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/auth/auth_mod.c
Expand Up @@ -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];
Expand Down Expand Up @@ -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:
Expand All @@ -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;
Expand Down

0 comments on commit 41e9af5

Please sign in to comment.