util-linux/util-linux-2.13-mount-setui...

37 lines
1.4 KiB
Diff

diff -up util-linux-2.13-pre7/mount/umount.c.kzak util-linux-2.13-pre7/mount/umount.c
--- util-linux-2.13-pre7/mount/umount.c.kzak 2007-10-08 15:22:38.000000000 +0200
+++ util-linux-2.13-pre7/mount/umount.c 2007-10-08 15:24:01.000000000 +0200
@@ -102,8 +102,12 @@ check_special_umountprog(const char *spe
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)
diff -up util-linux-2.13-pre7/mount/mount.c.kzak util-linux-2.13-pre7/mount/mount.c
--- util-linux-2.13-pre7/mount/mount.c.kzak 2007-10-08 15:22:38.000000000 +0200
+++ util-linux-2.13-pre7/mount/mount.c 2007-10-08 15:24:01.000000000 +0200
@@ -600,8 +600,12 @@ check_special_mountprog(const char *spec
char *oo, *mountargs[11];
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;
mountargs[i++] = spec;