From 563a8e0f0cd1724eb113be3834bf6b8370dacf0b Mon Sep 17 00:00:00 2001 From: brectanus Date: Fri, 11 Apr 2008 20:05:44 +0000 Subject: [PATCH] Fixed issue where the exec action may not be able to execute shell scripts. See #475. --- CHANGES | 4 +++- apache2/apache2_util.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a9ebd482..a5693b5a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,12 @@ -02 Apr 2008 - trunk +11 Apr 2008 - trunk ------------------- * Allow HTTP_* targets as an alias for REQUEST_HEADERS:*. * Make sure temporary filehandles are closed after a transaction. + * Fixed issue where the exec action may not be able to execute shell scripts. + 14 Mar 2008 - 2.5.1 ------------------- 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; }