From: Ryan Bloom Date: Thu, 30 May 2002 00:02:59 +0000 (+0000) Subject: Tokenize the arguments for rewrite programs during config parsing, and X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff841f19b930d2f37ea198716bd88eb7909fb936;p=apache Tokenize the arguments for rewrite programs during config parsing, and just use that information later. I was having a problem with prg directives with arguments failing the configuration. The problem was a call to stat, which was being passed the program name and the arguments. Obviously, the arguments were messing up the call to stat. This gets the test suite working for me again. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95372 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index a352fb3a46..e394da9a36 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -455,8 +455,9 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1, } else if (strncmp(a2, "prg:", 4) == 0) { newmap->type = MAPTYPE_PRG; - newmap->datafile = a2+4; - newmap->checkfile = NULL; + apr_tokenize_to_argv(a2 + 4, &newmap->argv, cmd->pool); + newmap->checkfile = newmap->argv[0]; + } else if (strncmp(a2, "int:", 4) == 0) { newmap->type = MAPTYPE_INT; @@ -3404,7 +3405,7 @@ static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p) } fpin = NULL; fpout = NULL; - rc = rewritemap_program_child(p, map->datafile, + rc = rewritemap_program_child(p, map->argv[0], map->argv, &fpout, &fpin, &fperr); if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, @@ -3420,7 +3421,8 @@ static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p) } /* child process code */ -static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname, +static apr_status_t rewritemap_program_child(apr_pool_t *p, + const char *progname, char **argv, apr_file_t **fpout, apr_file_t **fpin, apr_file_t **fperr) { @@ -3428,9 +3430,6 @@ static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname apr_procattr_t *procattr; apr_proc_t *procnew; apr_finfo_t st; - char **argv; - - rc = apr_tokenize_to_argv(progname, &argv, p); if (((rc = apr_stat(&st, argv[0], APR_FINFO_MIN, p)) != APR_SUCCESS) || ((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) || diff --git a/modules/mappers/mod_rewrite.h b/modules/mappers/mod_rewrite.h index 14a4db7358..7d7661dea9 100644 --- a/modules/mappers/mod_rewrite.h +++ b/modules/mappers/mod_rewrite.h @@ -253,6 +253,7 @@ typedef struct { apr_file_t *fperr; /* err file pointer for program maps */ char *(*func)(request_rec *, /* function pointer for internal maps */ char *); + char **argv; } rewritemap_entry; typedef struct { @@ -456,7 +457,8 @@ static apr_status_t rewritelock_remove(void *data); /* program map support */ static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p); -static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname, +static apr_status_t rewritemap_program_child(apr_pool_t *p, + const char *progname, char **argv, apr_file_t **fpout, apr_file_t **fpin, apr_file_t **fperr);