Module: kamailio Branch: master Commit: e84c1985f1c3ed7a791660702b398b9ac1eb1f4a URL: https://github.com/kamailio/kamailio/commit/e84c1985f1c3ed7a791660702b398b9a...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-04-13T10:21:39+02:00
group: check if credentials are parsed
---
Modified: src/modules/group/group.c
---
Diff: https://github.com/kamailio/kamailio/commit/e84c1985f1c3ed7a791660702b398b9a... Patch: https://github.com/kamailio/kamailio/commit/e84c1985f1c3ed7a791660702b398b9a...
---
diff --git a/src/modules/group/group.c b/src/modules/group/group.c index 329587a69c..af1c62c0f3 100644 --- a/src/modules/group/group.c +++ b/src/modules/group/group.c @@ -54,7 +54,7 @@ int get_username_domain(struct sip_msg *msg, group_check_p gcp, { struct sip_uri puri; struct sip_uri *turi; - struct hdr_field* h; + struct hdr_field* h = 0; struct auth_body* c = 0; pv_value_t value;
@@ -89,15 +89,20 @@ int get_username_domain(struct sip_msg *msg, group_check_p gcp, get_authorized_cred( msg->proxy_auth, &h); if (!h) { LM_ERR("no authorized credentials found " - "(error in scripts)\n"); + "(error in script)\n"); return -1; } } + if(!h->parsed) { + LM_ERR("no parsed authorized credentials found " + "(error in script)\n"); + return -1; + } c = (auth_body_t*)(h->parsed); break;
case 5: /* AVP spec */ - if(pv_get_spec_value( msg, &gcp->sp, &value)!=0 + if(pv_get_spec_value( msg, &gcp->sp, &value)!=0 || value.flags&PV_VAL_NULL || value.rs.len<=0) { LM_ERR("no AVP found (error in scripts)\n");