浏览代码

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

- GH #3188
Daniel-Constantin Mierla 3 年之前
父节点
当前提交
e21df35840
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. 10 4
      src/modules/uac_redirect/uac_redirect.c

+ 10 - 4
src/modules/uac_redirect/uac_redirect.c

@@ -166,6 +166,10 @@ static int get_redirect_fixup(void** param, int param_no)
 		*param=(void*)(long)( (((unsigned short)maxt)<<8) | maxb);
 	} else if (param_no==2) {
 		/* acc function loaded? */
+		if (uacred_acc_fct_s.s==0 || uacred_acc_fct_s.s[0]=='\0') {
+			LM_ERR("acc support enabled, but no acc function defined\n");
+			return E_UNSPEC;
+		}
 		if (_uacred_accb.acc_request==NULL) {
 			/* bind the ACC API */
 			if(acc_load_api(&_uacred_accb) < 0) {
@@ -249,10 +253,12 @@ static int redirect_init(void)
 		goto error;
 	}
 
-	/* bind the ACC API */
-	if(acc_load_api(&_uacred_accb) < 0) {
-		LM_ERR("cannot bind to ACC API\n");
-		return -1;
+	if(uacred_acc_fct_s.s != 0 && uacred_acc_fct_s.s[0] != '\0') {
+		/* bind the ACC API */
+		if(acc_load_api(&_uacred_accb) < 0) {
+			LM_ERR("cannot bind to ACC API\n");
+			return -1;
+		}
 	}
 
 	/* init filter */