[systemd-commits] 3 commits - TODO src/timedate
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Mar 22 13:39:28 PDT 2013
TODO | 4 ++++
src/timedate/timedatectl.c | 5 ++++-
src/timedate/timedated.c | 19 ++++++++++++++-----
3 files changed, 22 insertions(+), 6 deletions(-)
New commits:
commit 86e7b6e3f61e2a0d2395d7f2cc28e8f9199710e7
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Mar 22 21:35:53 2013 +0100
timedated: extra overflow safety check when doing relative time changes
Ensure clients don't overflow usec_t when doing relative time changes.
This is mostly just paranoia and protection against accidents, after all
clients are already authenticated, and they can se the time to any
value they wish anyway, but better be safe than sorry.
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1152187/comments/14
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 85506f4..16fffd0 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -816,15 +816,24 @@ static DBusHandlerResult timedate_message_handler(
struct timespec ts;
struct tm* tm;
+ if (relative) {
+ usec_t n, x;
+
+ n = now(CLOCK_REALTIME);
+ x = n + utc;
+
+ if ((utc > 0 && x < n) ||
+ (utc < 0 && x > n))
+ return bus_send_error_reply(connection, message, NULL, -EOVERFLOW);
+
+ timespec_store(&ts, x);
+ } else
+ timespec_store(&ts, (usec_t) utc);
+
r = verify_polkit(connection, message, "org.freedesktop.timedate1.set-time", interactive, NULL, &error);
if (r < 0)
return bus_send_error_reply(connection, message, &error, r);
- if (relative)
- timespec_store(&ts, now(CLOCK_REALTIME) + utc);
- else
- timespec_store(&ts, utc);
-
/* Set system clock */
if (clock_settime(CLOCK_REALTIME, &ts) < 0) {
log_error("Failed to set local time: %m");
commit bfa00bc6c05d0f896e9632eccd47d442fea556b9
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Mar 22 21:17:53 2013 +0100
update TODO
diff --git a/TODO b/TODO
index c0779d4..7f973d4 100644
--- a/TODO
+++ b/TODO
@@ -44,6 +44,10 @@ Fedora 19:
Features:
+* hostnamectl: when a passed pretty hostname also qualifies as low-level name, then only set low-level name, and unset the pretty hostname
+
+* we should log capabilities too
+
* Support SO_REUSEPORT with socket activation:
- Let systemd maintain a pool of servers.
- Use for seamless upgrades, by running the new server before stopping the
commit 1a5613266a93ddb197bbae137cd61fae25600718
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Mar 22 21:17:45 2013 +0100
timedatectl: show CanNTP field
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index ef2ea08..bcd935a 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -68,6 +68,7 @@ typedef struct StatusInfo {
const char *timezone;
bool local_rtc;
bool ntp;
+ bool can_ntp;
} StatusInfo;
static bool ntp_synced(void) {
@@ -153,7 +154,7 @@ static void print_status_info(StatusInfo *i) {
" RTC in local TZ: %s\n",
strna(i->timezone),
a,
- yes_no(i->ntp),
+ i->can_ntp ? yes_no(i->ntp) : "n/a",
yes_no(ntp_synced()),
yes_no(i->local_rtc));
@@ -228,6 +229,8 @@ static int status_property(const char *name, DBusMessageIter *iter, StatusInfo *
i->local_rtc = b;
else if (streq(name, "NTP"))
i->ntp = b;
+ else if (streq(name, "CanNTP"))
+ i->can_ntp = b;
}
}
More information about the systemd-commits
mailing list