improve existing patches that made use of seteuid()/setegid() so they can
be submitted back to the author.
This commit is contained in:
parent
1aabea36aa
commit
5f0c4b6fc4
12
x11/eterm/patches/patch-config.h.in
Normal file
12
x11/eterm/patches/patch-config.h.in
Normal file
@ -0,0 +1,12 @@
|
||||
--- config.h.in.orig Sat Aug 12 04:48:22 2000
|
||||
+++ config.h.in Sat Aug 12 04:48:42 2000
|
||||
@@ -154,6 +154,9 @@
|
||||
/* Define if you have the seteuid function. */
|
||||
#undef HAVE_SETEUID
|
||||
|
||||
+/* Define if you have the setegid function. */
|
||||
+#undef HAVE_SETEGID
|
||||
+
|
||||
/* Define if you have the setresgid function. */
|
||||
#undef HAVE_SETRESGID
|
||||
|
11
x11/eterm/patches/patch-configure
Normal file
11
x11/eterm/patches/patch-configure
Normal file
@ -0,0 +1,11 @@
|
||||
--- configure.orig Sat Aug 12 04:49:16 2000
|
||||
+++ configure Sat Aug 12 04:49:29 2000
|
||||
@@ -3822,7 +3822,7 @@
|
||||
EOF
|
||||
|
||||
|
||||
-for ac_func in atexit _exit unsetenv setutent seteuid memmove putenv strsep setresuid setresgid memmem usleep snprintf
|
||||
+for ac_func in atexit _exit unsetenv setutent seteuid setegid memmove putenv strsep setresuid setresgid memmem usleep snprintf
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:3829: checking for $ac_func" >&5
|
@ -1,49 +1,55 @@
|
||||
--- src/command.c.orig Tue Nov 2 08:34:35 1999
|
||||
+++ src/command.c Thu Aug 10 20:56:03 2000
|
||||
@@ -677,7 +677,7 @@
|
||||
--- src/command.c.orig Tue Nov 2 11:34:35 1999
|
||||
+++ src/command.c Sat Aug 12 04:58:09 2000
|
||||
@@ -676,6 +676,8 @@
|
||||
|
||||
#ifdef HAVE_SETRESGID
|
||||
setresgid(my_rgid, my_rgid, my_egid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
- setregid(my_rgid, my_rgid);
|
||||
+#elif defined(HAVE_SAVED_UIDS) && defined(HAVE_SETEGID)
|
||||
+ setegid(my_rgid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
setregid(my_rgid, my_rgid);
|
||||
#else
|
||||
setregid(my_egid, -1);
|
||||
setregid(-1, my_rgid);
|
||||
@@ -686,7 +686,7 @@
|
||||
@@ -685,6 +687,8 @@
|
||||
|
||||
#ifdef HAVE_SETRESUID
|
||||
setresuid(my_ruid, my_ruid, my_euid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
- setreuid(my_ruid, my_ruid);
|
||||
+#elif defined(HAVE_SAVED_UIDS) && defined(HAVE_SETEUID)
|
||||
+ seteuid(my_ruid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
setreuid(my_ruid, my_ruid);
|
||||
#else
|
||||
setreuid(my_euid, -1);
|
||||
setreuid(-1, my_ruid);
|
||||
@@ -706,7 +706,7 @@
|
||||
@@ -705,6 +709,8 @@
|
||||
|
||||
#ifdef HAVE_SETRESUID
|
||||
setresuid(my_ruid, my_euid, my_euid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
- setreuid(my_ruid, my_euid);
|
||||
+#elif defined(HAVE_SAVED_UIDS) && defined(HAVE_SETEUID)
|
||||
+ seteuid(my_euid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
setreuid(my_ruid, my_euid);
|
||||
#else
|
||||
setreuid(-1, my_euid);
|
||||
setreuid(my_ruid, -1);
|
||||
@@ -715,7 +715,7 @@
|
||||
@@ -714,6 +720,8 @@
|
||||
|
||||
#ifdef HAVE_SETRESGID
|
||||
setresgid(my_rgid, my_egid, my_egid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
- setregid(my_rgid, my_egid);
|
||||
+#elif defined(HAVE_SAVED_UIDS) && defined(HAVE_SETEGID)
|
||||
+ setegid(my_egid);
|
||||
#elif defined(HAVE_SAVED_UIDS)
|
||||
setregid(my_rgid, my_egid);
|
||||
#else
|
||||
setregid(-1, my_egid);
|
||||
setregid(my_rgid, -1);
|
||||
@@ -2298,8 +2298,8 @@
|
||||
@@ -2298,8 +2306,16 @@
|
||||
because the exec*() calls reset the saved uid/gid to the
|
||||
effective uid/gid -- mej */
|
||||
# ifndef __CYGWIN32__
|
||||
- setregid(my_rgid, my_rgid);
|
||||
- setreuid(my_ruid, my_ruid);
|
||||
+#ifdef HAVE_SETEGID
|
||||
+ setegid(my_rgid);
|
||||
+#else
|
||||
setregid(my_rgid, my_rgid);
|
||||
+#endif
|
||||
+#ifdef HAVE_SETEUID
|
||||
+ seteuid(my_ruid);
|
||||
+#else
|
||||
setreuid(my_ruid, my_ruid);
|
||||
+#endif
|
||||
# endif /* __CYGWIN32__ */
|
||||
#endif /* _HPUX_SOURCE */
|
||||
|
||||
|
@ -1,24 +1,36 @@
|
||||
--- src/system.c.orig Wed Oct 27 09:44:06 1999
|
||||
+++ src/system.c Thu Aug 10 20:56:04 2000
|
||||
@@ -67,8 +67,8 @@
|
||||
--- src/system.c.orig Wed Oct 27 12:44:06 1999
|
||||
+++ src/system.c Sat Aug 12 05:02:38 2000
|
||||
@@ -67,8 +67,16 @@
|
||||
D_OPTIONS(("system_wait(%s) called.\n", command));
|
||||
|
||||
if (!(pid = fork())) {
|
||||
- setreuid(my_ruid, my_ruid);
|
||||
- setregid(my_rgid, my_rgid);
|
||||
+ seteuid(my_ruid);
|
||||
+ setegid(my_rgid);
|
||||
+#ifdef HAVE_SETEUID
|
||||
+ seteuid(my_ruid);
|
||||
+#else
|
||||
setreuid(my_ruid, my_ruid);
|
||||
+#endif
|
||||
+#ifdef HAVE_SETEGID
|
||||
+ setegid(my_rgid);
|
||||
+#else
|
||||
setregid(my_rgid, my_rgid);
|
||||
+#endif
|
||||
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||
print_error("system_wait(): execl(%s) failed -- %s", command, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -87,8 +87,8 @@
|
||||
@@ -87,8 +95,16 @@
|
||||
D_OPTIONS(("system_no_wait(%s) called.\n", command));
|
||||
|
||||
if (!(pid = fork())) {
|
||||
- setreuid(my_ruid, my_ruid);
|
||||
- setregid(my_rgid, my_rgid);
|
||||
+ seteuid(my_ruid);
|
||||
+ setegid(my_rgid);
|
||||
+#ifdef HAVE_SETEUID
|
||||
+ seteuid(my_ruid);
|
||||
+#else
|
||||
setreuid(my_ruid, my_ruid);
|
||||
+#endif
|
||||
+#ifdef HAVE_SETEGID
|
||||
+ setegid(my_rgid);
|
||||
+#else
|
||||
setregid(my_rgid, my_rgid);
|
||||
+#endif
|
||||
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||
print_error("system_no_wait(): execl(%s) failed -- %s", command, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
|
Loading…
Reference in New Issue
Block a user