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. |
dda65f56ff343fb63c6f5c9dbde1a88b22c0c41b |
|
21-Jan-2016 |
Daniel Mack <daniel@zonque.org> |
sysusers: use GID_FMT and UID_FMT instead of %d |
f5e5c28f42a2f6d006785ec8b5e98c11a71bb039 |
|
13-Jan-2016 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
tree-wide: check if errno is greater then zero
gcc is confused by the common idiom of
return errno ? -errno : -ESOMETHING
and thinks a positive value may be returned. Replace this condition
with errno > 0 to help gcc and avoid many spurious warnings. I filed
a gcc rfe a long time ago, but it hard to say if it will ever be
implemented [1].
Both conventions were used in the codebase, this change makes things
more consistent. This is a follow up to bcb161b0230f.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61846 |
75eb615480afd787fa412f0a529523f568f79b26 |
|
10-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
defs: rework CONF_DIRS_NULSTR() macro
The macro is generically useful for putting together search paths, hence
let's make it truly generic, by dropping the implicit ".d" appending it
does, and leave that to the caller. Also rename it from
CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about
dirs that way, but any kind of file system path.
Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to
_CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that
it's internal. |
b938cb902c3b5bca807a94b277672c64d6767886 |
|
06-Nov-2015 |
Jan Engelhardt <jengelh@inai.de> |
doc: correct punctuation and improve typography in documentation |
a0f29c767a3bb3d621c658fa5b87063e1f44e24a |
|
03-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move CONF_DIRS_NULSTR definition to def.h
After all, this is not some compiler or C magic, but something very
specific to how systemd works, hence let's move it into def.h, and out
of macro.h |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-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. |
b1d4f8e154bf61b5de1b27461ef8e9c8c5e838a1 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out user/group/uid/gid calls into user-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. |
0f03c2a4c093e3d44f4072144827e943c05c8904 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
path-util: unify how we process paths specified on the command line
Let's introduce a common function that makes relative paths absolute and
warns about any errors while doing so. |
0f4743651081b5367ab06f238827ddfd4da74e74 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: get_current_dir_name() can return errors other than ENOMEM
get_current_dir_name() can return a variety of errors, not just ENOMEM,
hence don't blindly turn its errors to ENOMEM, but return correct errors
in path_make_absolute_cwd().
This trickles down into a couple of other functions, some of which
receive unrelated minor fixes too with this commit. |
c02e7b1ecc7d88f6529ca3d1d231536300991a02 |
|
07-Oct-2015 |
Sangjung Woo <sangjung.woo@samsung.com> |
smack: label /etc/passwd and friends as '_' smack label when --with-smack-run-label' is enabled
systemd-sysusers.service unit creates system users and groups and it
could update /etc/passwd, /etc/group, /etc/shadow and /etc/gshadow.
Those files should have '_' smack label because of accessibility.
However, if systemd has its own smack label using '--with-smack-run-label'
configuration, systemd-sysusers process spawned by systemd(pid:1) has
its parent smack label and eventually updated files also is set as its
parent smack label.
This patch fixes that bug by labeling updated files as '_' smack label
when --with-smack-run-label' is enabled. |
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. |
65d60552f2f1c198df06acef80431cbc460fbab6 |
|
24-Sep-2015 |
Jan Engelhardt <jengelh@inai.de> |
sysusers: improve error reporting
Creating group input with gid 491.
Failed to write files: File exists
"Why is the presence of /etc/group a problem?" |
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. |
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. |
4b1c17535115b70f4ddf4bf5850049b885a40173 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
Convert unquote_*_word users to expect isempty(p) after the last entry
This is so that, when called in a loop, unquote_first_word can
distinguish between reaching the end of a string because it has consumed
all the input before the end, and consuming all the input.
This is important because we later add a flag that allows
char *in = "";
char *out;
unquote_first_word(&in, &out, flags);
To put "" in out, and set in = NULL, so the trailing empty string of the
input can be consumed, and mark that the input has been consumed. |
97b11eedff9d2e17101ad453caf9e48b73246719 |
|
31-Jul-2015 |
David Herrmann <dh.herrmann@gmail.com> |
tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
free(foobar);
foobar = NULL;
to this:
foobar = mfree(foobar); |
2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d |
|
30-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent,
open-coded versions. |
1d13f648d0fade38194db74b4f82ca68c8a26856 |
|
13-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: add generic calls for prefixing a root directory to a path
So far a number of utilities implemented their own calls for this, unify
them in prefix_root() and prefix_roota(). The former uses heap memory,
the latter allocates from the stack via alloca().
Port over most users of a --root= logic. |
6482f6269c87d2249e52e889a63adbdd50f2d691 |
|
10-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add formats-util.h |
4034a06ddb82ec9868cd52496fef2f5faa25575f |
|
26-Mar-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework word parsing and c unescaping code
When parsing words from input files, optionally automatically unescape
the passed strings, controllable via a new flags parameter.
Make use of this in tmpfiles, and port everything else over, too.
This improves parsing quite a bit, since we no longer have to process the
same string multiple times with different calls, where an earlier call
might corrupt the input for a later call. |
c5abf22514b3925aa6f0d4a3f36f76799bf1911b |
|
07-Mar-2015 |
Ivan Shapovalov <intelfx100@gmail.com> |
sysusers: do not reject users with already present /etc/shadow entries
This is needed to interoperate firstboot and sysusers. The former one is started
first, and it writes only /etc/shadow when it is told to set the root password.
It's better to relax checks here than to duplicate functionality in firstboot. |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use. |
63c372cb9df3bee01e3bf8cd7f96f336bddda846 |
|
03-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary. |
8cb4ab0058e51f1fba93683d145ef95f97c2fa86 |
|
09-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
logind: unify how we cast between uid_t and pointers for hashmap keys |
d7b8eec7dc7fe307d3a08b32cf1a9ad4276ce6d5 |
|
28-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
tmpfiles: add new line type 'v' for creating btrfs subvolumes |
7430ec6ac08f2c0416d9f806964c46b30f3862b2 |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
copy: use btrfs reflinking only whe we know we copy full files |
fed1e721fd0c81e60c77120539f34e16c2585634 |
|
28-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1 |
4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno
+ return simplifications". |
56f64d95763a799ba4475daf44d8e9f72a1bd474 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'
Plus some whitespace, linewrap, and indent adjustments. |
8d3d7072e609ef0e0fb37e1d19a29307d58146c3 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: a few more log_*_errno + return simplifications
The one in tmpfiles.c:create_item() even looks like it fixes a bug. |
f647962d64e844689f3e2acfce6102fc47e76df2 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
local $_=<>;
s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
print;'
$f
done
And a couple of manual whitespace fixups. |
da927ba997d68401563b927f92e6e40e021a8e5c |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values. |
0a1beeb64207eaa88ab9236787b1cbc2f704ae14 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: auto-convert the simple cases to log_*_errno()
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(). |
7f0a55d4325f7df91f91b3b818f61f97d78df14a |
|
27-Nov-2014 |
Josh Triplett <josh@joshtriplett.org> |
Introduce CONF_DIRS_NULSTR helper to define standard conf dirs
Several different systemd tools define a nulstr containing a standard
series of configuration file directories, in /etc, /run, /usr/local/lib,
/usr/lib, and (#ifdef HAVE_SPLIT_USR) /lib. Factor that logic out into
a new helper macro, CONF_DIRS_NULSTR. |
fff19499605924251d037073f47665419b669400 |
|
11-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sysuser: simplify access mode syncing by introducing helper function for it |
f06863bde5de49a503cb8028e89d4b30790f2cbf |
|
07-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: be nice and print a warning if futimens() fails
CID# 1251163 |
e3c72c21d62aadabf4df436c3e2c7219eeeccc1c |
|
30-Oct-2014 |
Colin Guthrie <colin@mageia.org> |
sysusers: Preserve ownership and mode on /etc/passwd and friends
When running sysusers we would clobber file ownership and permissions
on the files /etc/passwd, /etc/group and /etc/[g]shadow.
This simply preserves the ownership and mode if existing files are
found. |
cc56fafeebf814ef035e549115cf1850e6473fa5 |
|
23-Oct-2014 |
WaLyong Cho <walyong.cho@samsung.com> |
mac: rename apis with mac_{selinux/smack}_ prefix |
56d21cdebce3ecd3b06189cb2184a84ba909619f |
|
18-Sep-2014 |
Philippe De Swert <philippedeswert@gmail.com> |
sysusers: Remove some gcc warnings about uninitialized variables
Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise. |
d5099efc47d4e6ac60816b5381a5f607ab03f06e |
|
15-Sep-2014 |
Michal Schmidt <mschmidt@redhat.com> |
hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.
systemd keeps hundreds of hashmaps, so this saves a little bit of
memory. |
c46409021fa9d161c587c9e364ec629256265a75 |
|
19-Aug-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sysusers: initialize r
Needed for the stdin case where it could otherwise end up being used
uninitialized. |
8530dc4467691a893aa2e07319b18a84fec96cad |
|
19-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
tmpfiles: add new 'r' line type to add UIDs/GIDs to the pool to allocate UIDs/GIDs from
This way we can guarantee a limited amount of compatibility with
login.defs, by generate an appopriate "r" line out of it, on package
installation. |
7629889c86005017eb1a7f1f803c0d8e7a5bef08 |
|
19-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: add another column to sysusers files for the home directory |
dfc87cbfe5ec03190e5b2235b1ed477db11541ca |
|
19-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: optionally, read sysuers configuration from standard input |
9ab315ccf22a56ce28d442d94c5e4e3c416739c5 |
|
19-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: also update /etc/shadow and /etc/gshadow when creating new system users
This should resolve problems with tools like "grpck" and suchlike. |
24fb7c1fa633e90e4297e0715546c0bc47118ba9 |
|
04-Aug-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sysusers: isempty will never be < 0
looks like a typo from 1b99214789101976d6bbf75c351279584b071998 |
601185b43da638b1c74153deae01dbd518680889 |
|
04-Aug-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Unify parse_argv style
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. |
9f1c19405a1ccaf59dcc8c32c13a1619541189ad |
|
22-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sysusers: fix selinux context of backup files
Also, fix fopen_temporary_label to set proper context. By chance,
all users so far used the same context, so the error didn't matter.
Also, check return value from label_init().
https://bugzilla.redhat.com/show_bug.cgi?id=1121806 |
f7f628b5db770feb8b18990436baefaec55c460b |
|
14-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Add function to open temp files in selinux mode |
a334cbba7222d3d7d886c17c828fa4227c656535 |
|
14-Jul-2014 |
Colin Walters <walters@verbum.org> |
sysusers: preserve label of /etc/{passwd, group}
These files are specially labeled on SELinux systems, and we need to
preserve that label. |
938a560b7608e8906134ed7d717c3f5aa459a760 |
|
11-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sysusers: allow overrides in /etc and /run
An administrator might want to block a certain sysusers config file from
being executed, e.g. to block the creation of a certain user.
Only a relatively short description is added in the man page, since
overrides should be relatively rare. |
38c74dad1c3d605018e61074e0b80f6b9523b1c8 |
|
09-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: don't allow control characters in gecos fields |
932ad62b84165b0acf690ea34c4b8083657ae244 |
|
09-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: don't allow user names longer than UT_NAMESIZE
As pointed out by Miloslav Trmač it might be a good idea to make sure
that usernames stay with in the utmp-defined limits. |
45035609fcfc3fe09324988c4929a3c147171c23 |
|
07-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
firstboot: follow lock protocol when changing /etc/shadow |
bce415edcae8e7af8327de8265d621f95fa5426f |
|
06-Jul-2014 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
sysusers: fix uninitialized warning |
a12b0cc34d80a2d13c87d1f57059339cfc780912 |
|
03-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: add new line type "m" to add users as members to groups |
93240d3aba4611dd966c5b9f7368d20612211486 |
|
23-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
coredump: never write more than the configured processing size limit to disk |
b0284aba93e8ccd415da5bbee86d84c12b1b9856 |
|
13-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: always treat ENOENT as entry-not-found when doing NSS calls
For most NSS calls it is documented that they return NULL + errno=0 when
an entry is not found. However, in reality it appears to be common to
return NULL + errno=ENOENT, instead. Handle that correctly, and don't
consider ENOENT a systematic error. |
c1b6b04f0e90bbbce589b40db7c58ae2a64976eb |
|
13-Jun-2014 |
Kay Sievers <kay@vrfy.org> |
sysusers: do not set todo to create a user when we only need a group |
1b99214789101976d6bbf75c351279584b071998 |
|
12-Jun-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: add minimal tool to reconstruct /etc/passwd and /etc/group from 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. |