All of lore.kernel.org
 help / color / mirror / Atom feed
From: J William Piggott <elseifthen@gmx.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: [PATCH 2/2] hwclock: non-root access in test mode
Date: Tue, 17 Mar 2015 12:28:26 -0400	[thread overview]
Message-ID: <5508562A.4030108@gmx.com> (raw)
In-Reply-To: <55085554.5040409@gmx.com>

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 | 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;

  reply	other threads:[~2015-03-17 16:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 16:24 [PATCH 1/2] hwclock: increase debug output precision J William Piggott
2015-03-17 16:28 ` J William Piggott [this message]
2015-03-25  8:35 ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5508562A.4030108@gmx.com \
    --to=elseifthen@gmx.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.