Skip to content

Commit

Permalink
Fix return of false positives by is_script_func_used()
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Apr 8, 2019
1 parent 7b594ff commit b632d5e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions route_struct.c
Expand Up @@ -622,9 +622,14 @@ int is_mod_func_used(struct action *a, char *name, int param_no)
if (a->type==MODULE_T) {
/* first param is the name of the function */
cmd = (cmd_export_t*)a->elem[0].u.data;
if (strcasecmp(cmd->name, name)==0 || param_no==-1) {
LM_DBG("function %s found to be used in script\n",name);
return 1;
if (strcasecmp(cmd->name, name)==0) {
if (param_no==-1 ||
(a->elem[param_no].type != NOSUBTYPE &&
a->elem[param_no].type != NULLV_ST)) {
LM_DBG("function %s found to be used in script\n",name);
return 1;
}

}
}

Expand Down Expand Up @@ -671,9 +676,15 @@ int is_mod_async_func_used(struct action *a, char *name, int param_no)
if (a->type==ASYNC_T || a->type==LAUNCH_T) {
acmd = ((struct action *)(a->elem[0].u.data))->elem[0].u.data;

LM_DBG("checking %s against %s\n", name, acmd->name);
if (strcasecmp(acmd->name, name) == 0 || param_no == -1)
return 1;
if (strcasecmp(acmd->name, name)==0) {
if (param_no==-1 ||
(((struct action *)(a->elem[0].u.data))->elem[param_no].type != NOSUBTYPE &&
((struct action *)(a->elem[0].u.data))->elem[param_no].type != NULLV_ST)) {
LM_DBG("function %s found to be used in script\n",name);
return 1;
}

}
}

/* follow all leads from actions than may have
Expand Down

0 comments on commit b632d5e

Please sign in to comment.