b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
b3267152783d5784c45010615045d4e8ee459da2 |
|
13-Jan-2016 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
tree-wide: check if errno is greater than zero (2)
Compare errno with zero in a way that tells gcc that
(if the condition is true) errno is positive. |
93cc7779e0c121b75183920173f37cd1ee9d59cf |
|
01-Dec-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
basic: re-sort includes
My previous patch to only include what we use accidentially placed
the added inlcudes in non-sorted order. |
11c3a36649e5e5e77db499c92f3cdcbd619efd3a |
|
30-Nov-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic. |
4a0b58c4a30ecaa61202f845ed86f75b36370cd0 |
|
17-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: use right cast macros for UIDs, GIDs and PIDs |
cf0fbc49e67b55f8d346fc94de28c90113505297 |
|
16-Nov-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tree-wide: sort includes
Sort the includes accoding to the new coding style. |
4fee397531c97d22e41fb3f02452e82d412fe2b5 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move fdname_is_valid() to fd-util.[ch] |
7b3e062cb6872e28ef5a2e069810070e28bbe0cd |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
process-util: move a couple of process-related calls over |
405f8907b9da158b8548a4d9b85871406fcc2801 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
process-util: actually move rename_process() over
The prototype was moved long ago, actually move the definition over now,
too. |
4e036b7a96b7a72461bdb68ded304041e892b8eb |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
mount-util: move fstype_is_network() and name_to_handle_at() definitions over |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
7d50b32a129e781401cf897475f388f682de1368 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out globbing related calls into glob-util.[ch] |
49cf4170d0b586551527ebf4297f8a3fe6bd71a3 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move web-related calls into web-util.[ch] |
7ccbd1ae843d77275f2c542582a9a80e5e058a70 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out syslog-related calls into syslog-util.[ch] |
7f4b3c5ea39957231839421f2d3a65f5a18e4083 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move running_in_chroot() into virt.[ch]
It's a very weak kind of virtualization, after all. |
4e731273edfe852a3eee2949cd20f49fd5b4f6d7 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move /proc/cmdline parsing code to proc-cmdline.[ch] |
d4510856a007712900795c79853d2218780c2321 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move is_main_thread() to process-util.[ch] |
8752c5752f3b9023f9ce96a55d70c6e5fc31118f |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move more locale-related calls to locale-util.[ch] |
8b43440b7ef4b81c69c31de7ff820dc07a780254 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move string table stuff into its own string-table.[ch] |
8fcde01280adcbd07e8205b91ac52b06305b6208 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch] |
f3e2e81d5385b9ffd84ed110d00eb347ec0e14f1 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: move string_is_safe() to string-util.[ch] |
f4f15635ec05293ffcc83a5b39f624bbabbd8fd0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move a number of fs operations into fs-util.[ch] |
c8b3094de58e3b1e37d06f3d56c9346cffbe320a |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out file attribute calls to chattr-util.[ch] |
89a5a90cb0935cdad84a0b98d41789ad879d0d83 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split xattr-related calls into xattr-util.[ch] |
a09561746f15b84da9471b5c4be74e53d19e4f3f |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: introduce dirent-util.[ch] for directory entry calls
Also, move a couple of more path-related functions to path-util.c. |
78f22b973fa2c9b09bd974680836df17163d9ee0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out resource limits related calls into rlimit-util.[ch] |
e929bee09ab8000e87b7e825ed3a78d73ecdd7f0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move take_password_lock() to user-util.[ch]
Also, rename it take_etc_passwd_lock(), in order to make it more
expressive. |
bb15fafe9cd815fe5bf9eae84c08aead2eb98fd7 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: move filename_is_valid() and path_is_safe() to path-util.[ch] |
4349cd7c1d153c4ffa23cf1cff1644e0afa9bcf0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move mount related utility calls to mount-util.[ch] |
6550203eb471595e41e27f46e5d0a00a4c0e47bb |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move fstab_node_to_udev_node() to fstab-util.[ch] |
0d39fa9c69b97a2ceb156053deef69c0866c2b97 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move more file I/O related calls into fileio.[ch] |
5f311f8c0e51e2f13773823feb6a71f7c6f2838c |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: remove path_get_parent(), in favour of dirname_malloc()
We don't need two functions that do essentialy the same, hence drop
path_get_parent(), and stick to dirname_malloc(), but move it to
path-util.[ch]. |
e4e73a632524c382139034d4271f53b6089ab4cb |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out hex/dec/oct encoding/decoding into its own file |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
4d0d3d41d21f34f28ee67b8b1952af88ada7abaf |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
process-util: move more process related calls to process-util.[ch] |
2583fbea8e762d2e915582af60560f884d5093f5 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
socket-util: move remaining socket-related calls from util.[ch] to socket-util.[ch] |
b1d4f8e154bf61b5de1b27461ef8e9c8c5e838a1 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out user/group/uid/gid calls into user-util.[ch] |
c004493cdefc1f43a3956ca529e8070f8d70be56 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out IO related calls to io-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split out escaping code into escape.[ch]
This really deserves its own file, given how much code this is now. |
84ac7bea360cd369df26910e9685a7eed2327088 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split out extract_first_word() and related calls into extract-word.[ch]
This is quite a lot of code these days, hence move it to its own source
file. |
4cbf8afa0487b75525313b586853823ba5763d8e |
|
23-Oct-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: Replace state with separate booleans in extract_first_word
This simplifies the logic and uniformizes the way single and double
quotes are handled. In the end, the code is about 40 lines shorter.
Tested by running the excellent test cases from test-util. Also
installed the systemd binaries including this patch and booted a
system with it, everything looked normal. |
9e44f56b4ecfa47e27380165b834bd71aa403b78 |
|
22-Oct-2015 |
Evgeny Vereshchagin <evvers@ya.ru> |
util: allow unbalanced double quote in EXTRACT_QUOTES|EXTRACT_RELAX mode
extract_first_word understands "\'string" but doesn't understand "\"string"
fixed this inconsistency. |
ac7edd91670ae859cda6e9b2b97fd87f2639433a |
|
22-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: improve dir_is_empty() call
Simplify the call, and add dir_is_populated() as inverse call, in order
to make some checks easier to read. |
d167824896e583ffaca891b1c355ff852496ff66 |
|
20-Oct-2015 |
Iago López Galeiras <iaguis@gmail.com> |
nspawn: skip /sys-as-tmpfs if we don't use private-network
Since v3.11/7dc5dbc ("sysfs: Restrict mounting sysfs"), the kernel
doesn't allow mounting sysfs if you don't have CAP_SYS_ADMIN rights over
the network namespace.
So the mounting /sys as a tmpfs code introduced in
d8fc6a000fe21b0c1ba27fbfed8b42d00b349a4b doesn't work with user
namespaces if we don't use private-net. The reason is that we mount
sysfs inside the container and we're in the network namespace of the host
but we don't have CAP_SYS_ADMIN over that namespace.
To fix that, we mount /sys as a sysfs (instead of tmpfs) if we don't use
private network and ignore the /sys-as-a-tmpfs code if we find that /sys
is already mounted as sysfs.
Fixes #1555 |
ab84f5b95e10e8ffa115696ddf29c48440c5bae4 |
|
19-Oct-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
strv: Add _cleanup_strv_free_erase_ and _cleanup_string_free_erase_ |
1602b008531ba6e0c704588cb2643daef26b71d9 |
|
19-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: whenever we deal with passwords, erase them from memory after use
A bit snake-oilish, but can't hurt. |
257b0719cb9832b7d5e142c77a38d387c531c631 |
|
17-Oct-2015 |
Evgeny Vereshchagin <evvers@ya.ru> |
util: add func for checking OOMScoreAdjust |
adb8ec96f2918fa7b39722ead6b2fe949fc3a7c5 |
|
14-Oct-2015 |
Evgeny Vereshchagin <evvers@ya.ru> |
util: add functions for validating syslog level and facility |
66cb2fde7b0ab6603775ad13c30c004f5fd88f0c |
|
08-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
basic: move two more terminal-related calls into terminal-util.[ch] |
660021d371d5698a86e914765239045a669e65fb |
|
07-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: always enforce O_NOCTTY and O_CLOEXEC in openpt_in_namespace()
The child process is shortliving, hence always set O_NOCTTY so that the
tty doesn't quickly become controlling TTY and then gives it up again.
Also set O_CLOEXEC, because it's cleaner, and doesn't affect the parent
anyway. |
0a3bb96e2c77af78e31e497c791cb110e740ad59 |
|
06-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: some comment fixes in fdname_is_valid() |
8dd4c05b5495c7ffe0f12ace87e71abe17bd0a0e |
|
06-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
core: add support for naming file descriptors passed using socket activation
This adds support for naming file descriptors passed using socket
activation. The names are passed in a new $LISTEN_FDNAMES= environment
variable, that matches the existign $LISTEN_FDS= one and contains a
colon-separated list of names.
This also adds support for naming fds submitted to the per-service fd
store using FDNAME= in the sd_notify() message.
This also adds a new FileDescriptorName= setting for socket unit files
to set the name for fds created by socket units.
This also adds a new call sd_listen_fds_with_names(), that is similar to
sd_listen_fds(), but also returns the names of the fds.
systemd-activate gained the new --fdname= switch to specify a name for
testing socket activation.
This is based on #1247 by Maciej Wereski.
Fixes #1247. |
df241a67c0d5311dd15e227162d7e886541da16c |
|
02-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework fgetxattrat_fake() to use O_PATH
That way, we don't ever open the file, thus leave the atime untouched,
and this works even when unprivileged. |
e53fc357a9bb9d0a5362ccc4246d598cb0febd5e |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: remove a number of invocations of strerror() and replace by %m
Let's clean up our tree a bit, and reduce invocations of the
thread-unsafe strerror() by replacing it with printf()'s %m specifier. |
618234a5258768359cb1086b152c5f08aaf89754 |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
basic: split out cpu set specific APIs into cpu-set-util.[ch] |
e5aa2f71b74b69972a608cc00c9a59062529dd7d |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: there cannot be trailing garbage when parsing cpu sets
extract_first() already skips trailing whitespace, hence no reason to
explicitly check for it. |
765d143b5fc8dcb44f5fbd391ef36d0835793e7c |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rename parse_cpu_set() to parse_cpu_set_and_warn()
It's pretty untypical for our parsing functions to log on their own.
Clarify in the name that this one does. |
12ca818ffddb77eb6a0fabe369a5bcbf6994ff8b |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: clean up log_syntax() usage
- Rely everywhere that we use abs() on the error code passed in anyway,
thus don't need to explicitly negate what we pass in
- Never attach synthetic error number information to log messages. Only
log about errors we *receive* with the error number we got there,
don't log any synthetic error, that don#t even propagate, but just eat
up.
- Be more careful with attaching exactly the error we get, instead of
errno or unrelated errors randomly.
- Fix one occasion where the error number and line number got swapped.
- Make sure we never tape over OOM issues, or inability to resolve
specifiers |
3f6fd1ba65f962702753c4ad284b588e59689a23 |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: introduce common version() implementation and use it everywhere
This also allows us to drop build.h from a ton of files, hence do so.
Since we touched the #includes of those files, let's order them properly
according to CODING_STYLE. |
189d5bac5c45a6a735489541e285dec8bfc1d38d |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: unify implementation of NOP signal handler
This is highly complex code after all, we really should make sure to
only keep one implementation of this extremely difficult function
around. |
3ee897d6c2401effbc82f5eef35fce405781d6c8 |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: port more code to use send_one_fd() and receive_one_fd()
Also, make it slightly more powerful, by accepting a flags argument, and
make it safe for handling if more than one cmsg attribute happens to be
attached. |
f5c72b739e3252fda11936483ba93963895c4bf2 |
|
25-Sep-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: refactor cpu_set parsing into its own function
Use the new code in config_parse_cpu_affinity2.
Tested by modifying CPUAffinity=... setting in /etc/systemd/system.conf
and reloading the daemon, then checking ^Cpus_allowed in /proc/1/status
to confirm the correct CPU mask is in place. |
7517f51ef9921d3360453c8eec2c97256d320ceb |
|
24-Sep-2015 |
Hendrik Brueckner <brueckner@linux.vnet.ibm.com> |
s390: add personality support
Introduce personality support for Linux on z Systems to run
particular services with a 64-bit or 31-bit personality. |
f6c2284ad340a450ac0e4f9b252aadf67e5618eb |
|
22-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util.h: order includes, as suggested by CODING_STYLE
Of course, because Linux is broken we cannot actually really order it,
and must keep linux/fs.h after sys/mount.h... Yay for Linux! |
8c721f2bcb134de228ec98f5e27ce89d79a31b55 |
|
22-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: clean-ups to enum parsers
Never log when we fail due to OOM when translating enums, let the caller
do that. Translating basic types like enums should be something where
the caller logs, not the translatior functions.
Return -1 when NULL is passed to all enum parser functions.
The non-fallback versions of the enum translator calls already handle
NULL as failure, instead of hitting an assert, and we should do this
here, too. |
4fdae6c8479f6c1a256bc95099cae2fdc23e9256 |
|
22-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: minor cleanups for loop_read() and friends
When 0 bytes are to be written, make sure to go into read() at least
once, in order to validate the parameters, such as the passed fd.
Return error on huge values, add a couple of asserts and casts where
appropriate. |
ed0d40229bc536c424fad481e56afcaa1d0e38db |
|
22-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: add safe_closedir() similar to safe_fclose() |
d960371482d75711e61896f27ea0d3740ea69fe0 |
|
22-Sep-2015 |
David Herrmann <dh.herrmann@gmail.com> |
util: introduce {send,receive}_one_fd()
Introduce two new helpers that send/receive a single fd via a unix
transport. Also make nspawn use them instead of hard-coding it.
Based on a patch by Krzesimir Nowak. |
59f448cf15f94bc5ebfd5b254de6f2441d02fbec |
|
10-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: never use the off_t unless glibc makes us use it
off_t is a really weird type as it is usually 64bit these days (at least
in sane programs), but could theoretically be 32bit. We don't support
off_t as 32bit builds though, but still constantly deal with safely
converting from off_t to other types and back for no point.
Hence, never use the type anymore. Always use uint64_t instead. This has
various benefits, including that we can expose these values directly as
D-Bus properties, and also that the values parse the same in all cases. |
74ca738f6a01fb5fc19c5c3899f5cb1fdc1d7f68 |
|
09-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: introduce safe_fclose() and port everything over to it
Adds a coccinelle script to port things over automatically. |
75f86906c52735c98dc0aa7e24b773edb42ee814 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
basic: rework virtualization detection API
Introduce a proper enum, and don't pass around string ids anymore. This
simplifies things quite a bit, and makes virtualization detection more
similar to architecture detection. |
ef5c570edfd8afb20e3b04d3711e111a1dea0548 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: document why parse_uid() returns ENXIO
parse_uid() returns EINVAL for invalid strings, but ENXIO for the
(uid_t) -1 user ids in order to distinguish these two cases. Document
this. |
a1f686daf55636f9446a4c017f2488a35595395e |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: add new uid_is_valid() call
This simply factors out the uid validation checks from parse_uid() and
uses them everywhere. This simply verifies that the passed UID is
neither 64bit -1 nor 32bit -1. |
395745ba533ac91fe118f43ec83f13a752c0b473 |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
machined: call unlockpt() in container, not host
It makes assumptions about the pty path, hence better call it in the
container namespace rather than the host. |
9797f89bf0ec75a60066b162ab7c23dfb8e734e7 |
|
31-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
util: treat 'C' and 'POSIX' locale identical |
8ab00959fb9758510c7b88bb1e8cf03162361e15 |
|
31-Aug-2015 |
Filipe Brandenburger <filbranden@google.com> |
extract_first_word: Refactor EXTRACT_DONT_COALESCE_SEPARATORS handling
Refactor allocation of the result string to the top, since it is
currently done in both branches of the condition.
Remove unreachable code checking for EXTRACT_DONT_COALESCE_SEPARATORS
when state == SEPARATOR (the only place where SEPARATOR is assigned to
state follows a check for EXTRACT_DONT_COALESCE_SEPARATORS that jumps to
the end of the function.)
Tested by running test-util successfully.
Follow up to: 206644aedeb8859801051ac170ec562c6a113a79 |
d3ef6c5560613fe98fcd227b0256ab4af6078ad0 |
|
31-Aug-2015 |
Filipe Brandenburger <filbranden@google.com> |
extract_first_word: Refactor allocation in empty argument case
This covers the case where an argument is an empty string, such as ''.
Instead of allocating the empty string in the individual conditions when
state == VALUE, just always allocate it at the end of state == START, at
which point we know we will have an argument.
Tested that test-util keeps passing after the refactor.
Follow up to: 14e685c29d5b317b815e3e9f056648027852b07e |
b9a8d250810d4803bc9bf6b36932b528cb991d1e |
|
24-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
machined: validate machine names at more places
When enumerating machines from /run, and when accepting machine names
for operations, be more strict and always validate.
Note that these checks are strictly speaking unnecessary, since
enumeration happens only on the trusted /run... |
25300b5a1fcf54674a69d0f4ab08925be00b0227 |
|
24-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
util: make machine_name_is_valid() a macro and move it to hostname-util.h
As it turns out machine_name_is_valid() does the exact same thing as
hostname_is_valid() these days, as it just invoked that and checked the
name length was < 64. However, hostname_is_valid() checks the length
against HOST_NAME_MAX anyway (which is 64 on Linux), hence any
additional check is redundant.
We hence replace machine_name_is_valid() by a macro that simply maps it
to hostname_is_valid() but sets the allow_trailing_dot parameter to
false. We also move this this call to hostname-util.h, to the same place
as the hostname_is_valid() declaration. |
671c34195896e89f935d842b13f52a748bd8a5b4 |
|
17-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
namespace helpers: Allow entering a UID namespace
To be able to use `systemd-run` or `machinectl login` on a container
that is in a private user namespace, the sub-process must have entered
the user namespace before connecting to the container's D-Bus, otherwise
the UID and GID in the peer credentials are garbage.
So we extend namespace_open and namespace_enter to support UID namespaces,
and we enter the UID namespace in bus_container_connect_{socket,kernel}.
namespace_open will degrade to a no-op if user namespaces are not enabled
in the kernel.
Special handling is required for the setns call in namespace_enter with
a user namespace, since transitioning to your own namespace is forbidden,
as it would result in re-entering your user namespace as root.
Arguably it may be valid to check this at the call site, rather than
inside namespace_enter, but it is less code to do it inside, and if the
intention of calling namespace_enter is to *be* in the target namespace,
rather than to transition to the target namespace, it is a reasonable
approach.
The check for whether the user namespace is the same must happen before
entering namespaces, as we may not be able to access /proc during the
intermediate transition stage.
We can't instead attempt to enter the user namespace and then ignore
the failure from it being the same namespace, since the error code is
not distinct, and we can't compare namespaces while mid-transition. |
61ee6939819963b7845c101485e188ca2a8119c6 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: Add shell_escape
This is for shell-style \ escaping rather than quoting, which while it
has the same effect in produced shell commands, is not exclusively
useful for shell commands.
shell_escape would be useful for producing sed commands, as you would be
able to \ escape the normal special characters, plus whichever argument
separator was chosen; or it could be used to escape arguments passed to
the overlayfs mount command. |
206644aedeb8859801051ac170ec562c6a113a79 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: Allow non-separator coalescing parsing in extract_first_word
If EXTRACT_DONT_COALESCE_SEPARATORS is passed, then leading separators,
trailing separators and spans of multiple separators aren't skipped, and
empty arguments from before, after or between separators may be extracted. |
12ba2c44dde4d7cfc0e531dbc3cbd0581c323637 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: Don't interpret quotes by default in extract_first_word
This adds an EXTRACT_QUOTES option to allow the previous behaviour, of
not interpreting any character inside ' or " quotes as separators. |
6868560773ada8ea31d1f86422be6bf026a1f660 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: change unquote_*_word to extract_*_word
It now takes a separators argument, which defaults to WHITESPACE if NULL
is passed. |
53f0db71771bf757b6b429525a4e5db3dcf3afef |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
unquote_first_word: set *p=NULL on termination
To add a flag to allow an empty string to be parsed as an argument, we
need to be able to distinguish between the end of the string, and after
the end of the string, so when we *do* reach the end, let's set *p to
this state. |
8fb494435889dcb9e1c09b8c7220e47bab717bf9 |
|
06-Aug-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
hostname-util: add relax parameter to hostname_is_valid
Tests are modified to check behaviour with relax and without relax.
New tests are added for hostname_cleanup().
Tests are moved a new file (test-hostname-util) because there's
now a bunch of them.
New parameter is not used anywhere, except in tests, so there should
be no observable change. |
7b9c9ab810eb8746cece22de1dfec375caf4cd13 |
|
04-Aug-2015 |
WaLyong Cho <walyong.cho@gmail.com> |
util: add getxattr helper apis
To get xattr of given path or fd on newly allocated buffer, add new
helper api getxattr_malloc() and fgetxattr_malloc(). |
c030a850ba59fbcdf796abfe48b2f220933c52c0 |
|
31-Jul-2015 |
Namhyung Kim <namhyung@gmail.com> |
busctl: add and use strcmp_ptr()
In member_compare_func(), it compares interface, type and name of
members. But as it can contain NULL pointer, it needs to check them
before calling strcmp(). So make it as a separate strcmp_ptr
function (named after streq_ptr) so that it can be used by others.
Also let streq_ptr() to use it in order to make the code simpler. |
75c0cab158e9da7f78ad040d23cd52720a025659 |
|
27-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
util: base32hex - explain distinction with base32 |
14e685c29d5b317b815e3e9f056648027852b07e |
|
24-Jul-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
unquote_first_word: parse ` '' ` as an empty argument instead of no argument |
919a7f5f1c4f1a4c3e20b0dc55143b8ad70e6a70 |
|
14-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - add base32hexmem() function similar to hexmem()
This implements more of RFC4648. |
2a2953b35505fb7f603b490c72edd76bd6469540 |
|
14-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - fix memleak on error in unbase64mem() |
13a5d76b3277a2a499345cc24facc21eb17ccdae |
|
12-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - add base64mem() function similar to hexmem()
This implements RFC4648 for a slightly more compact representation of
binary data compared to hex (6 bits per character rather than 4). |
30494563f235b21c6583f7476b8ee35e9f5f8048 |
|
12-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - fix errorhandling in unhexmem()
We were ignoring failures from unhexchar, which meant that invalid
hex characters were being turned into garbage rather than the string
rejected.
Fix this by making unhexmem return an error code, also change the API
slightly, to return the size of the returned memory, reflecting the
fact that the memory is a binary blob,and not a string.
For convenience, still append a trailing NULL byte to the returned
memory (not included in the returned size), allowing callers to
treat it as a string without doing a second copy. |
64ee7ab46211307cea338f35694c802f7abc313f |
|
11-Jul-2015 |
Lennart Poettering <lennart@poettering.net> |
util: make sure we don't clobber errno in error path |
ac5213569cd670131e2120f6f244108080818d6b |
|
09-Jul-2015 |
cee1 <fykcee1@gmail.com> |
basic/util.c fopen_temporary(): close fd if failed |
4c1fc3e404d648c70bd2f50ac50aeac6ece8872e |
|
07-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
fileio: consolidate write_string_file*()
Merge write_string_file(), write_string_file_no_create() and
write_string_file_atomic() into write_string_file() and provide a flags mask
that allows combinations of atomic writing, newline appending and automatic
file creation. Change all users accordingly. |
715d7599051602471d4a54bbc00639d32ddaaae2 |
|
02-Jul-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: fall back in rename_noreplace when renameat2 isn't implemented
According to README we only need 3.7, and while it may also make sense
to bump that requirement when appropriate, it's trivial to fall back
when renameat2 is not available. |
843f6bf4ef2c27c20f16da8ec0c5d4aaaad919bb |
|
28-Jun-2015 |
Eric Biggers <ebiggers3@gmail.com> |
util: fix incorrect escape sequence in string_is_safe() |
b59292b296ad71a20a40d7c347b6ca71df48892d |
|
17-Jun-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: Introduce unquote_first_word_and_warn
It will try to unquot_first_word, but if it runs into escaping problems
it will retry it adding UNQUOTE_CUNESCAPE_RELAX to the flags. If it
succeeds on the second try, it will log a warning about it. If it fails
both times, it will log an error.
Add test cases to confirm it behaves as expected. |
d6293c070e6e4b83d8e7ec56e465b0b215d55d98 |
|
17-Jun-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word
The new flag UNQUOTE_UNESCAPE_RELAX preserves unrecognized escape
sequences verbatim in unquote_first_word, either when it's a trailing
backslash (similar to UNQUOTE_RELAX, but in this case keep the extra
backslash in the output) or in the middle of a sequence string.
Add unit test cases to ensure the new flag works as expected and to
prevent regressions from being introduced.
Tested with a follow up commit converting config_parse_exec() to start
using unquote_first_word, in which case this flags makes it possible to
preserve unrecognized escape sequences.
Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794 |
05654e712f0ccfea7bbeb3e4de89861a670f974e |
|
17-Jun-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: Refactor common cunescape block in unquote_first_word |
11c9f1e48a683fb2e78ee531016099d567baa19a |
|
17-Jun-2015 |
Simon McVittie <simon.mcvittie@collabora.co.uk> |
Stop talking about the "XDG" version of basename()
XDG refers to X Desktop Group, a former name for freedesktop.org.
This group is responsible for specifications like basedirs,
.desktop files and icon naming, but as far as I know, it has never
tried to redefine basename().
I think these references were meant to say XPG (X/Open Portability
Guide), a precursor of POSIX. POSIX is better-known and less easily
confused with XDG, and is how the basename(3) man page describes
the libgen.h version of basename().
The other version of basename() is glibc-specific and is described
in basename(3) as "the GNU version"; specifically mention that
version, to disambiguate. |
14bcf25c8b94b5c3556ba3983028a2b35ed0572f |
|
15-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
util: when creating temporary file names, allow including extra id string in it
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(),
tempfn_ranomd_child(). If non-NULL this string is included in the middle
of the newly created file name. This is useful for being able to
distuingish the kind of temporary file when we see one.
This also adds tests for the three call.
For now, we don't make use of this at all, but port all users over. |
a095315b3c31f7a419baceac82c26c3c5ac0cd12 |
|
11-Jun-2015 |
Kay Sievers <kay@vrfy.org> |
build-sys: split internal basic/ library from shared/
basic/ can be used by everything
cannot use anything outside of basic/
libsystemd/ can use basic/
cannot use shared/
shared/ can use libsystemd/ |