Module: kamailio
Branch: 4.3
Commit: 978e3b65c7d1d21a69a55492dc156493cc8c28bf
URL:
https://github.com/kamailio/kamailio/commit/978e3b65c7d1d21a69a55492dc15649…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-09-17T13:52:49+02:00
auth_db: more log messages when username checks failed
(cherry picked from commit d46d008e0936a01229872df71ac26afb43122f4b)
---
Modified: modules/auth_db/authorize.c
---
Diff:
https://github.com/kamailio/kamailio/commit/978e3b65c7d1d21a69a55492dc15649…
Patch:
https://github.com/kamailio/kamailio/commit/978e3b65c7d1d21a69a55492dc15649…
---
diff --git a/modules/auth_db/authorize.c b/modules/auth_db/authorize.c
index 6d582c2..86e1cb7 100644
--- a/modules/auth_db/authorize.c
+++ b/modules/auth_db/authorize.c
@@ -512,30 +512,40 @@ int auth_check(struct sip_msg* _m, char* _realm, char* _table, char
*_flags)
|| _m->REQ_METHOD==METHOD_PRACK || _m->REQ_METHOD==METHOD_UPDATE
|| _m->REQ_METHOD==METHOD_MESSAGE))) {
if(srealm.len!=uri->user.len
- || strncmp(srealm.s, uri->user.s, srealm.len)!=0)
+ || strncmp(srealm.s, uri->user.s, srealm.len)!=0) {
+ LM_DBG("authentication username mismatch with from/to username\n");
return AUTH_USER_MISMATCH;
+ }
}
if(_m->REQ_METHOD==METHOD_REGISTER || _m->REQ_METHOD==METHOD_PUBLISH) {
/* check from==to */
if(furi->user.len!=turi->user.len
- || strncmp(furi->user.s, turi->user.s, furi->user.len)!=0)
+ || strncmp(furi->user.s, turi->user.s, furi->user.len)!=0) {
+ LM_DBG("from username mismatch with to username\n");
return AUTH_USER_MISMATCH;
+ }
if(use_domain!=0 && (furi->host.len!=turi->host.len
- || strncmp(furi->host.s, turi->host.s, furi->host.len)!=0))
+ || strncmp(furi->host.s, turi->host.s, furi->host.len)!=0)) {
+ LM_DBG("from domain mismatch with to domain\n");
return AUTH_USER_MISMATCH;
+ }
/* check r-uri==from for publish */
if(_m->REQ_METHOD==METHOD_PUBLISH) {
if(parse_sip_msg_uri(_m)<0)
return AUTH_ERROR;
uri = &_m->parsed_uri;
if(furi->user.len!=uri->user.len
- || strncmp(furi->user.s, uri->user.s, furi->user.len)!=0)
+ || strncmp(furi->user.s, uri->user.s, furi->user.len)!=0) {
+ LM_DBG("from username mismatch with r-uri username\n");
return AUTH_USER_MISMATCH;
+ }
if(use_domain!=0 && (furi->host.len!=uri->host.len
- || strncmp(furi->host.s, uri->host.s, furi->host.len)!=0))
+ || strncmp(furi->host.s, uri->host.s, furi->host.len)!=0)) {
+ LM_DBG("from domain mismatch with r-uri domain\n");
return AUTH_USER_MISMATCH;
}
+ }
}
return AUTH_OK;
}