diff options
author | Ludwig Nussel | 2007-09-20 14:57:20 +0200 |
---|---|---|
committer | Karel Zak | 2007-09-23 21:34:18 +0200 |
commit | ebbeb2c7ac1b00b6083905957837a271e80b187e (patch) | |
tree | ee04eb1ab76e5114bb484b759453af0c99d5859f /mount/mount.c | |
parent | po: update sv.po (from translationproject.org) (diff) | |
download | kernel-qcow2-util-linux-ebbeb2c7ac1b00b6083905957837a271e80b187e.tar.gz kernel-qcow2-util-linux-ebbeb2c7ac1b00b6083905957837a271e80b187e.tar.xz kernel-qcow2-util-linux-ebbeb2c7ac1b00b6083905957837a271e80b187e.zip |
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/mount.c')
-rw-r--r-- | mount/mount.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mount/mount.c b/mount/mount.c index 40699f33d..5bc2b30c3 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -634,8 +634,12 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in char *oo, *mountargs[10]; int i = 0; - setuid(getuid()); - setgid(getgid()); + if(setgid(getgid()) < 0) + die(EX_FAIL, _("mount: cannot set group id: %s"), strerror(errno)); + + if(setuid(getuid()) < 0) + die(EX_FAIL, _("mount: cannot set user id: %s"), strerror(errno)); + oo = fix_opts_string (flags, extra_opts, NULL); mountargs[i++] = mountprog; /* 1 */ mountargs[i++] = (char *) spec; /* 2 */ |