Link Here
|
|
|
1 |
--- modules/generators/mod_suexec.c.orig 2006-07-11 22:38:44.000000000 -0500 |
2 |
+++ modules/generators/mod_suexec.c 2010-02-05 23:22:23.000000000 -0600 |
3 |
@@ -57,10 +57,11 @@ |
4 |
} |
5 |
|
6 |
static const char *set_suexec_ugid(cmd_parms *cmd, void *mconfig, |
7 |
- const char *uid, const char *gid) |
8 |
+ const char *uid, const char *gid, |
9 |
+ int userdir) |
10 |
{ |
11 |
suexec_config_t *cfg = (suexec_config_t *) mconfig; |
12 |
- const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); |
13 |
+ const char *err = ap_check_cmd_context(cmd, NOT_IN_LOCATION|NOT_IN_FILES|NOT_IN_LIMIT); |
14 |
|
15 |
if (err != NULL) { |
16 |
return err; |
17 |
@@ -68,7 +69,7 @@ |
18 |
if (unixd_config.suexec_enabled) { |
19 |
cfg->ugid.uid = ap_uname2id(uid); |
20 |
cfg->ugid.gid = ap_gname2id(gid); |
21 |
- cfg->ugid.userdir = 0; |
22 |
+ cfg->ugid.userdir = userdir; |
23 |
cfg->active = 1; |
24 |
} |
25 |
else { |
26 |
@@ -78,6 +79,18 @@ |
27 |
return NULL; |
28 |
} |
29 |
|
30 |
+static const char *set_suexec_ugid_nouserdir(cmd_parms *cmd, void *mconfig, |
31 |
+ const char *uid, const char *gid) |
32 |
+{ |
33 |
+ return set_suexec_ugid(cmd, mconfig, uid, gid, 0); |
34 |
+} |
35 |
+ |
36 |
+static const char *set_suexec_ugid_userdir(cmd_parms *cmd, void *mconfig, |
37 |
+ const char *uid, const char *gid) |
38 |
+{ |
39 |
+ return set_suexec_ugid(cmd, mconfig, uid, gid, 1); |
40 |
+} |
41 |
+ |
42 |
static ap_unix_identity_t *get_suexec_id_doer(const request_rec *r) |
43 |
{ |
44 |
suexec_config_t *cfg = |
45 |
@@ -115,7 +128,9 @@ |
46 |
{ |
47 |
/* XXX - Another important reason not to allow this in .htaccess is that |
48 |
* the ap_[ug]name2id() is not thread-safe */ |
49 |
- AP_INIT_TAKE2("SuexecUserGroup", set_suexec_ugid, NULL, RSRC_CONF, |
50 |
+ AP_INIT_TAKE2("SuexecUserGroup", set_suexec_ugid_nouserdir, NULL, RSRC_CONF|ACCESS_CONF, |
51 |
+ "User and group for spawned processes"), |
52 |
+ AP_INIT_TAKE2("SuexecUserdir", set_suexec_ugid_userdir, NULL, RSRC_CONF|ACCESS_CONF, |
53 |
"User and group for spawned processes"), |
54 |
{ NULL } |
55 |
}; |