summaryrefslogtreecommitdiffstats
path: root/src/timedate (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shared/bus-util: move bus_message_hash_ops to bus-message-utilMike Yuan2025-01-131-0/+1
|
* fileio: port write_string_file() to LabelOps, and thus add ↵Lennart Poettering2024-10-221-2/+1
| | | | | | | | | | | | | WRITE_STRING_FILE_LABEL flag Given that we have the LabelOps abstraction these days, we can teach write_string_file() to use it, which means we can get rid of fileio-label.[ch] as a separate concept. (The only reason that fileio-label.[ch] exists independently of fileio.[ch] was that the former linekd to libselinux potentially, and thus had to be in src/shared/ while the other always was in src/basic/. But the LabelOps vtable provides us with a nice work-around)
* bus-util: Log more information when connecting to a bus socket failsDaan De Meyer2024-10-091-1/+1
| | | | | Let's log about which bus we're trying to connect to and what transport we're using to do it.
* basic/memory-util: introduce mempcpy_typesafeMike Yuan2024-09-201-1/+1
|
* time-util: rework localtime_or_gmtime() into localtime_or_gmtime_usec()Lennart Poettering2024-09-052-35/+80
| | | | | | | | | | | | We typically want to deal in usec_t, hence let's change the prototype accordingly, and do proper range checks. Also, make sure are not confused by negative times. Do something similar for mktime_or_timegm(). This is a more comprehensive alternative to #34065 Replaces: #34065
* hwclock-util: the struct tm parameter is not a pure return parameter, it's ↵Lennart Poettering2024-09-052-7/+6
| | | | also an input parameter
* timedatectl: drop unnecessary temporal variablesYu Watanabe2024-08-191-3/+2
| | | | Also drop unnecessary spaces.
* tree-wide: voidify polkit_agent_open_if_enabled()Yu Watanabe2024-08-191-6/+6
|
* timedatectl: enable interactive authentication for DBus methodsYu Watanabe2024-08-191-0/+2
|
* timedatectl: setting set_local_rtc to 1 will throw Warning as well, use ↵ShreyasMahangade2024-07-201-8/+16
| | | | | log_warning() (#33489) Previously only running `timedatectl` it was showing warning regarding the dangers of setting RTC to local TZ. Now similar warning is also flashed when `set-local-rtc 1`.
* Rename spawn-polkit-agent.c to just polkit-agent.cZbigniew Jędrzejewski-Szmek2024-06-261-1/+1
| | | | | The functions in the file were *not* using the spawn prefix, and the prefix seems completely unnecessary.
* Merge pull request #33214 from keszybz/system-clock-epochMike Yuan2024-06-164-6/+62
|\ | | | | Rework the setting and description of system clock to the epoch
| * Move two functions only used in timesyncd from libshared to the binaryZbigniew Jędrzejewski-Szmek2024-06-124-6/+62
| |
* | tree-wide: never consider service idle if polkit authentication is still pendingLennart Poettering2024-06-121-1/+13
|/ | | | Let's be correct on this.
* timedate: handle gracefully if RTC lost time because of power lossLennart Poettering2024-04-201-0/+2
| | | | | | | Apparently some RTC drivers return EINVAL in that case when we try to read it. Handle that reasonably gracefully. Fixes: #31854
* timedate: fix typoYu Watanabe2024-03-281-1/+1
| | | | Follow-up for 3a51e31be9f626cf772733cb289ed64739fab0e4.
* timedated: Respond on org.freedesktop.timedate1.SetNTP only when really finishedMichal Koutný2024-03-271-3/+18
| | | | | | | | | | | | | The method returns prematurely (before jobs it triggers terminate). This is externally visible because other methods may fail if jobs did not finish. Postpone the DBus method response until we collect all signals for finished jobs. systemd-timedated keeps track of in-flight DBus requests and answers them all in unspecified order when jobs finish. The capacity of requests in systemd-timedated is limited. Fixes: #17739
* polkit: update the rest of bus_verify_polkit_async_full() calls to new flags ↵Luca Boccassi2024-03-111-4/+4
| | | | | | | | | parameter Looks like the compiler doesn't even notice these were left over as the types end up matching somehow Follow-up for 29556b75d8025580eebe160a1fa1459965912ee2
* timedatectl: add -PZbigniew Jędrzejewski-Szmek2024-03-041-13/+13
|
* timedated: modernizationMike Yuan2024-01-091-8/+7
| | | | Switch to sd_event_set_signal_exit() and use Type=notify
* bus-polkit: port polkit_registry to use value destructors in hash_opsLennart Poettering2024-01-031-1/+1
|
* polkit: simplify bus_verify_polkit_async() + drop auth-by-cap dbus featureLennart Poettering2023-12-211-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies bus_verify_polkit_async() and related calls quite a bit: 1. This removes any support for authentication-by-Linux-capability. This is ultimately a kdbus leftover: with classic AF_UNIX transports we cannot authenticate by capabilities securely (because we cannot acquire it from the peer without races), hence we never actually did. Since the necessary kernel work didn't materialize in the last 10y, and is unlikely to be added, let's just kill this context. We cannot quite remove the caps stuff from sd-bus for API compat, but for our polkit logic let's kill it. 2. The "good_uid" and "interactive" params are only necessary in very few cases, hence let's move them to a new call bus_verify_polkit_async_full() and make bus_verify_polkit_async() a wrapper around it without those two parameters. This also fixes a bunch of wrong uses of the "interactive" bool. The bool makes no sense today as the ALLOW_INTERACTIVE_AUTHORIZATION field in the D-Bus message header replaces it fully. We only need it to implement method calls we introduced prior to that header field becoming available in D-Bus. And it should only be used on such old method calls, and otherwise always be set to false. This does not change behaviour in any way. Just simplifies stuff. Fixes: #21586
* timedatectl: add missing commands to the help outputAntonio Alvarez Feijoo2023-10-231-0/+3
| | | | Follow up to 159a855b34c35484c28cf4b0178f93bc16447fac
* tree-wide: port various parsers over to read_stripped_line()Lennart Poettering2023-10-171-6/+4
|
* timedate: Extend timeout for setting NTPPhylLu2023-10-112-2/+13
| | | | | | | | | One of the steps in setting up NTP is to enable/disable the 'systemd-timesyncd.service' and then perform a daemon reload. we use an extra-long timeout for reload in timedated as same as used in systemd daemon reload to avoiding certain situation have longer reload times (which exceed the 25 second default timeout used for dbus-communication), potentially leading to setting NTP failure.
* tree-wide: use LIST_CLEAR()David Tardon2023-08-171-6/+1
|
* meson: move declarations of timedated and friendsYu Watanabe2023-07-311-0/+16
|
* label: Introduce LabelOps to do pre/post labelling operationsDaan De Meyer2023-05-311-1/+1
| | | | | | | | | By default, label_ops is initialized with a NULL pointer which translates to noop labelling operations. In mac_selinux_init() and the new mac_smack_init(), we initialize label_ops with a MAC specific LabelOps pointer. We also introduce mac_init() to initialize any configured MACs and replace all usages of mac_selinux_init() with mac_init().
* basic: add RuntimeScope enumLennart Poettering2023-03-101-1/+1
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* timedatectl: port to new 'vertical' table typeLennart Poettering2022-11-101-29/+23
|
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-132-35/+14
|
* Use https for freedesktop.orgMichael Biebl2022-06-282-2/+2
| | | | grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
* timedatectl: fix a memory leakEvgeny Vereshchagin2022-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | ``` timedatectl list-timezones --no-pager ... ==164329==ERROR: LeakSanitizer: detected memory leaks Direct leak of 8192 byte(s) in 1 object(s) allocated from: #0 0x7fe8a74b6f8c in reallocarray (/lib64/libasan.so.6+0xaef8c) #1 0x7fe8a63485dc in strv_push ../src/basic/strv.c:419 #2 0x7fe8a6349419 in strv_consume ../src/basic/strv.c:490 #3 0x7fe8a634958d in strv_extend ../src/basic/strv.c:542 #4 0x7fe8a643d787 in bus_message_read_strv_extend ../src/libsystemd/sd-bus/bus-message.c:5606 #5 0x7fe8a643db9d in sd_bus_message_read_strv ../src/libsystemd/sd-bus/bus-message.c:5628 #6 0x4085fb in list_timezones ../src/timedate/timedatectl.c:314 #7 0x7fe8a61ef3e1 in dispatch_verb ../src/shared/verbs.c:103 #8 0x410f91 in timedatectl_main ../src/timedate/timedatectl.c:1025 #9 0x41111c in run ../src/timedate/timedatectl.c:1043 #10 0x411242 in main ../src/timedate/timedatectl.c:1046 #11 0x7fe8a489df1f in __libc_start_call_main (/lib64/libc.so.6+0x40f1f) ```
* timedate: update to use new-style sd-bus macrosSonali Srivastava2022-04-111-36/+25
|
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-1/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-6/+0
|
* timedate: use cleanup attribute at one more placeYu Watanabe2022-03-171-11/+18
|
* policy files: adjust landing page linkZbigniew Jędrzejewski-Szmek2022-01-121-1/+1
|
* timedatectl: Uniform commas in NTPMessage outputScott Worley2021-12-211-1/+1
|
* Merge pull request #20138 from keszybz/coding-style-variable-declsLuca Boccassi2021-11-051-1/+1
|\ | | | | A coding style tweak and checking of sd_notify() calls and voidification of pager_open()
| * Make pager_open() return voidZbigniew Jędrzejewski-Szmek2021-11-031-1/+1
| |
* | tree-wide: do not print hint about -M if -M is already usedZbigniew Jędrzejewski-Szmek2021-11-041-1/+1
|/ | | | | | | | (Or when -H is used, since -H and -M are incompatible.) Note that the slightly unusual form with separate boolean variables (hint_vars, hint_addr) instead of e.g. a const char* variable to hold the message, because this way we don't trigger the warning about non-literal format.
* alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhereLennart Poettering2021-10-141-1/+1
| | | | | | | | | | | | | Let's define two helpers strdupa_safe() + strndupa_safe() which do the same as their non-safe counterparts, except that they abort if called with allocations larger than ALLOCA_MAX. This should ensure that all our alloca() based allocations are subject to this limit. afaics glibc offers three alloca() based APIs: alloca() itself, strndupa() + strdupa(). With this we have now replacements for all of them, that take the limit into account.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* tree-wide: add FORMAT_TIMESPAN()Zbigniew Jędrzejewski-Szmek2021-07-091-18/+12
|
* tree-wide: use FORMAT_TIMESTAMP()Zbigniew Jędrzejewski-Szmek2021-07-091-9/+5
|
* timedated: make ntp_synced() staticZbigniew Jędrzejewski-Szmek2021-05-121-0/+13
| | | | No need to have this in basic.
* bus-print-property: introduce BusPrintPropertyFlagsYu Watanabe2021-04-281-13/+9
| | | | Follow-ups for 1ceaad69378272c64da4ecaab0d59ebb7a92ca0a.