Skip to content

Commit dfd616b

Browse files
committed
auth: Add helpful logs on pv_xxx_auth() mis-usage
Also, fix top-level rc from "-1" (invalid user? continue script?) into "0" (auto-reply SIP 500 error! halt script!) on such scripting errors. Fixes #3756
1 parent df52003 commit dfd616b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

modules/auth/auth_mod.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,10 @@ static inline int auth_get_ha1(struct sip_msg *msg, dig_cred_t* digest,
393393
return 1;
394394
}
395395
} else {
396-
return 1;
396+
if (!user_spec.type)
397+
LM_ERR("before calling pv_xxx_authorize(), you MUST first define"
398+
" the 'username_spec' modparam\n");
399+
return -1;
397400
}
398401
/* get password from PV */
399402
memset(&sval, 0, sizeof(pv_value_t));
@@ -406,7 +409,10 @@ static inline int auth_get_ha1(struct sip_msg *msg, dig_cred_t* digest,
406409
return -1;
407410
}
408411
} else {
409-
return 1;
412+
if (!passwd_spec.type)
413+
LM_ERR("before calling pv_xxx_authorize(), you MUST first define"
414+
" the 'password_spec' modparam\n");
415+
return -1;
410416
}
411417
const struct digest_auth_calc *digest_calc;
412418
digest_calc = get_digest_calc(digest->alg.alg_parsed);

0 commit comments

Comments
 (0)