From: LaMont Jones Date: Fri, 13 Feb 2009 18:52:12 +0000 (-0700) Subject: Merge commit 'origin/master' X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e007010d0fad58e2615aa7bc04bcaa916b365913;p=util-linux Merge commit 'origin/master' --- e007010d0fad58e2615aa7bc04bcaa916b365913 diff --cc mount/mount.c index 9bdc3409,23f27d67..463672a9 --- a/mount/mount.c +++ b/mount/mount.c @@@ -2037,16 -2027,22 +2047,25 @@@ main(int argc, char *argv[]) return print_all (types); } - if (getuid () != geteuid ()) { - suid = 1; - if (types || options || readwrite || nomtab || mount_all || - fake || mounttype || (argc + specseen) != 1) - die (EX_USAGE, _("mount: only root can do that")); + { + const uid_t ruid = getuid(); + const uid_t euid = geteuid(); + + /* if we're really root and aren't running setuid */ + if (((uid_t)0 == ruid) && (ruid == euid)) { + restricted = 0; + } + } + + if (restricted && + (types || options || readwrite || nomtab || mount_all || + fake || mounttype || (argc + specseen) != 1)) { + die (EX_USAGE, _("mount: only root can do that")); } + if (keysize && sscanf(keysize,"%d",&keysz) != 1) + die (EX_USAGE, _("mount: argument to --keybits or -k must be a number")); + atexit(unlock_mtab); switch (argc+specseen) {