]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: non-root access in test mode
authorJ William Piggott <elseifthen@gmx.com>
Sun, 15 Mar 2015 20:44:05 +0000 (16:44 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Tue, 17 Mar 2015 14:17:26 +0000 (10:17 -0400)
Allow a non-root user to call all hwclock
functions when the --test option is used.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock.c

index e8732b8bc4a3ee2d4f931ec850399ed3b4fb0215..e1e5816b2a5aabf8d7559ce5ca7f5331a56e71b2 100644 (file)
@@ -1914,15 +1914,15 @@ int main(int argc, char **argv)
                permitted = TRUE;
        else {
                /* program is designed to run setuid (in some situations) */
-               if (set || systohc || adjust) {
+               if ((set || systohc || adjust) && !testing) {
                        warnx(_("Sorry, only the superuser can change "
                                "the Hardware Clock."));
                        permitted = FALSE;
-               } else if (systz || hctosys) {
+               } else if ((systz || hctosys) && !testing) {
                        warnx(_("Sorry, only the superuser can change "
                                "the System Clock."));
                        permitted = FALSE;
-               } else if (setepoch) {
+               } else if (setepoch && !testing) {
                        warnx(_("Sorry, only the superuser can change the "
                                "Hardware Clock epoch in the kernel."));
                        permitted = FALSE;