summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2014-05-18machined: add logic to query IP addresses of containersLennart Poettering
2014-05-18timesyncd: run timesyncd as unpriviliged user "systemd-timesync" (but still ↵Lennart Poettering
with CAP_SYS_TIME)
2014-05-17conf-parser: silently ignore sections starting with "X-"Michael Marineau
This allows external tools to keep additional unit information in a separate section without scaring users with a big warning.
2014-05-16path-lookup: don't hardcode .configTanu Kaskinen
If XDG_CONFIG_HOME is set, then we should respect that.
2014-05-16path-util: add path_make_relative()Tanu Kaskinen
In user_dirs() in path-lookup.c, I want to replace this: symlink("../../../.config/systemd/user", data_home); with symlink(config_home, data_home); to avoid hardcoding .config when XDG_CONFIG_HOME is set. The problem is that config_home is an absolute path, and it's better to make the symlink relative. path_make_relative() is an utility function that converts an absolute path into a relative one.
2014-05-15Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek
No functional change expected :)
2014-05-15Make systemctl --root look for files in the proper placesZbigniew Jędrzejewski-Szmek
Running systemctl enable/disable/set-default/... with the --root option under strace reveals that it accessed various files and directories in the main fs, and not underneath the specified root. This can lead to correct results only when the layout and configuration in the container are identical, which often is not the case. Fix this by adding the specified root to all file access operations. This patch does not handle some corner cases: symlinks which point outside of the specified root might be interpreted differently than they would be by the kernel if the specified root was the real root. But systemctl does not create such symlinks by itself, and I think this is enough of a corner case not to be worth the additional complexity of reimplementing link chasing in systemd. Also, simplify the code in a few places and remove an hypothetical memory leak on error.
2014-05-15shared/install: do not prefix created symlink with root pathZbigniew Jędrzejewski-Szmek
Before: /var/tmp/inst1//etc/systemd/system/default.target -> /var/tmp/inst1//usr/lib/systemd/system/graphical.target After: /var/tmp/inst1/etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target
2014-05-15hashmap: add hashmap_remove2() to remove item from hashtable and return both ↵Lennart Poettering
value and key
2014-05-13shared: add ring bufferDavid Herrmann
New "struct ring" object that implements a basic ring buffer for arbitrary byte-streams. A new basic runtime test is also added. This will be needed for our pty helpers for systemd-console and friends.
2014-05-13shared: add ALIGN_POWER2 macroDavid Herrmann
Sounds easy, turns out to be horrible to implement: ALIGN_POWER2 returns the next higher power of 2. clz(0) is undefined, same is true for left-shift-overflows, yey, C rocks!
2014-05-13replace more dup() by F_DUPFD_CLOEXECLennart Poettering
2014-05-10rtnl: message - read group membership of incoming messagesTom Gundersen
2014-05-06list: make LIST_FIND_TAIL work for empty listsLennart Poettering
2014-05-05timesyncd: lookup name server via sd-resolve, support IPv6, react to ↵Lennart Poettering
SIGINT/SITERM
2014-05-05build-sys: move async.[ch] to src/sharedLennart Poettering
So that we can use it at multiple places.
2014-04-28conf-parser: Fix typo in commentJonathan Boulle
Fix minor typo in conf parser
2014-04-24Add more password agent informationDavid Härdeman
Add an (optional) "Id" key in the password agent .ask files. The Id is supposed to be a simple string in "<subsystem>:<target>" form which is used to provide more information on what the requested passphrase is to be used for (which e.g. allows an agent to only react to cryptsetup requests). (v2: rebased, fixed indentation, escape name, use strappenda)
2014-04-24util: make sure all our name_to_handle_at() code makes use of file_handle_unionLennart Poettering
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-23install: simplificationLennart Poettering
2014-04-23label: there is no label_retest_selinux() callLennart Poettering
2014-04-21systemctl: delete REBOOT_PARAM_FILE if no parameter is specifiedMichael Olbrich
And move it to sperate function.
2014-04-21implement a union to pad out file_handleDave Reisner
Cases where name_to_handle_at is used allocated the full struct to be MAX_HANDLE_SZ, and assigned this size to handle_bytes. This is wrong since handle_bytes should describe the length of the flexible array member and not the whole struct. Define a union type which includes sufficient padding to allow assignment of MAX_HANDLE_SZ to be correct.
2014-04-21condense assignment and path_kill_slashes callsDave Reisner
2014-04-20Remove duplicate includesBas van den Berg
2014-04-16install: create_symlink() check unlink() return valueDjalal Harouni
create_symlink() do not check the return value of unlink(), this may confuse the user. Before the unlink() call we check the 'force' argument. If it is not set we fail with -EEXIST, otherwise we unlink() the file, therefore the next symlink() should not fail with -EEXIST (do not count races...). However since callers may not have appropriate privileges to unlink() the file we lose the -EPERM or any other errno code of unlink(), and return the -EEXIST of the next symlink(). Fix this by checking unlink() results. Before: $ systemctl --force --root=~/container-03 set-default multi-user.target Failed to set default target: File exists After: $ systemctl --force --root=~/container-03 set-default multi-user.target Failed to set default target: Permission denied
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-13udev: remove seqnum API and all assumptions about seqnumsKay Sievers
The way the kernel namespaces have been implemented breaks assumptions udev made regarding uevent sequence numbers. Creating devices in a namespace "steals" uevents and its sequence numbers from the host. It confuses the "udevadmin settle" logic, which might block until util a timeout is reached, even when no uevent is pending. Remove any assumptions about sequence numbers and deprecate libudev's API exposing these numbers; none of that can reliably be used anymore when namespaces are involved.
2014-04-12path-util: also check for existence of binary when given absolute pathZbigniew Jędrzejewski-Szmek
In contrast to a filename-only argument, find_binary() did not actually check if an path exists, allowing the code to fail later on. This was OK, but it seems nicer to treat both paths identically. Also take advantage of path_make_absolute_cwd doing strdup() by itself if necessary to simplify.
2014-04-12fsck: Search for fsck.type in PATHMike Gilbert
Modifies find_binary() to accept NULL in the second argument. fsck.type lookup logic moved to new fsck_exists() function, with a test.
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-04-05build-sys: add newly used if_link.h defines to missing.hZbigniew Jędrzejewski-Szmek
Reported-by: Arnaud Gaboury <arnaud.gaboury@gmail.com>
2014-04-05journal: fix export of messages containing newlinesZbigniew Jędrzejewski-Szmek
In "export" format, newlines are significant, and messages containing newlines must be exported as "binary".
2014-03-25time: support @ syntax for denoting times since the UNIX epoch 1970-1-1Lennart Poettering
2014-03-25util: consider both fuse.glusterfs and glusterfs network file systemsLennart Poettering
Based on a similar patch by Lukáš Nykrýn.
2014-03-25ask-password: modernizationsLennart Poettering
2014-03-25ask-password: when the user types a overly long password, beep and refuseLennart Poettering
Based on a similar patch from David Härdeman.
2014-03-24core: remove tcpwrap supportLennart Poettering
tcpwrap is legacy code, that is barely maintained upstream. It's APIs are awful, and the feature set it exposes (such as DNS and IDENT access control) questionnable. We should not support this natively in systemd. Hence, let's remove the code. If people want to continue making use of this, they can do so by plugging in "tcpd" for the processes they start. With that scheme things are as well or badly supported as they were from traditional inetd, hence no functionality is really lost.
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-21libsystemd-network: move network-utils from src/sharedTom Gundersen
This does not belong in shared as it is mostly a detail of our networking subsystem. Moreover, now we can use libudev here, which will simplify things.
2014-03-21sd-ipv4ll/networkd: generate predictable addressesUmut Tezduyar Lindskog
Increase the chance of using the same link local address between reboots. The pseudo random sequence of addresses we attempt is now seeded with data that is very likely to stay the same between reboots, but at the same time be unique to the specific machine/nic. First we try to use the ID_NET_NAME_* data from the udev db combined with the machin-id, which is guaranteed to be unique and persistent, if available. If that is not possible (e.g., in containers where we don't have access to the udev db) we fallback to using the MAC address of the interface, which is guaranteed to be unique, and likely to be persistent. [tomegun: three minor changes: - don't expose HASH_KEY in the siphash24 header - get rid of some compile-warnings (and some casts at the same time), by using uint8_t[8] rather than uint64_t in the api - added commit message]
2014-03-21missing: add more compat for old kernels and loop devicesLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=76335
2014-03-19core: Beef up PrivateDevices=Lennart Poettering
Also mount /dev/kdbus, /dev/mqueue and /dev/hugepages into the /dev for namespaced services.
2014-03-19missing: define LO_FLAGS_PARTSCAN if it is missingLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=76335
2014-03-19util: add new FOREACH_STRING() macro as syntactic sugar to iterate through a ↵Lennart Poettering
number of fixed strings
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-17build-sys: move sd-login src/login → src/libsystemd/sd-loginLennart Poettering
After all, it is ultimately linked to libsystems.so anyway, thus belongs there and shares very little with the rest of logind, hence let's move this away.
2014-03-17activate: export make_socket_fdZbigniew Jędrzejewski-Szmek
Also improve logging to print out the parsed address on error.
2014-03-17shared: export is_dirZbigniew Jędrzejewski-Szmek