[sr-dev] git:5.6:f4d9be60: uac_redirect: test if the acc function is set before binding to acc module

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 16 12:01:24 CEST 2022


Module: kamailio
Branch: 5.6
Commit: f4d9be60489461f0903b8ca2d1e6248d1e0b0717
URL: https://github.com/kamailio/kamailio/commit/f4d9be60489461f0903b8ca2d1e6248d1e0b0717

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-08-16T11:55:41+02:00

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

- GH #3188

(cherry picked from commit e21df35840c7a85cf26a3005f718e5e37edeac8e)

---

Modified: src/modules/uac_redirect/uac_redirect.c

---

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

---

diff --git a/src/modules/uac_redirect/uac_redirect.c b/src/modules/uac_redirect/uac_redirect.c
index 1fd06c5b723..76b7592b5af 100644
--- a/src/modules/uac_redirect/uac_redirect.c
+++ b/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 */




More information about the sr-dev mailing list