You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ch...@apache.org on 2010/02/02 23:22:53 UTC

svn commit: r905820 - in /httpd/mod_fcgid/trunk: ./ modules/fcgid/

Author: chrisd
Date: Tue Feb  2 22:22:52 2010
New Revision: 905820

URL: http://svn.apache.org/viewvc?rev=905820&view=rev
Log:
Fix lookup of process command lines when using FcgidWrapper or
access control directives, including within .htaccess files.

Making the existing command-line-to-group-ID mapping work with dynamically
discovered configurations (i.e., .htaccess files) and making it thread-safe
would require global shared-memory storage with locks, or something similar.
Instead we just use the raw command lines to help distinguish different
processes.

Also clean up some interactions between access control directives and
wrappers, specifically, since AAA directives perform a check for an
extant (executable) file based on the path they're configured with,
they can only work with wrappers if the wrapper is an actual file, not
a virtual one, and thus we can remove the additional get_wrapper_info() calls
for these directives.  Effectively, the AAA directives are themselves a
kind of wrapper, since we're not looking up their process from the requested
URL.  Future work might allow the AAA directives to take a command line
with arguments, making them equal citizens with non-AAA wrappers.

Modified:
    httpd/mod_fcgid/trunk/CHANGES-FCGID
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
    httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c

Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Tue Feb  2 22:22:52 2010
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with mod_fcgid 2.3.6
 
+  *) Fix lookup of process command lines when using FcgidWrapper or
+     access control directives, including within .htaccess files.
+     [Chris Darroch]
+
   *) Resolve a regression in 2.3.5 with httpd 2.0.x on some Unix platforms;
      ownership of mutex files was incorrect, resulting in a startup failure.
      PR 48651.  [Jeff Trawick, <pservit gmail.com>]

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Tue Feb  2 22:22:52 2010
@@ -44,7 +44,7 @@
     apr_dev_t deviceid = command->deviceid;
     uid_t uid = command->uid;
     gid_t gid = command->gid;
-    apr_size_t share_grp_id = command->share_grp_id;
+    const char *cmdline = command->cmdline;
     const char *virtualhost = command->virtualhost;
 
     proc_table = proctable_get_table_array();
@@ -58,7 +58,7 @@
 
         if (current_node->inode == inode
             && current_node->deviceid == deviceid
-            && current_node->share_grp_id == share_grp_id
+            && !strcmp(current_node->cmdline, cmdline)
             && current_node->virtualhost == virtualhost
             && current_node->uid == uid && current_node->gid == gid) {
             /* Unlink from idle list */
@@ -138,7 +138,7 @@
     while (current_node != proc_table) {
         if (current_node->inode == command->inode
             && current_node->deviceid == command->deviceid
-            && current_node->share_grp_id == command->share_grp_id
+            && !strcmp(current_node->cmdline, command->cmdline)
             && current_node->virtualhost == command->virtualhost
             && current_node->uid == command->uid
             && current_node->gid == command->gid) {
@@ -282,17 +282,12 @@
 }
 
 static int
-handle_request(request_rec * r, int role, const char *argv0,
-               fcgid_auth_conf * auth_conf,
-               fcgid_wrapper_conf * wrapper_conf,
+handle_request(request_rec * r, int role, fcgid_cmd_conf *cmd_conf,
                apr_bucket_brigade * output_brigade)
 {
     apr_pool_t *request_pool = r->main ? r->main->pool : r->pool;
     fcgid_command fcgi_request;
     fcgid_bucket_ctx *bucket_ctx;
-    apr_ino_t inode;
-    apr_dev_t deviceid;
-    apr_size_t shareid;
     int i, j, cond_status;
     apr_status_t rv;
     apr_bucket_brigade *brigade_stdout;
@@ -305,26 +300,12 @@
     apr_pool_cleanup_register(request_pool, bucket_ctx,
                               bucket_ctx_cleanup, apr_pool_cleanup_null);
 
-    if (role == FCGI_AUTHORIZER) {
-        argv0 = auth_conf->path;
-        inode = wrapper_conf ? wrapper_conf->inode : auth_conf->inode;
-        deviceid = wrapper_conf ? wrapper_conf->deviceid : auth_conf->deviceid;
-        shareid = wrapper_conf ? wrapper_conf->share_group_id
-                               : auth_conf->share_group_id;
-    }
-    else {
-        inode = wrapper_conf ? wrapper_conf->inode : r->finfo.inode;
-        deviceid = wrapper_conf ? wrapper_conf->deviceid : r->finfo.device;
-        shareid = wrapper_conf ? wrapper_conf->share_group_id : 0;
-    }
-
     /* Try to get a connected ipc handle */
     for (i = 0; i < FCGID_REQUEST_COUNT; i++) {
         /* Apply a free process slot, send a spawn request if I can't get one */
         for (j = 0; j < FCGID_APPLY_TRY_COUNT; j++) {
             /* Init spawn request */
-            procmgr_init_spawn_cmd(&fcgi_request, r, argv0, deviceid,
-                                   inode, shareid);
+            procmgr_init_spawn_cmd(&fcgi_request, r, cmd_conf);
 
             bucket_ctx->ipc.connect_timeout =
                 fcgi_request.cmdopts.ipc_connect_timeout;
@@ -368,7 +349,8 @@
     /* Now I get a connected ipc handle */
     if (!bucket_ctx->procnode) {
         ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
-                      "mod_fcgid: can't apply process slot for %s", argv0);
+                      "mod_fcgid: can't apply process slot for %s",
+                      cmd_conf->cmdline);
         return HTTP_SERVICE_UNAVAILABLE;
     }
     bucket_ctx->active_time = bucket_ctx->procnode->last_active_time =
@@ -626,9 +608,7 @@
     return 0;
 }
 
-int bridge_request(request_rec * r, int role, const char *argv0,
-                   fcgid_auth_conf * auth_conf,
-                   fcgid_wrapper_conf * wrapper_conf)
+int bridge_request(request_rec * r, int role, fcgid_cmd_conf *cmd_conf)
 {
     apr_pool_t *request_pool = r->main ? r->main->pool : r->pool;
     apr_bucket_brigade *output_brigade;
@@ -663,6 +643,5 @@
     APR_BRIGADE_INSERT_TAIL(output_brigade, bucket_eos);
 
     /* Bridge the request */
-    return handle_request(r, role, argv0, auth_conf, wrapper_conf,
-                          output_brigade);
+    return handle_request(r, role, cmd_conf, output_brigade);
 }

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h Tue Feb  2 22:22:52 2010
@@ -24,8 +24,6 @@
 #include "fcgid_conf.h"
 
 apr_status_t bucket_ctx_cleanup(void *thectx);
-int bridge_request(request_rec * r, int role, const char *argv0,
-                   fcgid_auth_conf * auth_conf,
-                   fcgid_wrapper_conf * wrapper_conf);
+int bridge_request(request_rec * r, int role, fcgid_cmd_conf *cmd_conf);
 
 #endif

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Tue Feb  2 22:22:52 2010
@@ -621,11 +621,12 @@
     dirconfig->authenticator_info =
         apr_pcalloc(cmd->server->process->pconf,
                     sizeof(*dirconfig->authenticator_info));
-    apr_cpystrn(dirconfig->authenticator_info->path, authenticator,
-                _POSIX_PATH_MAX);
+    dirconfig->authenticator_info->cgipath =
+        apr_pstrdup(cmd->pool, authenticator);
+    dirconfig->authenticator_info->cmdline =
+        dirconfig->authenticator_info->cgipath;
     dirconfig->authenticator_info->inode = finfo.inode;
     dirconfig->authenticator_info->deviceid = finfo.device;
-    dirconfig->authenticator_info->share_group_id = (apr_size_t) - 1;
     return NULL;
 }
 
@@ -639,7 +640,7 @@
     return NULL;
 }
 
-fcgid_auth_conf *get_authenticator_info(request_rec * r, int *authoritative)
+fcgid_cmd_conf *get_authenticator_info(request_rec * r, int *authoritative)
 {
     fcgid_dir_conf *config =
         ap_get_module_config(r->per_dir_config, &fcgid_module);
@@ -669,11 +670,12 @@
     dirconfig->authorizer_info =
         apr_pcalloc(cmd->server->process->pconf,
                     sizeof(*dirconfig->authorizer_info));
-    apr_cpystrn(dirconfig->authorizer_info->path, authorizer,
-                _POSIX_PATH_MAX);
+    dirconfig->authorizer_info->cgipath =
+        apr_pstrdup(cmd->pool, authorizer);
+    dirconfig->authorizer_info->cmdline =
+        dirconfig->authorizer_info->cgipath;
     dirconfig->authorizer_info->inode = finfo.inode;
     dirconfig->authorizer_info->deviceid = finfo.device;
-    dirconfig->authorizer_info->share_group_id = (apr_size_t) - 1;
     return NULL;
 }
 
@@ -687,7 +689,7 @@
     return NULL;
 }
 
-fcgid_auth_conf *get_authorizer_info(request_rec * r, int *authoritative)
+fcgid_cmd_conf *get_authorizer_info(request_rec * r, int *authoritative)
 {
     fcgid_dir_conf *config =
         ap_get_module_config(r->per_dir_config, &fcgid_module);
@@ -717,10 +719,12 @@
     dirconfig->access_info =
         apr_pcalloc(cmd->server->process->pconf,
                     sizeof(*dirconfig->access_info));
-    apr_cpystrn(dirconfig->access_info->path, access, _POSIX_PATH_MAX);
+    dirconfig->access_info->cgipath =
+        apr_pstrdup(cmd->pool, access);
+    dirconfig->access_info->cmdline = 
+        dirconfig->access_info->cgipath;
     dirconfig->access_info->inode = finfo.inode;
     dirconfig->access_info->deviceid = finfo.device;
-    dirconfig->access_info->share_group_id = (apr_size_t) - 1;
     return NULL;
 }
 
@@ -734,7 +738,7 @@
     return NULL;
 }
 
-fcgid_auth_conf *get_access_info(request_rec * r, int *authoritative)
+fcgid_cmd_conf *get_access_info(request_rec * r, int *authoritative)
 {
     fcgid_dir_conf *config =
         ap_get_module_config(r->per_dir_config, &fcgid_module);
@@ -747,14 +751,6 @@
     return NULL;
 }
 
-typedef struct {
-    apr_hash_t *wrapper_id_hash;
-    apr_size_t cur_id;
-} wrapper_id_info;
-
-/* FIXME thread safety issues when FcgidWrapper is used in .htaccess;
- * see use of pconf
- */
 const char *set_wrapper_config(cmd_parms * cmd, void *dirconfig,
                                const char *wrapper_cmdline,
                                const char *extension,
@@ -763,11 +759,7 @@
     const char *path, *tmp;
     apr_status_t rv;
     apr_finfo_t finfo;
-    const char *userdata_key = "fcgid_wrapper_id";
-    wrapper_id_info *id_info;
-    apr_size_t *wrapper_id;
-    fcgid_wrapper_conf *wrapper = NULL;
-    apr_pool_t *wrapper_conf_pool = cmd->server->process->pconf; /* bad */
+    fcgid_cmd_conf *wrapper = NULL;
     fcgid_dir_conf *config = (fcgid_dir_conf *) dirconfig;
 
     /* Sanity checks */
@@ -786,36 +778,6 @@
             || ap_strchr_c(extension, '/') || ap_strchr_c(extension, '\\')))
         return "Invalid wrapper file extension";
 
-    /* Get wrapper_id hash from user data */
-    {
-        void *id_info_vp;
-        apr_pool_userdata_get(&id_info_vp, userdata_key,
-                              cmd->server->process->pool);
-        id_info = id_info_vp;
-    }
-
-    if (!id_info) {
-        id_info =
-            apr_pcalloc(cmd->server->process->pool, sizeof(*id_info));
-        id_info->wrapper_id_hash =
-            apr_hash_make(cmd->server->process->pool);
-        apr_pool_userdata_set((const void *) id_info, userdata_key,
-                              apr_pool_cleanup_null,
-                              cmd->server->process->pool);
-    }
-    /* Get wrapper_id for wrapper_cmdline */
-    if ((wrapper_id =
-         apr_hash_get(id_info->wrapper_id_hash, wrapper_cmdline,
-                      strlen(wrapper_cmdline))) == NULL) {
-        wrapper_id =
-            apr_pcalloc(cmd->server->process->pool, sizeof(*wrapper_id));
-        *wrapper_id = id_info->cur_id++;
-        apr_hash_set(id_info->wrapper_id_hash, wrapper_cmdline,
-                     strlen(wrapper_cmdline), wrapper_id);
-    }
-
-    wrapper = apr_pcalloc(wrapper_conf_pool, sizeof(*wrapper));
-
     /* Get wrapper path */
     tmp = wrapper_cmdline;
     path = ap_getword_white(cmd->temp_pool, &tmp);
@@ -828,14 +790,13 @@
         return missing_file_msg(cmd->pool, "Wrapper", path, rv);
     }
 
-    wrapper->exe = apr_pstrdup(wrapper_conf_pool, path);
-    /* FIXME no need to embed in structure (subject to correct pool usage) */
-    apr_cpystrn(wrapper->args, wrapper_cmdline, _POSIX_PATH_MAX);
+    wrapper = apr_pcalloc(cmd->pool, sizeof(*wrapper));
+
+    wrapper->cgipath = apr_pstrdup(cmd->pool, path);
+    wrapper->cmdline = apr_pstrdup(cmd->pool, wrapper_cmdline);
     wrapper->inode = finfo.inode;
     wrapper->deviceid = finfo.device;
-    wrapper->share_group_id = *wrapper_id;
     wrapper->virtual = (virtual != NULL && !strcasecmp(virtual, WRAPPER_FLAG_VIRTUAL));
-    (*wrapper_id)++;
 
     if (extension == NULL)
         extension = DEFAULT_WRAPPER_KEY;
@@ -848,10 +809,10 @@
     return NULL;
 }
 
-fcgid_wrapper_conf *get_wrapper_info(const char *cgipath, request_rec * r)
+fcgid_cmd_conf *get_wrapper_info(const char *cgipath, request_rec * r)
 {
     const char *extension;
-    fcgid_wrapper_conf *wrapper;
+    fcgid_cmd_conf *wrapper;
     fcgid_dir_conf *config =
         ap_get_module_config(r->per_dir_config, &fcgid_module);
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h Tue Feb  2 22:22:52 2010
@@ -47,20 +47,12 @@
 #include "fcgid_global.h"
 
 typedef struct {
-    char path[_POSIX_PATH_MAX];
+    const char *cgipath;           /* executable file path */
+    const char *cmdline; /* entire command line */
     apr_ino_t inode;
     apr_dev_t deviceid;
-    apr_size_t share_group_id;
-} fcgid_auth_conf;
-
-typedef struct {
-    const char *exe;            /* executable file path */
-    char args[_POSIX_PATH_MAX]; /* entire command line */
-    apr_ino_t inode;
-    apr_dev_t deviceid;
-    apr_size_t share_group_id;
     int virtual;
-} fcgid_wrapper_conf;
+} fcgid_cmd_conf;
 
 typedef struct {
     /* global only */
@@ -113,17 +105,17 @@
     apr_hash_t *wrapper_info_hash;
 
     /* authenticator */
-    fcgid_auth_conf *authenticator_info;
+    fcgid_cmd_conf *authenticator_info;
     int authenticator_authoritative;
     int authenticator_authoritative_set;
 
     /* authorizer */
-    fcgid_auth_conf *authorizer_info;
+    fcgid_cmd_conf *authorizer_info;
     int authorizer_authoritative;
     int authorizer_authoritative_set;
 
     /* access check */
-    fcgid_auth_conf *access_info;
+    fcgid_cmd_conf *access_info;
     int access_authoritative;
     int access_authoritative_set;
 } fcgid_dir_conf;
@@ -229,25 +221,25 @@
 
 const char *set_wrapper_config(cmd_parms * cmd, void *dummy,
                                const char *wrapper, const char *extension, const char* virtual);
-fcgid_wrapper_conf *get_wrapper_info(const char *cgipath, request_rec * r);
+fcgid_cmd_conf *get_wrapper_info(const char *cgipath, request_rec * r);
 
 const char *set_authenticator_info(cmd_parms * cmd, void *config,
                                    const char *arg);
 const char *set_authenticator_authoritative(cmd_parms * cmd,
                                             void *config, int arg);
-fcgid_auth_conf *get_authenticator_info(request_rec * r, int *authoritative);
+fcgid_cmd_conf *get_authenticator_info(request_rec * r, int *authoritative);
 
 const char *set_authorizer_info(cmd_parms * cmd, void *config,
                                 const char *arg);
 const char *set_authorizer_authoritative(cmd_parms * cmd,
                                          void *config, int arg);
-fcgid_auth_conf *get_authorizer_info(request_rec * r, int *authoritative);
+fcgid_cmd_conf *get_authorizer_info(request_rec * r, int *authoritative);
 
 const char *set_access_info(cmd_parms * cmd, void *config,
                             const char *arg);
 const char *set_access_authoritative(cmd_parms * cmd,
                                      void *config, int arg);
-fcgid_auth_conf *get_access_info(request_rec * r, int *authoritative);
+fcgid_cmd_conf *get_access_info(request_rec * r, int *authoritative);
 
 const char *set_php_fix_pathinfo_enable(cmd_parms * cmd, void *dummy,
                                         const char *arg);

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h Tue Feb  2 22:22:52 2010
@@ -22,10 +22,9 @@
 
 typedef struct {
     char cgipath[_POSIX_PATH_MAX];
-    char wrapper_cmdline[_POSIX_PATH_MAX];
+    char cmdline[_POSIX_PATH_MAX];
     apr_ino_t inode;
     dev_t deviceid;
-    apr_size_t share_grp_id;
     const char *virtualhost;  /* Virtualhost granularity */
     uid_t uid;                  /* For suEXEC */
     gid_t gid;                  /* For suEXEC */
@@ -37,8 +36,7 @@
 } fcgid_command;
 
 void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r,
-                            const char *argv0, dev_t deviceid,
-                            apr_ino_t inode, apr_size_t share_grp_id);
+                            fcgid_cmd_conf *cmd_conf);
 apr_status_t procmgr_post_spawn_cmd(fcgid_command * command,
                                     request_rec * r);
 apr_status_t procmgr_peek_cmd(fcgid_command * command,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c Tue Feb  2 22:22:52 2010
@@ -19,6 +19,7 @@
 #define CORE_PRIVATE
 #include "httpd.h"
 #include "http_config.h"
+#include "apr_strings.h"
 
 #include "fcgid_pm.h"
 #include "fcgid_pm_main.h"
@@ -492,7 +493,7 @@
     /* Prepare to spawn */
     procnode->deviceid = command->deviceid;
     procnode->inode = command->inode;
-    procnode->share_grp_id = command->share_grp_id;
+    apr_cpystrn(procnode->cmdline, command->cmdline, _POSIX_PATH_MAX);
     procnode->virtualhost = command->virtualhost;
     procnode->uid = command->uid;
     procnode->gid = command->gid;
@@ -537,7 +538,7 @@
     /* Spawn the process now */
     /* XXX Spawn uses wrapper_cmdline, but log uses cgipath ? */
     if ((rv =
-         proc_spawn_process(command->wrapper_cmdline, &procinfo,
+         proc_spawn_process(command->cmdline, &procinfo,
                             procnode)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_WARNING, rv, main_server,
                      "mod_fcgid: spawn process %s error", command->cgipath);

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c Tue Feb  2 22:22:52 2010
@@ -410,12 +410,9 @@
 }
 
 void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r,
-                            const char *argv0, dev_t deviceid,
-                            apr_ino_t inode, apr_size_t share_grp_id)
+                            fcgid_cmd_conf *cmd_conf)
 {
     ap_unix_identity_t *ugid;
-    fcgid_wrapper_conf *wrapperconf;
-    const char *cmd_to_spawn;
 
     memset(command, 0, sizeof(*command));
 
@@ -430,26 +427,13 @@
         command->userdir = 0;
     }
 
-    apr_cpystrn(command->cgipath, argv0, _POSIX_PATH_MAX);
-    command->deviceid = deviceid;
-    command->inode = inode;
-    command->share_grp_id = share_grp_id;
+    apr_cpystrn(command->cgipath, cmd_conf->cgipath, _POSIX_PATH_MAX);
+    apr_cpystrn(command->cmdline, cmd_conf->cmdline, _POSIX_PATH_MAX);
+    command->deviceid = cmd_conf->deviceid;
+    command->inode = cmd_conf->inode;
     command->virtualhost = r->server->server_hostname;
 
-    /* Update fcgid_command with wrapper info */
-    command->wrapper_cmdline[0] = '\0';
-    if ((wrapperconf = get_wrapper_info(argv0, r))) {
-        apr_cpystrn(command->wrapper_cmdline, wrapperconf->args, _POSIX_PATH_MAX);
-        command->deviceid = wrapperconf->deviceid;
-        command->inode = wrapperconf->inode;
-        command->share_grp_id = wrapperconf->share_group_id;
-        cmd_to_spawn = wrapperconf->exe;
-    }
-    else {
-        cmd_to_spawn = command->cgipath;
-    }
-
-    get_cmd_options(r, cmd_to_spawn, &command->cmdopts, &command->cmdenv);
+    get_cmd_options(r, command->cgipath, &command->cmdopts, &command->cmdenv);
 }
 
 apr_status_t procmgr_post_spawn_cmd(fcgid_command * command,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c Tue Feb  2 22:22:52 2010
@@ -128,37 +128,20 @@
 }
 
 void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r,
-                            const char *argv0, dev_t deviceid,
-                            apr_ino_t inode, apr_size_t share_grp_id)
+                            fcgid_cmd_conf *cmd_conf)
 {
-    fcgid_wrapper_conf *wrapperconf;
-    const char *cmd_to_spawn;
-
     memset(command, 0, sizeof(*command));
 
-    apr_cpystrn(command->cgipath, argv0, _POSIX_PATH_MAX);
+    apr_cpystrn(command->cgipath, cmd_conf->cgipath, _POSIX_PATH_MAX);
+    apr_cpystrn(command->cmdline, cmd_conf->cmdline, _POSIX_PATH_MAX);
     command->deviceid = deviceid;
     command->inode = inode;
-    command->share_grp_id = share_grp_id;
     command->uid = (uid_t) - 1;
     command->gid = (gid_t) - 1;
     command->userdir = 0;
     command->virtualhost = r->server->server_hostname;
 
-    /* Update fcgid_command with wrapper info */
-    command->wrapper_cmdline[0] = '\0';
-    if ((wrapperconf = get_wrapper_info(argv0, r))) {
-        apr_cpystrn(command->wrapper_cmdline, wrapperconf->args, _POSIX_PATH_MAX);
-        command->deviceid = wrapperconf->deviceid;
-        command->inode = wrapperconf->inode;
-        command->share_grp_id = wrapperconf->share_group_id;
-        cmd_to_spawn = wrapperconf->exe;
-    }
-    else {
-        cmd_to_spawn = command->cgipath;
-    }
-
-    get_cmd_options(r, cmd_to_spawn, &command->cmdopts, &command->cmdenv);
+    get_cmd_options(r, command->cgipath, &command->cmdopts, &command->cmdenv);
 }
 
 apr_status_t procmgr_post_spawn_cmd(fcgid_command * command,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h Tue Feb  2 22:22:52 2010
@@ -46,9 +46,9 @@
     char socket_path[_POSIX_PATH_MAX];  /* cgi application socket path */
     apr_ino_t inode;            /* cgi file inode */
     apr_dev_t deviceid;         /* cgi file device id */
+    char cmdline[_POSIX_PATH_MAX]; /* entire command line */
     gid_t gid;                  /* for suEXEC */
     uid_t uid;                  /* for suEXEC */
-    apr_size_t share_grp_id;    /* cgi wrapper share group id */
     const char *virtualhost;      /* the virtualhost this process belongs to */
     apr_time_t start_time;      /* the time of this process create */
     apr_time_t last_active_time;    /* the time this process last active */

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c Tue Feb  2 22:22:52 2010
@@ -17,6 +17,9 @@
 
 #include "fcgid_spawn_ctl.h"
 #include "fcgid_conf.h"
+
+#include "apr_strings.h"
+
 #define REGISTER_LIFE 1
 #define REGISTER_DEATH 2
 
@@ -25,7 +28,7 @@
     dev_t deviceid;
     uid_t uid;
     gid_t gid;
-    apr_size_t share_grp_id;
+    const char *cmdline;
     const char *virtualhost;
     int score;
     int process_counter;
@@ -50,13 +53,13 @@
     if (!g_stat_pool || !procnode)
         abort();
 
-    /* Can I find the node base on inode, device id and share group id? */
+    /* Can I find the node base on inode, device id and cmdline? */
     previous_node = g_stat_list_header;
     for (current_node = previous_node;
          current_node != NULL; current_node = current_node->next) {
         if (current_node->inode == procnode->inode
             && current_node->deviceid == procnode->deviceid
-            && current_node->share_grp_id == procnode->share_grp_id
+            && !strcmp(current_node->cmdline, procnode->cmdline)
             && current_node->virtualhost == procnode->virtualhost
             && current_node->uid == procnode->uid
             && current_node->gid == procnode->gid)
@@ -92,7 +95,7 @@
         current_node = apr_pcalloc(g_stat_pool, sizeof(*current_node));
         current_node->deviceid = procnode->deviceid;
         current_node->inode = procnode->inode;
-        current_node->share_grp_id = procnode->share_grp_id;
+        current_node->cmdline = apr_pstrdup(g_stat_pool, procnode->cmdline);
         current_node->virtualhost = procnode->virtualhost;
         current_node->uid = procnode->uid;
         current_node->gid = procnode->gid;
@@ -156,12 +159,12 @@
     if (!command || !g_stat_pool)
         return 1;
 
-    /* Can I find the node base on inode, device id and share group id? */
+    /* Can I find the node base on inode, device id and cmdline? */
     for (current_node = g_stat_list_header;
          current_node != NULL; current_node = current_node->next) {
         if (current_node->inode == command->inode
             && current_node->deviceid == command->deviceid
-            && current_node->share_grp_id == command->share_grp_id
+            && !strcmp(current_node->cmdline, command->cmdline)
             && current_node->virtualhost == command->virtualhost
             && current_node->uid == command->uid
             && current_node->gid == command->gid)
@@ -220,12 +223,12 @@
     if (!g_stat_pool || !procnode)
         return 0;
 
-    /* Can I find the node base on inode, device id and share group id? */
+    /* Can I find the node base on inode, device id and cmdline? */
     for (current_node = g_stat_list_header;
          current_node != NULL; current_node = current_node->next) {
         if (current_node->inode == procnode->inode
             && current_node->deviceid == procnode->deviceid
-            && current_node->share_grp_id == procnode->share_grp_id
+            && !strcmp(current_node->cmdline, procnode->cmdline)
             && current_node->virtualhost == procnode->virtualhost
             && current_node->uid == procnode->uid
             && current_node->gid == procnode->gid)

Modified: httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c?rev=905820&r1=905819&r2=905820&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c Tue Feb  2 22:22:52 2010
@@ -20,6 +20,7 @@
 #include "http_protocol.h"
 #include "ap_mmn.h"
 #include "apr_buckets.h"
+#include "apr_strings.h"
 #include "apr_thread_proc.h"
 #include "mod_cgi.h"
 #include "mod_status.h"
@@ -146,7 +147,7 @@
     apr_pool_t *p;
     apr_status_t rv;
     int http_retcode;
-    fcgid_wrapper_conf *wrapper_conf;
+    fcgid_cmd_conf *wrapper_conf;
 
     if (strcmp(r->handler, "fcgid-script"))
         return DECLINED;
@@ -199,17 +200,24 @@
                           r->filename);
             return HTTP_INTERNAL_SERVER_ERROR;
         }
-    }
 
-    /* Check request like "http://localhost/cgi-bin/a.exe/defghi" */
-    if (!wrapper_conf && r->finfo.inode == 0 && r->finfo.device == 0) {
-        if ((rv =
-             apr_stat(&r->finfo, command, APR_FINFO_IDENT,
-                      r->pool)) != APR_SUCCESS) {
-            ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
-                          "mod_fcgid: can't get %s file info", command);
-            return HTTP_NOT_FOUND;
+        /* Check request like "http://localhost/cgi-bin/a.exe/defghi" */
+        if (r->finfo.inode == 0 && r->finfo.device == 0) {
+            if ((rv =
+                 apr_stat(&r->finfo, command, APR_FINFO_IDENT,
+                          r->pool)) != APR_SUCCESS) {
+                ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
+                              "mod_fcgid: can't get %s file info", command);
+                return HTTP_NOT_FOUND;
+            }
         }
+
+        wrapper_conf = apr_pcalloc(r->pool, sizeof(*wrapper_conf));
+
+        wrapper_conf->cgipath = apr_pstrdup(r->pool, command);
+        wrapper_conf->cmdline = wrapper_conf->cgipath;
+        wrapper_conf->inode = r->finfo.inode;
+        wrapper_conf->deviceid = r->finfo.device;
     }
 
     ap_add_common_vars(r);
@@ -231,8 +239,7 @@
     ap_add_output_filter_handle(fcgid_filter_handle, NULL, r,
                                 r->connection);
 
-    http_retcode =
-        bridge_request(r, FCGI_RESPONDER, command, NULL, wrapper_conf);
+    http_retcode = bridge_request(r, FCGI_RESPONDER, wrapper_conf);
     return (http_retcode == HTTP_OK ? OK : http_retcode);
 }
 
@@ -246,8 +253,9 @@
         return (*e1)->gid > (*e2)->gid ? 1 : -1;
     if ((*e1)->uid != (*e2)->uid)
         return (*e1)->uid > (*e2)->uid ? 1 : -1;
-    if ((*e1)->share_grp_id != (*e2)->share_grp_id)
-        return (*e1)->share_grp_id > (*e2)->share_grp_id ? 1 : -1;
+    cmp = strcmp((*e1)->cmdline, (*e2)->cmdline);
+    if (cmp != 0)
+        return cmp;
     if ((*e1)->virtualhost != (*e2)->virtualhost)
         return (*e1)->virtualhost > (*e2)->virtualhost ? 1 : -1;
     if ((*e1)->diewhy != (*e2)->diewhy)
@@ -294,7 +302,7 @@
     apr_dev_t last_deviceid = 0;
     gid_t last_gid = 0;  
     uid_t last_uid = 0;
-    apr_size_t last_share_grp_id = 0;
+    const char *last_cmdline = "";
     apr_time_t now;
     const char *last_virtualhost = NULL;
     const char *basename, *tmpbasename;
@@ -368,7 +376,7 @@
     	current_node = ar[index];
         if (current_node->inode != last_inode || current_node->deviceid != last_deviceid
             || current_node->gid != last_gid || current_node->uid != last_uid
-            || current_node->share_grp_id != last_share_grp_id
+            || strcmp(current_node->cmdline, last_cmdline)
             || current_node->virtualhost != last_virtualhost) {
             if (index != 0)
                  ap_rputs("</table>\n\n", r);
@@ -382,7 +390,8 @@
                 basename++;
 	    else
                 basename = tmpbasename;
-            ap_rprintf(r, "<hr />\n<h3>Process name: %s</h3>\n", basename);
+            ap_rprintf(r, "<hr />\n<b>Process: %s</b>&nbsp;&nbsp;(%s)<br />\n",
+                       basename, current_node->cmdline);
 
             /* Create a new table for this process info */
             ap_rputs("\n\n<table border=\"0\"><tr>"
@@ -394,7 +403,7 @@
             last_deviceid = current_node->deviceid;
             last_gid = current_node->gid;
             last_uid = current_node->uid;
-            last_share_grp_id = current_node->share_grp_id;
+            last_cmdline = current_node->cmdline;
             last_virtualhost = current_node->virtualhost;
         }
 
@@ -431,8 +440,7 @@
     int res = 0;
     const char *password = NULL;
     apr_table_t *saved_subprocess_env = NULL;
-    fcgid_wrapper_conf *wrapper_conf;
-    fcgid_auth_conf *authenticator_info;
+    fcgid_cmd_conf *authenticator_info;
     int authoritative;
 
     authenticator_info = get_authenticator_info(r, &authoritative);
@@ -441,9 +449,6 @@
     if (authenticator_info == NULL)
         return DECLINED;
 
-    /* Check wrapper */
-    wrapper_conf = get_wrapper_info(authenticator_info->path, r);
-
     /* Get the user password */
     if ((res = ap_get_basic_auth_pw(r, &password)) != OK)
         return res;
@@ -476,9 +481,7 @@
     apr_table_set(r->subprocess_env, "HTTP_CONNECTION", "close");
 
     /* Handle the request */
-    res =
-        bridge_request(r, FCGI_AUTHORIZER, NULL, authenticator_info,
-                       wrapper_conf);
+    res = bridge_request(r, FCGI_AUTHORIZER, authenticator_info);
 
     /* Restore r->subprocess_env */
     r->subprocess_env = saved_subprocess_env;
@@ -525,8 +528,7 @@
 {
     int res = 0;
     apr_table_t *saved_subprocess_env = NULL;
-    fcgid_wrapper_conf *wrapper_conf;
-    fcgid_auth_conf *authorizer_info;
+    fcgid_cmd_conf *authorizer_info;
     int authoritative;
 
     authorizer_info = get_authorizer_info(r, &authoritative);
@@ -535,9 +537,6 @@
     if (authorizer_info == NULL)
         return DECLINED;
 
-    /* Check wrapper */
-    wrapper_conf = get_wrapper_info(authorizer_info->path, r);
-
     /* Save old process environment */
     saved_subprocess_env = apr_table_copy(r->pool, r->subprocess_env);
 
@@ -565,9 +564,7 @@
     apr_table_set(r->subprocess_env, "HTTP_CONNECTION", "close");
 
     /* Handle the request */
-    res =
-        bridge_request(r, FCGI_AUTHORIZER, NULL, authorizer_info,
-                       wrapper_conf);
+    res = bridge_request(r, FCGI_AUTHORIZER, authorizer_info);
 
     /* Restore r->subprocess_env */
     r->subprocess_env = saved_subprocess_env;
@@ -614,8 +611,7 @@
 {
     int res = 0;
     apr_table_t *saved_subprocess_env = NULL;
-    fcgid_wrapper_conf *wrapper_conf;
-    fcgid_auth_conf *access_info;
+    fcgid_cmd_conf *access_info;
     int authoritative;
 
     access_info = get_access_info(r, &authoritative);
@@ -624,9 +620,6 @@
     if (access_info == NULL)
         return DECLINED;
 
-    /* Check wrapper */
-    wrapper_conf = get_wrapper_info(access_info->path, r);
-
     /* Save old process environment */
     saved_subprocess_env = apr_table_copy(r->pool, r->subprocess_env);
 
@@ -655,9 +648,7 @@
     apr_table_set(r->subprocess_env, "HTTP_CONNECTION", "close");
 
     /* Handle the request */
-    res =
-        bridge_request(r, FCGI_AUTHORIZER, NULL, access_info,
-                       wrapper_conf);
+    res = bridge_request(r, FCGI_AUTHORIZER, access_info);
 
     /* Restore r->subprocess_env */
     r->subprocess_env = saved_subprocess_env;