Browse code

uac_redirect: test if the acc function is set before binding to acc module

- GH #3188

(cherry picked from commit e21df35840c7a85cf26a3005f718e5e37edeac8e)

Daniel-Constantin Mierla authored on 18/07/2022 06:37:48
Showing 1 changed files
... ...
@@ -166,6 +166,10 @@ static int get_redirect_fixup(void** param, int param_no)
166 166
 		*param=(void*)(long)( (((unsigned short)maxt)<<8) | maxb);
167 167
 	} else if (param_no==2) {
168 168
 		/* acc function loaded? */
169
+		if (uacred_acc_fct_s.s==0 || uacred_acc_fct_s.s[0]=='\0') {
170
+			LM_ERR("acc support enabled, but no acc function defined\n");
171
+			return E_UNSPEC;
172
+		}
169 173
 		if (_uacred_accb.acc_request==NULL) {
170 174
 			/* bind the ACC API */
171 175
 			if(acc_load_api(&_uacred_accb) < 0) {
... ...
@@ -249,10 +253,12 @@ static int redirect_init(void)
249 253
 		goto error;
250 254
 	}
251 255
 
252
-	/* bind the ACC API */
253
-	if(acc_load_api(&_uacred_accb) < 0) {
254
-		LM_ERR("cannot bind to ACC API\n");
255
-		return -1;
256
+	if(uacred_acc_fct_s.s != 0 && uacred_acc_fct_s.s[0] != '\0') {
257
+		/* bind the ACC API */
258
+		if(acc_load_api(&_uacred_accb) < 0) {
259
+			LM_ERR("cannot bind to ACC API\n");
260
+			return -1;
261
+		}
256 262
 	}
257 263
 
258 264
 	/* init filter */