From a615470028367f38e8327035491cd8901dff0159 Mon Sep 17 00:00:00 2001 From: brectanus Date: Thu, 24 Apr 2008 16:30:58 +0000 Subject: [PATCH] Fixed issue where the exec action may not be able to execute shell scripts. See #475. --- CHANGES | 2 ++ apache2/apache2_util.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ff3b5746..581ea471 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ 24 Apr 2008 - 2.5.3 ------------------- + * Fixed issue where the exec action may not be able to execute shell scripts. + * Macros are now expanded in expirevar and deprecatevar. diff --git a/apache2/apache2_util.c b/apache2/apache2_util.c index 543b918e..ca5f532d 100644 --- a/apache2/apache2_util.c +++ b/apache2/apache2_util.c @@ -103,7 +103,9 @@ int apache2_exec(modsec_rec *msr, const char *command, const char **argv, char * } apr_procattr_io_set(procattr, APR_NO_PIPE, APR_FULL_BLOCK, APR_NO_PIPE); + apr_procattr_cmdtype_set(procattr, APR_SHELLCMD); + msr_log(msr, 9, "Exec: %s", log_escape_nq(r->pool, command)); rc = apr_proc_create(procnew, command, argv, env, procattr, r->pool); if (rc != APR_SUCCESS) { msr_log(msr, 1, "Exec: Execution failed: %s (%s)", log_escape_nq(r->pool, command), @@ -147,7 +149,8 @@ int apache2_exec(modsec_rec *msr, const char *command, const char **argv, char * nbytes = 255; while(apr_file_read(script_out, buf, &nbytes) == APR_SUCCESS) nbytes = 255; } else { - msr_log(msr, 1, "Exec: Execution failed: %s (%s)", log_escape_nq(r->pool, command), + msr_log(msr, 1, "Exec: Execution failed while reading output: %s (%s)", + log_escape_nq(r->pool, command), get_apr_error(r->pool, rc2)); return -1; }