]> granicus.if.org Git - apache/commitdiff
Tokenize the arguments for rewrite programs during config parsing, and
authorRyan Bloom <rbb@apache.org>
Thu, 30 May 2002 00:02:59 +0000 (00:02 +0000)
committerRyan Bloom <rbb@apache.org>
Thu, 30 May 2002 00:02:59 +0000 (00:02 +0000)
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

modules/mappers/mod_rewrite.c
modules/mappers/mod_rewrite.h

index a352fb3a4620daa28e16698db5235849f32582b6..e394da9a366373cb18110d3af2062e25f58f1af8 100644 (file)
@@ -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) ||
index 14a4db73588cb60c93ee5337eec0c4da06e904cd..7d7661dea9d84e83b645ecc6a448a8b44a9af121 100644 (file)
@@ -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);