Browse code

group: check if credentials are parsed

(cherry picked from commit e84c1985f1c3ed7a791660702b398b9ac1eb1f4a)
(cherry picked from commit 95bbb4f0b1784a20db5c76fdbdd4fc58a2250b6d)

Daniel-Constantin Mierla authored on 13/04/2021 08:21:39 • Henning Westerholt committed on 22/10/2021 11:51:54
Showing 1 changed files
... ...
@@ -54,7 +54,7 @@ int get_username_domain(struct sip_msg *msg, group_check_p gcp,
54 54
 {
55 55
 	struct sip_uri puri;
56 56
 	struct sip_uri *turi;
57
-	struct hdr_field* h;
57
+	struct hdr_field* h = 0;
58 58
 	struct auth_body* c = 0;
59 59
 	pv_value_t value;
60 60
 
... ...
@@ -89,15 +89,20 @@ int get_username_domain(struct sip_msg *msg, group_check_p gcp,
89 89
 				get_authorized_cred( msg->proxy_auth, &h);
90 90
 				if (!h) {
91 91
 					LM_ERR("no authorized credentials found "
92
-							"(error in scripts)\n");
92
+							"(error in script)\n");
93 93
 					return -1;
94 94
 				}
95 95
 			}
96
+			if(!h->parsed) {
97
+				LM_ERR("no parsed authorized credentials found "
98
+						"(error in script)\n");
99
+				return -1;
100
+			}
96 101
 			c = (auth_body_t*)(h->parsed);
97 102
 			break;
98 103
 
99 104
 		case 5: /* AVP spec */
100
-			if(pv_get_spec_value( msg, &gcp->sp, &value)!=0 
105
+			if(pv_get_spec_value( msg, &gcp->sp, &value)!=0
101 106
 				|| value.flags&PV_VAL_NULL || value.rs.len<=0)
102 107
 			{
103 108
 				LM_ERR("no AVP found (error in scripts)\n");