Module: kamailio
Branch: master
Commit: c2ad115ec1b96e99bc956f0f8e83cacc214da6b6
URL:
https://github.com/kamailio/kamailio/commit/c2ad115ec1b96e99bc956f0f8e83cac…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-07-07T09:04:37+02:00
app_perl: added modparam to control behaviour on perl_parse() code
---
Modified: src/modules/app_perl/app_perl_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c2ad115ec1b96e99bc956f0f8e83cac…
Patch:
https://github.com/kamailio/kamailio/commit/c2ad115ec1b96e99bc956f0f8e83cac…
---
diff --git a/src/modules/app_perl/app_perl_mod.c b/src/modules/app_perl/app_perl_mod.c
index ec373c7bf6..2e3fc3683d 100644
--- a/src/modules/app_perl/app_perl_mod.c
+++ b/src/modules/app_perl/app_perl_mod.c
@@ -71,6 +71,7 @@ int unsafemodfnc = 0;
int _ap_reset_cycles_init = 0;
int _ap_exec_cycles = 0;
int *_ap_reset_cycles = 0;
+int _ap_parse_mode = 0;
/* Reference to the running Perl interpreter instance */
PerlInterpreter *my_perl = NULL;
@@ -123,6 +124,7 @@ static param_export_t params[] = {
{"unsafemodfnc", INT_PARAM, &unsafemodfnc},
{"reset_cycles", INT_PARAM, &_ap_reset_cycles_init},
{"perl_destroy_func", PARAM_STRING, &perl_destroy_func},
+ {"parse_mode", PARAM_INT, &_ap_parse_mode},
{ 0, 0, 0 }
};
@@ -237,8 +239,21 @@ PerlInterpreter *parser_init(void) {
pr=perl_parse(new_perl, xs_init, argc, argv, NULL);
if (pr) {
- LM_WARN("parsed perl file \"%s\" returned with code %d -
continue\n",
+ if(_ap_parse_mode==0) {
+ LM_WARN("parsed perl file \"%s\" returned with code %d -
continue\n",
argv[argc-1], pr);
+ } else {
+ LM_ERR("failed parsing perl file \"%s\" with code %d.\n",
+ argv[argc-1], pr);
+ if (modpathset_start) {
+ for (i = modpathset_start; i <= modpathset_end; i++) {
+ pkg_free(argv[i]);
+ }
+ }
+ perl_destruct(new_perl);
+ perl_free(new_perl);
+ return NULL;
+ }
} else {
LM_INFO("successfully parsed perl file \"%s\"\n", argv[argc-1]);
}