apparently, we’re supposed to setuid() before seteuid()
cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772597 also, groups before users, methinks…
This commit is contained in:
parent
e60f3e494b
commit
7b4951c58f
14
misc.c
14
misc.c
@ -30,7 +30,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.221 2014/11/25 21:13:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.222 2015/01/02 08:18:44 tg Exp $");
|
||||||
|
|
||||||
#define KSH_CHVT_FLAG
|
#define KSH_CHVT_FLAG
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_SMALL
|
||||||
@ -281,15 +281,15 @@ change_flag(enum sh_flag f, int what, bool newset)
|
|||||||
#endif
|
#endif
|
||||||
DO_SETUID(setresuid, (ksheuid, ksheuid, ksheuid));
|
DO_SETUID(setresuid, (ksheuid, ksheuid, ksheuid));
|
||||||
#else /* !HAVE_SETRESUGID */
|
#else /* !HAVE_SETRESUGID */
|
||||||
/* seteuid, setegid, setgid don't EAGAIN on Linux */
|
/* setgid, setegid, seteuid don't EAGAIN on Linux */
|
||||||
#ifndef MKSH__NO_SETEUGID
|
setgid(kshegid);
|
||||||
seteuid(ksheuid);
|
|
||||||
#endif
|
|
||||||
DO_SETUID(setuid, (ksheuid));
|
|
||||||
#ifndef MKSH__NO_SETEUGID
|
#ifndef MKSH__NO_SETEUGID
|
||||||
setegid(kshegid);
|
setegid(kshegid);
|
||||||
#endif
|
#endif
|
||||||
setgid(kshegid);
|
DO_SETUID(setuid, (ksheuid));
|
||||||
|
#ifndef MKSH__NO_SETEUGID
|
||||||
|
seteuid(ksheuid);
|
||||||
|
#endif
|
||||||
#endif /* !HAVE_SETRESUGID */
|
#endif /* !HAVE_SETRESUGID */
|
||||||
} else if ((f == FPOSIX || f == FSH) && newval) {
|
} else if ((f == FPOSIX || f == FSH) && newval) {
|
||||||
/* Turning on -o posix or -o sh? */
|
/* Turning on -o posix or -o sh? */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user