[asterisk-commits] mmichelson: branch mmichelson/authenticate r380811 - /team/mmichelson/authent...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 4 12:22:19 CST 2013
Author: mmichelson
Date: Mon Feb 4 12:22:16 2013
New Revision: 380811
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380811
Log:
Get authentication working with md5 credentials specified.
Modified:
team/mmichelson/authenticate/res/res_sip_authenticator.c
Modified: team/mmichelson/authenticate/res/res_sip_authenticator.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/authenticate/res/res_sip_authenticator.c?view=diff&rev=380811&r1=380810&r2=380811
==============================================================================
--- team/mmichelson/authenticate/res/res_sip_authenticator.c (original)
+++ team/mmichelson/authenticate/res/res_sip_authenticator.c Mon Feb 4 12:22:16 2013
@@ -86,6 +86,9 @@
const pj_str_t *acc_name, pjsip_cred_info *info)
{
RAII_VAR(struct ast_sip_auth *, auth, get_auth(), ao2_cleanup);
+ if (!auth) {
+ return PJSIP_SC_FORBIDDEN;
+ }
if (pj_strcmp2(realm, auth->realm)) {
return PJSIP_SC_FORBIDDEN;
@@ -93,10 +96,22 @@
if (pj_strcmp2(acc_name, auth->auth_user)) {
return PJSIP_SC_FORBIDDEN;
}
+
pj_strdup2(pool, &info->realm, auth->realm);
pj_strdup2(pool, &info->username, auth->auth_user);
- pj_strdup2(pool, &info->data, auth->auth_pass);
- info->data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+
+ switch (auth->type) {
+ case AST_SIP_AUTH_TYPE_USER_PASS:
+ pj_strdup2(pool, &info->data, auth->auth_pass);
+ info->data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
+ break;
+ case AST_SIP_AUTH_TYPE_MD5:
+ pj_strdup2(pool, &info->data, auth->md5_creds);
+ info->data_type = PJSIP_CRED_DATA_DIGEST;
+ break;
+ default:
+ return PJSIP_SC_FORBIDDEN;
+ }
return PJ_SUCCESS;
}
More information about the asterisk-commits
mailing list