mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-10 00:31:07 +02:00
Take more care with errors from setuid().
This is to ensure the user is aware of errors unsetting the PRIVELEGED option.
This commit is contained in:
parent
fd302c9837
commit
52d37d7ff4
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2014-10-31 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
|
* via private email: Jérémie Roquet: Src/options.c: more care
|
||||||
|
with errors using setuid().
|
||||||
|
|
||||||
2014-10-30 Oliver Kiddle <opk@zsh.org>
|
2014-10-30 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
* 33570, 33576: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, Src/Zle/zle.h,
|
* 33570, 33576: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, Src/Zle/zle.h,
|
||||||
|
|
|
@ -766,7 +766,17 @@ dosetopt(int optno, int value, int force, char *new_opts)
|
||||||
#ifdef HAVE_SETUID
|
#ifdef HAVE_SETUID
|
||||||
setuid(getuid());
|
setuid(getuid());
|
||||||
setgid(getgid());
|
setgid(getgid());
|
||||||
#endif /* HAVE_SETUID */
|
if (setuid(getuid())) {
|
||||||
|
zwarn("failed to change user ID: %e", errno);
|
||||||
|
return -1;
|
||||||
|
} else if (setgid(getgid())) {
|
||||||
|
zwarn("failed to change group ID: %e", errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
zwarn("setuid not available");
|
||||||
|
return -1;
|
||||||
|
#endif /* not HAVE_SETUID */
|
||||||
#ifdef JOB_CONTROL
|
#ifdef JOB_CONTROL
|
||||||
} else if (!force && optno == MONITOR && value) {
|
} else if (!force && optno == MONITOR && value) {
|
||||||
if (new_opts[optno] == value)
|
if (new_opts[optno] == value)
|
||||||
|
|
Loading…
Reference in a new issue