Created
October 17, 2009 15:39
-
-
Save bdrewery/212373 to your computer and use it in GitHub Desktop.
apache22 patch for SuexecUserdir - see http://alain.knaff.lu/howto/PhpSuexec/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- modules/generators/mod_suexec.c 2006-07-12 05:38:44.000000000 +0200 | |
+++ modules/generators/mod_suexec.c 2008-09-27 08:27:31.000000000 +0200 | |
@@ -57,7 +57,8 @@ | |
} | |
static const char *set_suexec_ugid(cmd_parms *cmd, void *mconfig, | |
- const char *uid, const char *gid) | |
+ const char *uid, const char *gid, | |
+ int userdir) | |
{ | |
suexec_config_t *cfg = (suexec_config_t *) mconfig; | |
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); | |
@@ -68,7 +69,7 @@ | |
if (unixd_config.suexec_enabled) { | |
cfg->ugid.uid = ap_uname2id(uid); | |
cfg->ugid.gid = ap_gname2id(gid); | |
- cfg->ugid.userdir = 0; | |
+ cfg->ugid.userdir = userdir; | |
cfg->active = 1; | |
} | |
else { | |
@@ -78,6 +79,18 @@ | |
return NULL; | |
} | |
+static const char *set_suexec_ugid_nouserdir(cmd_parms *cmd, void *mconfig, | |
+ const char *uid, const char *gid) | |
+{ | |
+ return set_suexec_ugid(cmd, mconfig, uid, gid, 0); | |
+} | |
+ | |
+static const char *set_suexec_ugid_userdir(cmd_parms *cmd, void *mconfig, | |
+ const char *uid, const char *gid) | |
+{ | |
+ return set_suexec_ugid(cmd, mconfig, uid, gid, 1); | |
+} | |
+ | |
static ap_unix_identity_t *get_suexec_id_doer(const request_rec *r) | |
{ | |
suexec_config_t *cfg = | |
@@ -115,7 +128,9 @@ | |
{ | |
/* XXX - Another important reason not to allow this in .htaccess is that | |
* the ap_[ug]name2id() is not thread-safe */ | |
- AP_INIT_TAKE2("SuexecUserGroup", set_suexec_ugid, NULL, RSRC_CONF, | |
+ AP_INIT_TAKE2("SuexecUserGroup", set_suexec_ugid_nouserdir, NULL, RSRC_CONF, | |
+ "User and group for spawned processes"), | |
+ AP_INIT_TAKE2("SuexecUserdir", set_suexec_ugid_userdir, NULL, RSRC_CONF, | |
"User and group for spawned processes"), | |
{ NULL } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment