[PATCH 2/2] hwclock: non-root access in test mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow a non-root user to call all hwclock
functions when the --test option is used.

Signed-off-by: J William Piggott <elseifthen@xxxxxxx>
---
 sys-utils/hwclock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index e8732b8..e1e5816 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux