From f4d9be60489461f0903b8ca2d1e6248d1e0b0717 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 18 Jul 2022 08:37:48 +0200 Subject: [PATCH] uac_redirect: test if the acc function is set before binding to acc module - GH #3188 (cherry picked from commit e21df35840c7a85cf26a3005f718e5e37edeac8e) --- src/modules/uac_redirect/uac_redirect.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 */