[sr-dev] git:5.4:95bbb4f0: group: check if credentials are parsed

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 15 08:38:23 CEST 2021


Module: kamailio
Branch: 5.4
Commit: 95bbb4f0b1784a20db5c76fdbdd4fc58a2250b6d
URL: https://github.com/kamailio/kamailio/commit/95bbb4f0b1784a20db5c76fdbdd4fc58a2250b6d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-04-15T08:34:56+02:00

group: check if credentials are parsed

(cherry picked from commit e84c1985f1c3ed7a791660702b398b9ac1eb1f4a)

---

Modified: src/modules/group/group.c

---

Diff:  https://github.com/kamailio/kamailio/commit/95bbb4f0b1784a20db5c76fdbdd4fc58a2250b6d.diff
Patch: https://github.com/kamailio/kamailio/commit/95bbb4f0b1784a20db5c76fdbdd4fc58a2250b6d.patch

---

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");




More information about the sr-dev mailing list