You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2002/04/25 09:18:40 UTC
cvs commit: httpd-2.0/os/unix unixd.c unixd.h
jerenkrantz 02/04/25 00:18:40
Modified: . CHANGES
modules/generators mod_suexec.c
modules/mappers mod_userdir.c
os/unix unixd.c unixd.h
Log:
Fix suexec invocations from userdir - the ~ was not being prepended to the
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 <co...@redbrick.dcu.ie>
Reviewed by: Justin Erenkrantz
Revision Changes Path
1.733 +3 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.732
retrieving revision 1.733
diff -u -r1.732 -r1.733
--- CHANGES 25 Apr 2002 06:16:06 -0000 1.732
+++ CHANGES 25 Apr 2002 07:18:39 -0000 1.733
@@ -1,5 +1,8 @@
Changes with Apache 2.0.36
+ *) Fix suexec behavior with user directories. PR 7810.
+ [Colm <co...@redbrick.dcu.ie>]
+
*) Reject a blank UserDir directive since it is ambiguous. PR 8472.
[Justin Erenkrantz]
1.13 +1 -0 httpd-2.0/modules/generators/mod_suexec.c
Index: mod_suexec.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_suexec.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- mod_suexec.c 13 Mar 2002 20:47:48 -0000 1.12
+++ mod_suexec.c 25 Apr 2002 07:18:39 -0000 1.13
@@ -110,6 +110,7 @@
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 {
1.45 +1 -0 httpd-2.0/modules/mappers/mod_userdir.c
Index: mod_userdir.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_userdir.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- mod_userdir.c 25 Apr 2002 06:16:06 -0000 1.44
+++ mod_userdir.c 25 Apr 2002 07:18:39 -0000 1.45
@@ -379,6 +379,7 @@
return NULL;
}
+ ugid->userdir = 1;
#endif
return ugid;
}
1.49 +6 -1 httpd-2.0/os/unix/unixd.c
Index: unixd.c
===================================================================
RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- unixd.c 13 Mar 2002 20:47:59 -0000 1.48
+++ unixd.c 25 Apr 2002 07:18:40 -0000 1.49
@@ -331,7 +331,12 @@
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) {
1.35 +1 -0 httpd-2.0/os/unix/unixd.h
Index: unixd.h
===================================================================
RCS file: /home/cvs/httpd-2.0/os/unix/unixd.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- unixd.h 13 Mar 2002 20:47:59 -0000 1.34
+++ unixd.h 25 Apr 2002 07:18:40 -0000 1.35
@@ -84,6 +84,7 @@
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))