summaryrefslogtreecommitdiff
path: root/src/shared/util.c
AgeCommit message (Collapse)Author
2014-07-11util: fix has cc check and add testZbigniew Jędrzejewski-Szmek
2014-07-07firstboot: get rid of firstboot generator again, introduce ↵Lennart Poettering
ConditionFirstBoot= instead As Zbigniew pointed out a new ConditionFirstBoot= appears like the nicer way to hook in systemd-firstboot.service on first boots (those with /etc unpopulated), so let's do this, and get rid of the generator again.
2014-07-07firstboot: follow lock protocol when changing /etc/shadowLennart Poettering
2014-07-07firstboot: add new component to query basic system settings on first boot, ↵Lennart Poettering
or when creating OS images offline A new tool "systemd-firstboot" can be used either interactively on boot, where it will query basic locale, timezone, hostname, root password information and set it. Or it can be used non-interactively from the command line when prepareing disk images for booting. When used non-inertactively the tool can either copy settings from the host, or take settings on the command line. $ systemd-firstboot --root=/path/to/my/new/root --copy-locale --copy-root-password --hostname=waldi The tool will be automatically invoked (interactively) now on first boot if /etc is found unpopulated. This also creates the infrastructure for generators to be notified via an environment variable whether they are running on the first boot, or not.
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-07util: consider 0x7F a control chracter (which it is: DEL)Lennart Poettering
Let's better be safe than sorry.
2014-07-03sd-bus: support connecting to remote hosts, directly into containersLennart Poettering
systemctl -H root@foobar:waldi will now show a list of services running on container "waldi" on host "foobar", using "root" for authenticating at "foobar". Since entereing a container requires priviliges, this will only work correctly for root logins.
2014-07-02util: when unescaping strings, don't allow smuggling in of additional NUL bytesLennart Poettering
Better safe than sorry.
2014-07-02util: generalize is_localhost() and use it everywhere where applicableLennart Poettering
2014-07-02path: add new "systemd-path" utility for querying paths described in ↵Lennart Poettering
file-hierarchy(7) This new tool is based on "sd-path", a new (so far unexported) API for libsystemd, that can hopefully grow into a workable API covering /opt and more one day.
2014-07-01parse_uid: return -ENXIO for -1 uidsKay Sievers
2014-06-30shared/util.c:wait_for_terminate_and_warn(): Add a comment on the return valuesLuke Shumaker
2014-06-30util: fix commentLennart Poettering
2014-06-29util: refuse considering UID 0xFFFF and 0xFFFFFFFF validLennart Poettering
2014-06-24use more _cleanup_ macroRonny Chevalier
2014-06-20util: treat fuse.sshfs as a network filesystemZbigniew Jędrzejewski-Szmek
https://bugs.freedesktop.org/show_bug.cgi?id=73727
2014-06-20util: do not strip /dev prefix twiceZbigniew Jędrzejewski-Szmek
2014-06-20shared: fix search_and_fopen with alternate rootsMichael Marineau
Update for the current behavior of path_strv_resolve which now returns paths relative to the given root, not the full absolute paths.
2014-06-20shared: rename path_strv_canonicalize_absolute functionsMichael Marineau
Since 12ed81d9 path_strv_canonicalize_absolute leaves the search list relative to the given root directory instead of resolving paths to their true location as the name implies. To better reflect this behavior rename to the less strongly worded path_strv_resolve.
2014-06-19util.c: simplify rm_rf_children_dangerousZbigniew Jędrzejewski-Szmek
2014-06-18tmpfiles: add "+" modifier support to b, c, p lines in addition to LLennart Poettering
2014-06-17install: make sure that --root= mode doesn't make us consider all units ↵Lennart Poettering
outside of search path
2014-06-16tmpfiles: add new "L+" command as stronger version of "L", that removes the ↵Lennart Poettering
destination before creating a symlink Also, make use of this for mtab as long as mount insists on creating it even if we invoke it with "-n".
2014-06-16tmpfiles: set up selinux label proeprly when creating fifosLennart Poettering
2014-06-12sysusers: add minimal tool to reconstruct /etc/passwd and /etc/group from ↵Lennart Poettering
static files systemd-sysusers is a tool to reconstruct /etc/passwd and /etc/group from static definition files that take a lot of inspiration from tmpfiles snippets. These snippets should carry information about system users only. To make sure it is not misused for normal users these snippets only allow configuring UID and gecos field for each user, but do not allow configuration of the home directory or shell, which is necessary for real login users. The purpose of this tool is to enable state-less systems that can populate /etc with the minimal files necessary, solely from static data in /usr. systemd-sysuser is additive only, and will never override existing users. This tool will create these files directly, and not via some user database abtsraction layer. This is appropriate as this tool is supposed to run really early at boot, and is only useful for creating system users, and system users cannot be stored in remote databases anyway. The tool is also useful to be invoked from RPM scriptlets, instead of useradd. This allows moving from imperative user descriptions in RPM to declarative descriptions. The UID/GID for a user/group to be created can either be chosen dynamic, or fixed, or be read from the owner of a file in the file system, in order to support reconstructing the correct IDs for files that shall be owned by them. This also adds a minimal user definition file, that should be sufficient for most basic systems. Distributions are expected to patch these files and augment the contents, for example with fixed UIDs for the users where that's necessary.
2014-06-10tmpfiles: add new "C" line for copying files or directoriesLennart Poettering
2014-06-10bus-proxy: properly index policy by uid/gid when parsingLennart Poettering
2014-06-06namespace: beef up read-only bind mount logicLennart Poettering
Instead of blindly creating another bind mount for read-only mounts, check if there's already one we can use, and if so, use it. Also, recursively mark all submounts read-only too. Also, ignore autofs mounts when remounting read-only unless they are already triggered.
2014-06-05namespace: when setting up an inaccessible mount point, unmounting ↵Lennart Poettering
everything below This has the benefit of not triggering any autofs mount points unnecessarily.
2014-06-05util: fix fd_cloexec(), fd_nonblock()Lennart Poettering
2014-06-05sd-daemon: introduce sd_pid_notify() and sd_pid_notifyf()Lennart Poettering
sd_pid_notify() operates like sd_notify(), however operates on a different PID (for example the parent PID of a process). Make use of this in systemd-notify, so that message are sent from the PID specified with --pid= rather than the usually shortlived PID of systemd-notify itself. This should increase the likelyhood that PID 1 can identify the cgroup that the notification message was sent from properly.
2014-06-01timesyncd: split privilege dropping code out of timesyncd so that we can ↵Lennart Poettering
make use of it from other daemons too This is preparation to make networkd work as unpriviliged user.
2014-05-31util: ignore_file should not allow files ending with '~'Thomas Hindoe Paaboel Andersen
ignore_file currently allows any file ending with '~' while it seems that the opposite was intended: a228a22fda4faa9ecb7c5a5e499980c8ae5d2a08
2014-05-24core: timer - switch to touch_file()Kay Sievers
2014-05-24shared: add touch_file() and let touch() always update timestampKay Sievers
2014-05-21util: fix a gcc compiler warningLennart Poettering
2014-05-18machined: add logic to query IP addresses of containersLennart Poettering
2014-05-15Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek
No functional change expected :)
2014-05-05timesyncd: lookup name server via sd-resolve, support IPv6, react to ↵Lennart Poettering
SIGINT/SITERM
2014-04-23delta: draw arrows with draw_special_char()Lennart Poettering
Let's unify generation of unicode chars at one place. Also, don't add an extra space into chars we print, except for the tree chars where this is really necessary.
2014-04-21systemctl: delete REBOOT_PARAM_FILE if no parameter is specifiedMichael Olbrich
And move it to sperate function.
2014-04-20Remove duplicate includesBas van den Berg
2014-04-13util: ignore kernel errors reported via close(), unless it is EBADFLennart Poettering
The kernel can return pretty much anything there, even though the fd is closed. Let's not get confused by that.
2014-04-12Unify GREEDY_REALLOC and GREEDY_REALLOC_TZbigniew Jędrzejewski-Szmek
greedy_realloc() and greedy_realloc0() now store the allocated size as the count, not bytes. Replace GREEDY_REALLOC uses with GREEDY_REALLOC_T everywhere, and then rename GREEDY_REALLOC_T to GREEDY_REALLOC. It is just too error-prone to have two slightly different macros which do the same thing.
2014-03-25util: consider both fuse.glusterfs and glusterfs network file systemsLennart Poettering
Based on a similar patch by Lukáš Nykrýn.
2014-03-24util: replace close_pipe() with new safe_close_pair()Lennart Poettering
safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s...
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2014-03-16Use strlen even for constant stringsJosh Triplett
GCC optimizes strlen("string constant") to a constant, even with -O0. Thus, replace patterns like sizeof("string constant")-1 with strlen("string constant") where possible, for clarity. In particular, for expressions intended to add up the lengths of components going into a string, this often makes it clearer that the expression counts the trailing '\0' exactly once, by putting the +1 for the '\0' at the end of the expression, rather than hidden in a sizeof in the middle of the expression.
2014-03-14util: add hexdump() call to create pretty hexdumps of dataLennart Poettering
This is very useful when debugging sd-bus to look at messages.
2014-03-14shared: add root argument to search_and_fopenMichael Marineau
This adds the same root argument to search_and_fopen that conf_files_list already has. Tools that use those two functions as a pair can now be easily modified to load configuration files from an alternate root filesystem tree.