summaryrefslogtreecommitdiffstats
path: root/src/hostname (follow)
Commit message (Collapse)AuthorAgeFilesLines
* hostnamed: use strdup_to_full()Zbigniew Jędrzejewski-Szmek2024-03-201-29/+2
|
* polkit: turn "interactive" flag to polkit APIs into a proper flags field ↵Lennart Poettering2024-03-111-5/+4
| | | | | | | | | | | | (#31715) This adds for both the D-Bus and the Varlink flavours of our polkit client api a flags parameter. And then folds the "bool interactive" flag that the D-Bus version so far had, into a flag, and also adds support for it in the Varlink API. Since this means the Varlink API gained another parameter, let's do what we already did for the D-Bus API and add a _full() version of the API that has the flags and the good_uid parameter, and one without both.
* Merge pull request #31600 from YHNdnzj/fd-pollMike Yuan2024-03-041-1/+1
|\ | | | | core/service: several trivial cleanups for fdstore
| * extract-word: modernize extract_many_wordsMike Yuan2024-03-031-1/+1
| |
* | hostnamectl: gracefully handle old hostnamed replies to GetHardwareSerial()Lennart Poettering2024-03-041-1/+2
| | | | | | | | | | | | Old versions of hostnamed used to propagate ENODEV/ENOENT as-is. Bad idea. This was fixed in 171ddae1a122e9c97b4ef12ccb2d29e1ba7a318a, but let's handle this gracefully in hostnamectl.
* | hostnamectl: properly initialize the two timestamp fields before doing bus callLennart Poettering2024-03-041-1/+3
|/ | | | | | Otherwise if talking to an old hostnamed (which doesn't have these fields) we'd assume the timestamp is valid even though it isn't and show garbage.
* hostnamed: use sd_bus_reply_method_return() to shorten code a bitLennart Poettering2024-03-021-20/+2
|
* hostnamectl: display product uuid + hardware serial in regular status outputLennart Poettering2024-03-011-0/+60
| | | | hostnamed provides this, hence hostnamectl should show it
* hostnamed: add explicit BUS_ERROR_NO_HARDWARE_SERIAL errorLennart Poettering2024-03-011-1/+2
| | | | | | For the very similar case of the product UUID we have its own error BUS_ERROR_NO_PRODUCT_UUID if we have no UUID. Let's mirror this for the hardware serial, and expose the same, to keep things nicely symmteric.
* hostnamed: do some validation of the hw serial before we return itLennart Poettering2024-03-011-5/+25
| | | | | | Let's make sure the serial contains not control chars, and is UTF-8 clean. In particular the latter matters as D-Bus shouldn't kick us from the bus.
* hostnamed: in get_hardware_firmware_data() don't dup a string if we shan't ↵Lennart Poettering2024-03-011-9/+16
| | | | return it
* hostnamed: our base indentation is 8 spaces, not 9 spacesLennart Poettering2024-03-011-33/+33
| | | | No idea what was going on here...
* hostnamectl: add -j switch for quick json outputLennart Poettering2024-01-221-1/+6
| | | | | | | We already support -j as shortcut for JSON mode in various tools. Let's add one more. We probably should add this systematically (at least where it doesn't conflict with an existing -j switch with other purpose). But I am too lazy to add that now.
* hostnamed: expose /etc/os-release and /etc/machine-info data in fullLennart Poettering2024-01-221-0/+6
| | | | | | | | | | There's some appetite to have the full os-release/machine-info data exposed by hostnamed. let's do so in the Describe() method and via Varlink. It's trivial after all. Inspired by: #18649
* hostnamed: use Type=notifyMike Yuan2024-01-091-0/+5
|
* hostnamed: always include VSockCID property in describe JSONLennart Poettering2024-01-091-1/+2
| | | | | | | | | that way clients can distinguish whether there is no cid or whether hostnamed doesn't support it nicely, by just looking if the prop exists (but is null) or not. This is similar how we already handle all other props in the JSON record.
* hostnamed: add simple Varlink API, tooLennart Poettering2024-01-091-21/+123
|
* hostnamed: move bus and event loop object into Context objectLennart Poettering2024-01-091-16/+23
| | | | | It's a bit weird to keep this separate in particular as the polkit object is already part of the context.
* hostnamed: port to sd_event_set_signal_exit()Lennart Poettering2024-01-091-8/+2
|
* hostnamed: expose local AF_VSOCK CID among other host infoLennart Poettering2024-01-082-3/+39
| | | | | This is a host identifier of major relevance, since it is how you connect to this system if it is a VM, hence expose this nicely.
* 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-27/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* hostname: expose machine ID and boot ID through DBusYu Watanabe2023-12-062-23/+74
| | | | Fixes #30293.
* hostnamectl: do not show local machine ID and boot ID when requested to show ↵Yu Watanabe2023-12-061-7/+13
| | | | | | information about remote host Prompted by #30293.
* env-util: make write_env_file() optionally take headersYu Watanabe2023-10-311-1/+1
| | | | | | | This also makes write_env_file() and write_env_file_label() optionally take dir_fd, and drop write_env_file_at(). Preparation for later commits.
* hostname: Make sure we pass error to bus_verify_polkit_async()Daan De Meyer2023-08-241-1/+1
| | | | Fixes #28943
* meson: move declarations of localed and hostnamedYu Watanabe2023-07-311-0/+15
|
* hostnamectl: show age of firmware as time span, tooLennart Poettering2023-06-201-0/+11
| | | | | | | This converts the date into a relative timespan from the current time on, and outputs it. It marks it yellow if older than two years, since old firmware is probably a security risk. We don't make it red, since we don't know though.
* hostnamed: when parsing day/month of firmware date, force decimal parsingLennart Poettering2023-06-201-3/+3
| | | | | | | | | | | | | | | safe_atou() by default determines the base from the prefix 0x, 0b, 0o and for compat with just 0 for octal. This is not what we want here, since the date components are padded with zeroes yet still decimal. Hence force decimal parsing (and while we are at it, prohibit a couple of unexpected decorations). WIthout this we'd fail to parse any the 8th and 9th day of each months, as well aus aug and september of every year, because these look like octal numbers but cannot actually parsed as such. Let's change the testcase to check for a date that exposes this bheaviour.
* hostnamed: don't read DMI data within a containerLennart Poettering2023-06-201-0/+25
| | | | | If we run in a container we should show info about the container, not the host.
* 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().
* hostnamectl: convert more hostname1 calls to BusLocatorDavid Tardon2023-05-241-24/+4
|
* 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.
* hostnamectl: show support and among outputLennart Poettering2023-01-241-0/+32
|
* hostnamed: expose support end timestamp as property on the busLennart Poettering2023-01-241-5/+33
|
* tree-wide: unify how we pick OS pretty name to displayLennart Poettering2023-01-241-1/+6
|
* hostnamectl: show firmware date with date only, without timeLennart Poettering2023-01-201-1/+1
| | | | | The source (usually DMI/SMBIOS) only has 24h granularity, hence don't show time as well, it's useless.
* hostnamed: expose FirmwareDate as timestamp in dbusJelle van der Waa2023-01-192-7/+75
| | | | | | Offer the firmware date as an epoch instead of the literal DMI string. Closes #25679
* hostnamed: expose FirmwareDate dbus propertyJelle van der Waa2022-12-071-1/+23
| | | | Expose /sys/class/dmi/id/bios_date as dbus property in hostnamed.
* hostnamed: expose FirmwareVendor as dbus propertyJelle van der Waa2022-12-071-1/+25
| | | | Expose /sys/class/dmi/id/bios_vendor as dbus property in hostnamed.
* hostnamectl: port to vertical tableDavid Tardon2022-11-131-21/+18
|
* 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: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* tree-wide: use the term "initrd" at most places we so far used "initramfs"Lennart Poettering2022-09-231-2/+2
| | | | | | | | | | | | In most cases we refernced the concept as "initrd". Let's convert most remaining uses of "initramfs" to "initrd" too, to stay internally consistent. This leaves "initramfs" only where it's relevant to explain historical concepts or where "initramfs" is part of the API (i.e. in /run/initramfs). Follow-up for: b66a6e1a5838b874b789820c090dd6850cf10513
* shared/format-table: use enum instead of Table.empty_stringZbigniew Jędrzejewski-Szmek2022-09-221-3/+1
| | | | | | | | | | | | All users were setting this to some static string (usually "-"), so let's simplify things by not doing strdup, but instead limiting callers to a fixed set of values. In preparation for the next commit, the function is renamed from "empty" to "replacement", because it'll be used for more than empty fields. I didn't do the whole string-table setup, because it's all used internally in one file and this way we can immediately assert if an invalid value is passed in. Some callers were (void)ing the error, others were ignoring it, and others propagating. It's nicer to remove the boilerplate.
* hostnamectl,localectl: use "(unset)" in empty fieldsZbigniew Jędrzejewski-Szmek2022-09-211-1/+1
| | | | | "n/a" is more ambiguous: not available or not set or maybe we didn't check it. Let's just say directly that the field is not set.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-14/+7
|
* hostname: make chassis type actually obtained from ACPI when nothing from DMIYu Watanabe2022-08-221-1/+1
| | | | | | Fixes a bug introduced by 8c8b1800e90d4307397300ef32b0f6d95efad057. Fixes #24384.
* 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#'