summaryrefslogtreecommitdiff
path: root/src/hostname
AgeCommit message (Collapse)Author
2014-12-12util: when using basename() for creating temporary files, verify the ↵Lennart Poettering
resulting name is actually valid Also, rename filename_is_safe() to filename_is_valid(), since it actually does a full validation for what the kernel will accept as file name, it's not just a heuristic.
2014-12-11treewide: correct spacing near eol in code commentsTorstein Husebø
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28hostnamectl: Exit with zero on successMartin Pitt
In show_all_names(), bus_map_all_properties() returns 1 on success which is then used as the return code of show_all_names() and eventually main(). Exit with zero in main() on all nonnegative results to guard against similar errors.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-06hostnamed: introduce new "embedded" chassis typeLennart Poettering
We really don't want to get lost in adding fridge, car, plane, drone, or whatever else, hence add a generic term "embedded" cover all the cases where the computer is just part of something bigger, and not at the focus of things.
2014-10-27util: introduce sethostname_idempotentMichal Sekletar
Function queries system hostname and applies changes only when necessary. Also, migrate all client of sethostname to sethostname_idempotent while at it.
2014-10-23mac: rename apis with mac_{selinux/smack}_ prefixWaLyong Cho
2014-09-16hostname: add missing EMITS_CHANGE annotationDavid Herrmann
We call into sd-bus to send PropertiesChanged notifications for "Hostname", but forgot to add the annotation to the bus-vtable. Fix that!
2014-08-18bus-util: simplify bus_verify_polkit_async() a bitLennart Poettering
First, let's drop the "bus" argument, we can determine it from the message anyway. Secondly, determine the right callback/userdata pair automatically from what is currently is being dispatched. This should simplify things a lot for us, since it makes it unnecessary to pass pointers through the original handlers through all functions when we process messages, which might require authentication.
2014-08-15Merge commit 'b39a2770ba55637da80e2e389222c59dbea73507'Lennart Poettering
2014-08-15sd-bus: add API to check if a client has privilegesLennart Poettering
This is a generalization of the vtable privilege check we already have, but exported, and hence useful when preparing for a polkit change. This will deal with the complexity that on dbus1 one cannot trust the capability field we retrieve via the bus, since it is read via /proc/$$/stat (and thus might be out-of-date) rather than directly from the message (like on kdbus) or bus connection (as for uid creds on dbus1). Also, port over all code to this new API.
2014-08-15hostnamectl: actually implement location supportLennart Poettering
2014-08-15sd-bus: Remove bus arg from bus_verify_polkit_async_registry_free()Stef Walter
It's unneccessary, not used, and complicates callers of the function.
2014-08-04bus: always explicitly close bus from main programsLennart Poettering
Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-07-11hostnamed: introduce new location machin-info field, tooLennart Poettering
2014-07-11hostnamed: drop nss-myhostname checkLennart Poettering
The check only cares about whether the module is installed, not enabled. But installation we should know anyway, after all we ship the module with systemd these days...
2014-07-11hostnamed: make use of in_charset() to verify charsetLennart Poettering
2014-07-11hostnamed: minor modernizationLennart Poettering
2014-07-11Add DEPLOYMENT to hostnamectlJóhann B. Guðmundsson
[zj: remove the check against a fixed list of environments.]
2014-07-09hostnamed: add a new chassis type for watchesLennart Poettering
2014-07-07util: don't consider tabs special in string_has_cc() anymoreLennart Poettering
Instead, take a list of exceptions to our usual CC check
2014-07-03machinectl: show /etc/os-release information of container in status outputLennart Poettering
2014-07-02util: generalize is_localhost() and use it everywhere where applicableLennart Poettering
2014-06-13os-release: define /usr/lib/os-release as fallback for /etc/os-releaseLennart Poettering
The file should have been in /usr/lib/ in the first place, since it describes the OS container in /usr (and not the configuration in /etc), hence, let's support os-release files in /usr/lib as fallback if no version in /etc exists, following the usual override logic. A prior commit already enabled tmpfiles to create /etc/os-release as a symlink to /usr/lib/os-release should it be missing, thus providing nice compatibility with applications only checking in /etc. While it's probably a good idea if all apps check both locations via a fallback logic, it is only necessary in the early boot process, as long as the /etc/os-release symlink has not been restored, in case we boot with an empty /etc.
2014-05-28hostnamed: Fix the way that static and transient host names interactStef Walter
It is almost always incorrect to allow DHCP or other sources of transient host names to override an explicitly configured static host name. This commit changes things so that if a static host name is set, this will override the transient host name (eg: provided via DHCP). Transient host names can still be used to provide host names for machines that have not been explicitly configured with a static host name. The exception to this rule is if the static host name is set to "localhost". In those cases we act as if no static host name has been explicitly set. As discussed elsewhere, systemd may want to have an fd based ownership of the transient name. That part is not included in this commit.
2014-05-24shared: rename hwclock.[ch] to clock-util.[ch]Kay Sievers
2014-05-19hostnamed: expose KernelVersion on the busDjalal Harouni
This is needed to fix bug: https://bugs.freedesktop.org/show_bug.cgi?id=76498 Reported-by: Zach <zachcook1991@gmail.com>
2014-05-15sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables ↵Lennart Poettering
attached to a bus connection This makes callback behaviour more like sd-event or sd-resolve, and creates proper object for unregistering callbacks. Taking the refernce to the slot is optional. If not taken life time of the slot will be bound to the underlying bus object (or in the case of an async call until the reply has been recieved).
2014-04-23hostnamectl: read kernel name and release from remoteDjalal Harouni
2014-04-23hostnamed: expose KernelName and KernelRelease on the busDjalal Harouni
2014-03-11hostnamectl: read OS pretty_name and cpe_name from remoteDjalal Harouni
2014-03-11hostnamed: expose OperatingSystemPrettyName and OperatingSystemCPEName on ↵Djalal Harouni
the bus
2014-03-11hostnamed: minor improvements in context_write_data_other()Djalal Harouni
Prepare context_write_data_other() and rename it to context_write_data_machine_info()
2014-02-25hostnamectl: read virtualization/architecture from remote sideLennart Poettering
This way we make this more network/container transparent and also do not require any client side privileges.
2014-02-24hostnamed: correct error messageMichal Sekletar
We are not parsing timezone data.
2014-02-24virt: make Virtualization an anonymous enumThomas Hindoe Paaboel Andersen
This makes llvm happy when we assign an error code to the variable.
2014-02-21hostnamectl: should the sanitized arch, not the native uname() oneLennart Poettering
2014-02-19make gcc shut upLennart Poettering
If -flto is used then gcc will generate a lot more warnings than before, among them a number of use-without-initialization warnings. Most of them without are false positives, but let's make them go away, because it doesn't really matter.
2013-12-19bus: fix exit-on-idle for driverdLennart Poettering
2013-12-13event: rework sd-event exit logicLennart Poettering
With this change a failing event source handler will not cause the entire event loop to fail. Instead, we just disable the specific event source, log a message at debug level and go on. This also introduces a new concept of "exit code" which can be stored in the event loop and is returned by sd_event_loop(). We also rename "quit" to "exit" everywhere else. Altogether this should make things more robus and keep errors local while still providing a way to return event loop errors in a clear way.
2013-12-12bus: remove explicit activator-specific flags, the kdbus supports it nowKay Sievers
2013-12-12bus: add SD_BUS_NAME_REPLACE_EXISTING to all activatable services, fix one ↵Kay Sievers
flags conversion
2013-12-12bus: instead of exposing the dbus1 flags when acquiring a name use our own ↵Lennart Poettering
that are closer to kdbus This turns around DO_NOT_QUEUE into QUEUE which implies a more useful default. (And negative options are awful anyway.)
2013-12-11event: hook up sd-event with the service watchdog logicLennart Poettering
Adds a new call sd_event_set_watchdog() that can be used to hook up the event loop with the watchdog supervision logic of systemd. If enabled and $WATCHDOG_USEC is set the event loop will ping the invoking systemd daemon right after coming back from epoll_wait() but not more often than $WATCHDOG_USEC/4. The epoll_wait() will sleep no longer than $WATCHDOG_USEC/4*3, to make sure the service manager is called in time. This means that setting WatchdogSec= in a .service file and calling sd_event_set_watchdog() in your daemon is enough to hook it up with the watchdog logic.
2013-12-10bus: introduce "trusted" bus concept and encode access control in object vtablesLennart Poettering
Introduces a new concept of "trusted" vs. "untrusted" busses. For the latter libsystemd-bus will automatically do per-method access control, for the former all access is automatically granted. Per-method access control is encoded in the vtables: by default all methods are only accessible to privileged clients. If the SD_BUS_VTABLE_UNPRIVILEGED flag is set for a method it is accessible to unprivileged clients too. By default whether a client is privileged is determined via checking for its CAP_SYS_ADMIN capability, but this can be altered via the SD_BUS_VTABLE_CAPABILITY() macro that can be ORed into the flags field of the method. Writable properties are also subject to SD_BUS_VTABLE_UNPRIVILEGED and SD_BUS_VTABLE_CAPABILITY() for controlling write access to them. Note however that read access is unrestricted, as PropertiesChanged messages might send out the values anyway as an unrestricted broadcast. By default the system bus is set to "untrusted" and the user bus is "trusted" since per-method access control on the latter is unnecessary. On dbus1 busses we check the UID of the caller rather than the configured capability since the capability cannot be determined without race. On kdbus the capability is checked if possible from the attached meta-data of a message and otherwise queried from the sending peer. This also decorates the vtables of the various daemons we ship with these flags.
2013-12-04Fix typo: SetChasis -> SetChassisDavid Coppa
2013-12-03bus: make sd_bus_request_name() and sd_bus_release_name() behave more like ↵Lennart Poettering
other calls Instead of returning an enum of return codes, make them return error codes like kdbus does internally. Also, document this behaviour so that clients can stick to it. (Also rework bus-control.c to always have to functions for dbus1 vs. kernel implementation of the various calls.)