Module: kamailio
Branch: master
Commit: f4a1a9b3b79a0437bc2fa5e68fc82d1415af1a5e
URL:
https://github.com/kamailio/kamailio/commit/f4a1a9b3b79a0437bc2fa5e68fc82d1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-12-14T08:23:13+01:00
group: use proper variable to get the domain
- mode debug messages
- closes GH #1363
---
Modified: src/modules/group/group.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f4a1a9b3b79a0437bc2fa5e68fc82d1…
Patch:
https://github.com/kamailio/kamailio/commit/f4a1a9b3b79a0437bc2fa5e68fc82d1…
---
diff --git a/src/modules/group/group.c b/src/modules/group/group.c
index 05cc761b7b..329587a69c 100644
--- a/src/modules/group/group.c
+++ b/src/modules/group/group.c
@@ -158,8 +158,19 @@ int is_user_in_helper(sip_msg_t* _msg, str *user, str *domain, str
*grp)
VAL_STR(vals) = *user;
- if(domain) {
- VAL_STR(vals + 2) = *domain;
+ if(use_domain) {
+ if(domain && domain->s) {
+ VAL_STR(vals + 2) = *domain;
+ } else {
+ LM_ERR("no domain\n");
+ return -1;
+ }
+ LM_DBG("checking if '%.*s(a)%.*s' is in '%.*s'\n",
+ user->len, user->s, domain->len, domain->s,
+ grp->len, grp->s);
+ } else {
+ LM_DBG("checking if '%.*s' is in '%.*s'\n",
+ user->len, user->s, grp->len, grp->s);
}
VAL_TYPE(vals) = VAL_TYPE(vals + 1) = VAL_TYPE(vals + 2) = DB1_STR;
@@ -200,9 +211,8 @@ int is_user_in(sip_msg_t* _msg, char* _hf, char* _grp)
{
str user = STR_NULL;
str domain = STR_NULL;
- str group = STR_NULL;
- if ( get_username_domain( _msg, (group_check_p)_hf, &user, &group)!=0) {
+ if ( get_username_domain( _msg, (group_check_p)_hf, &user, &domain)!=0) {
LM_ERR("failed to get username@domain\n");
return -1;
}