diff options
author | Ludwig Nussel <ludwig.nussel@suse.de> | 2007-09-20 14:57:20 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2007-09-23 21:34:18 +0200 |
commit | ebbeb2c7ac1b00b6083905957837a271e80b187e (patch) | |
tree | ee04eb1ab76e5114bb484b759453af0c99d5859f /mount/umount.c | |
parent | e72194e6204dc161ad2c08d3fd24c7f2c148b2df (diff) | |
download | util-linux-old-ebbeb2c7ac1b00b6083905957837a271e80b187e.tar.gz |
mount: doesn't drop privileges properly when calling helpers
{,u}mount calls setuid() and setgid() in the wrong order and doesn't checking
the return value of set{u,g}id(() when running helpers like mount.nfs.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/umount.c')
-rw-r--r-- | mount/umount.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mount/umount.c b/mount/umount.c index b3100c9a..32216198 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -102,8 +102,12 @@ check_special_umountprog(const char *spec, const char *node, char *umountargs[8]; int i = 0; - setuid(getuid()); - setgid(getgid()); + if(setgid(getgid()) < 0) + die(EX_FAIL, _("umount: cannot set group id: %s"), strerror(errno)); + + if(setuid(getuid()) < 0) + die(EX_FAIL, _("umount: cannot set user id: %s"), strerror(errno)); + umountargs[i++] = umountprog; umountargs[i++] = xstrdup(node); if (nomtab) |