AP_DECLARE(apr_status_t) ap_os_create_privileged_process( const request_rec *r, apr_proc_t *newproc, const char *progname, const char * const *args, const char * const *env, apr_procattr_t *attr, apr_pool_t *p) { ap_unix_identity_t *ugid = ap_run_get_suexec_identity(r); if (ugid == NULL) { return apr_proc_create(newproc, progname, args, env, attr, p); } return ap_unix_create_privileged_process(newproc, progname, args, env, attr, ugid, p); }
void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r, fcgid_cmd_conf *cmd_conf) { ap_unix_identity_t *ugid; fcgid_server_conf *sconf = ap_get_module_config(r->server->module_config, &fcgid_module); /* suEXEC check */ if ((ugid = ap_run_get_suexec_identity(r))) { command->uid = ugid->uid; command->gid = ugid->gid; command->userdir = ugid->userdir; } else { command->uid = (uid_t) - 1; command->gid = (gid_t) - 1; command->userdir = 0; } /* no truncation should ever occur */ AP_DEBUG_ASSERT(sizeof command->cgipath > strlen(cmd_conf->cgipath)); apr_cpystrn(command->cgipath, cmd_conf->cgipath, sizeof command->cgipath); AP_DEBUG_ASSERT(sizeof command->cmdline > strlen(cmd_conf->cmdline)); apr_cpystrn(command->cmdline, cmd_conf->cmdline, sizeof command->cmdline); command->deviceid = cmd_conf->deviceid; command->inode = cmd_conf->inode; command->vhost_id = sconf->vhost_id; if (r->server->server_hostname) { apr_cpystrn(command->server_hostname, r->server->server_hostname, sizeof command->server_hostname); } else { command->server_hostname[0] = '\0'; } get_cmd_options(r, command->cgipath, &command->cmdopts, &command->cmdenv); }