uid per our convention. Therefore, bad things would happen (like we
wouldn't cd to the right directory).
Add a flag to the ap_unix_identity_t structure to indicate if we are in
a userdir - if so, prefix the ~.
(Modified by Justin, but Colm's patch pointed me in the right direction.)
PR: 7810
Submitted by: Colm <colmmacc@redbrick.dcu.ie>
Reviewed by: Justin Erenkrantz
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94791
13f79535-47bb-0310-9956-
ffa450edef68
Changes with Apache 2.0.36
+ *) Fix suexec behavior with user directories. PR 7810.
+ [Colm <colmmacc@redbrick.dcu.ie>]
+
*) Reject a blank UserDir directive since it is ambiguous. PR 8472.
[Justin Erenkrantz]
if (unixd_config.suexec_enabled) {
cfg->ugid.uid = ap_uname2id(uid);
cfg->ugid.gid = ap_gname2id(gid);
+ cfg->ugid.userdir = 0;
cfg->active = 1;
}
else {
return NULL;
}
+ ugid->userdir = 1;
#endif
return ugid;
}
return apr_proc_create(newproc, progname, args, env, attr, p);
}
- execuser = apr_psprintf(p, "%ld", (long) ugid->uid);
+ if (ugid->userdir) {
+ execuser = apr_psprintf(p, "~%ld", (long) ugid->uid);
+ }
+ else {
+ execuser = apr_psprintf(p, "%ld", (long) ugid->uid);
+ }
execgroup = apr_psprintf(p, "%ld", (long) ugid->gid);
if (!execuser || !execgroup) {
typedef struct {
uid_t uid;
gid_t gid;
+ int userdir;
} ap_unix_identity_t;
AP_DECLARE_HOOK(ap_unix_identity_t *, get_suexec_identity,(const request_rec *r))