Commit graph

346 commits

Author SHA1 Message Date
Lennart Poettering 7629889c86 sysusers: add another column to sysusers files for the home directory 2014-08-19 16:47:52 +02:00
Lennart Poettering 56d96fc00c main: minor code modernization for initializing the console 2014-08-15 18:06:07 +02:00
Lennart Poettering a0627f82e2 util: make is_localhost() check for 'localdomain' too, so that we can use it for both validating domains and host names 2014-08-15 16:04:46 +02:00
Timofey Titovets 5261ba9018 core: Refuse mount on symlink 2014-08-15 01:35:28 +02:00
Lennart Poettering 58d617429d core: move status line ellipsation to 50% of the line
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021591.html
2014-08-14 17:15:09 +02:00
Lennart Poettering 7e8185ef94 fix a couple of more lazy "return -1"
Fix should strictly follow the rule to return negative errno-style
error codes from functions, hence let's fix more "return -1"-style
lazinesses.
2014-08-11 18:35:54 +02:00
Lennart Poettering 0cdfd26ef8 util: avoid considering dpkg temporary files relevant for anything
https://bugs.freedesktop.org/show_bug.cgi?id=82453
2014-08-11 15:32:09 +02:00
Lennart Poettering 5cb36f41f0 resolved: read the system /etc/resolv.conf unless we wrote it ourselves
This way we integrate nicely with foreign network management stacks,
such as NM.
2014-08-01 18:10:01 +02:00
Zbigniew Jędrzejewski-Szmek 1e2fd62d70 core/load-fragment.c: correct argument sign and split up long lines
With everything on one line they are just harder to read.
2014-07-31 08:56:03 -04:00
Zbigniew Jędrzejewski-Szmek b2fadec604 Properly report invalid quoted strings
$ systemd-analyze verify trailing-g.service
[./trailing-g.service:2] Trailing garbage, ignoring.
trailing-g.service lacks ExecStart setting. Refusing.
Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument.
Failed to create trailing-g.service/start: Invalid argument
2014-07-31 08:56:03 -04:00
Zbigniew Jędrzejewski-Szmek a2a5291b3f Reject invalid quoted strings
String which ended in an unfinished quote were accepted, potentially
with bad memory accesses.

Reject anything which ends in a unfished quote, or contains
non-whitespace characters right after the closing quote.

_FOREACH_WORD now returns the invalid character in *state. But this return
value is not checked anywhere yet.

Also, make 'word' and 'state' variables const pointers, and rename 'w'
to 'word' in various places. Things are easier to read if the same name
is used consistently.

mbiebl_> am I correct that something like this doesn't work
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"'
mbiebl_> systemd seems to strip of the quotes
mbiebl_> systemctl status shows
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS  $RootDir $MountPoint
mbiebl_> which is pretty weird
2014-07-31 04:00:31 -04:00
Lennart Poettering b914e211f3 resolved: when resolving an address PTR record via llmnr, make a tcp connection by default 2014-07-29 20:57:58 +02:00
Kay Sievers 3a43da2832 time-util: add and use USEC/NSEC_INFINIY 2014-07-29 13:20:20 +02:00
Ansgar Burchardt 0f625d0b87 parse_boolean: require exact matches
Require exact matches in all cases instead of treating strings
starting with 't' ('f') as true (false).

This is required for config_parse_protect_system to parse ProtectSystem=full
correctly: it uses parse_boolean and only tries a more specific parsing
function if that did not return a valid result. Thus "full" was treated as
"false" before.
2014-07-27 15:15:11 -04:00
Zbigniew Jędrzejewski-Szmek ed88bcfb7c Be more careful when checking for empty files
If we want to avoid reading a totally empty file, it seems better
to check after we have opened the file, not before.
2014-07-16 19:00:03 -04:00
Zbigniew Jędrzejewski-Szmek 1cb1767a29 util: fix has cc check and add test 2014-07-11 09:22:01 -04:00
Lennart Poettering e26807239b firstboot: get rid of firstboot generator again, introduce 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-07 21:05:09 +02:00
Lennart Poettering 45035609fc firstboot: follow lock protocol when changing /etc/shadow 2014-07-07 18:57:09 +02:00
Lennart Poettering 418b9be500 firstboot: add new component to query basic system settings on first boot, 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-07 15:25:55 +02:00
Lennart Poettering 6294aa76d8 util: don't consider tabs special in string_has_cc() anymore
Instead, take a list of exceptions to our usual CC check
2014-07-07 15:25:55 +02:00
Lennart Poettering 3a8a916338 util: consider 0x7F a control chracter (which it is: DEL)
Let's better be safe than sorry.
2014-07-07 15:25:55 +02:00
Lennart Poettering 7f0d207d2c sd-bus: support connecting to remote hosts, directly into containers
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-03 01:17:26 +02:00
Lennart Poettering e0a33e7ba6 util: when unescaping strings, don't allow smuggling in of additional NUL bytes
Better safe than sorry.
2014-07-02 13:45:49 +02:00
Lennart Poettering fecc80c1ba util: generalize is_localhost() and use it everywhere where applicable 2014-07-02 13:41:31 +02:00
Lennart Poettering 9a00f57a5b path: add new "systemd-path" utility for querying paths described in 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-02 12:23:36 +02:00
Kay Sievers f841a154ef parse_uid: return -ENXIO for -1 uids 2014-07-01 16:00:05 +02:00
Luke Shumaker 0659e8baf2 shared/util.c:wait_for_terminate_and_warn(): Add a comment on the return values 2014-06-30 15:13:34 +02:00
Lennart Poettering 6afeb1cfe4 util: fix comment 2014-06-30 12:41:26 +02:00
Lennart Poettering 306a55c863 util: refuse considering UID 0xFFFF and 0xFFFFFFFF valid 2014-06-29 22:27:07 +02:00
Ronny Chevalier e1d758033d use more _cleanup_ macro 2014-06-24 19:09:57 +02:00
Zbigniew Jędrzejewski-Szmek da92ca5eb5 util: treat fuse.sshfs as a network filesystem
https://bugs.freedesktop.org/show_bug.cgi?id=73727
2014-06-20 22:44:01 -04:00
Zbigniew Jędrzejewski-Szmek 0d460faf73 util: do not strip /dev prefix twice 2014-06-20 18:44:39 -04:00
Michael Marineau 375eadd911 shared: fix search_and_fopen with alternate roots
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-20 00:10:47 -04:00
Michael Marineau 7d8da2c964 shared: rename path_strv_canonicalize_absolute functions
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-20 00:10:46 -04:00
Zbigniew Jędrzejewski-Szmek dede0e335d util.c: simplify rm_rf_children_dangerous 2014-06-19 20:08:44 -04:00
Lennart Poettering 1554afae54 tmpfiles: add "+" modifier support to b, c, p lines in addition to L 2014-06-18 00:09:46 +02:00
Lennart Poettering 8f294b45cb install: make sure that --root= mode doesn't make us consider all units outside of search path 2014-06-17 02:43:43 +02:00
Lennart Poettering 2e78fa79bb tmpfiles: add new "L+" command as stronger version of "L", that removes the 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-16 13:21:07 +02:00
Lennart Poettering 45c196a76b tmpfiles: set up selinux label proeprly when creating fifos 2014-06-16 13:20:38 +02:00
Lennart Poettering 1b99214789 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.
2014-06-12 23:07:33 +02:00
Lennart Poettering 849958d1ba tmpfiles: add new "C" line for copying files or directories 2014-06-10 23:02:40 +02:00
Lennart Poettering 13f8b8cbb4 bus-proxy: properly index policy by uid/gid when parsing 2014-06-10 17:56:52 +02:00
Lennart Poettering d6797c920e namespace: beef up read-only bind mount logic
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-06 14:37:40 +02:00
Lennart Poettering 6d313367d9 namespace: when setting up an inaccessible mount point, unmounting everything below
This has the benefit of not triggering any autofs mount points
unnecessarily.
2014-06-05 21:35:35 +02:00
Lennart Poettering 34b42c9694 util: fix fd_cloexec(), fd_nonblock() 2014-06-05 19:38:00 +02:00
Lennart Poettering be8f4e9e8e sd-daemon: introduce sd_pid_notify() and sd_pid_notifyf()
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-05 17:05:18 +02:00
Lennart Poettering 966bff2660 timesyncd: split privilege dropping code out of timesyncd so that we can make use of it from other daemons too
This is preparation to make networkd work as unpriviliged user.
2014-06-01 08:49:33 +02:00
Thomas Hindoe Paaboel Andersen 93f1a06374 util: ignore_file should not allow files ending with '~'
ignore_file currently allows any file ending with '~' while it
seems that the opposite was intended:
a228a22fda
2014-05-31 21:44:34 +02:00
Kay Sievers 359efc59fd core: timer - switch to touch_file() 2014-05-24 11:39:47 +08:00
Kay Sievers c38dfac9ed shared: add touch_file() and let touch() always update timestamp 2014-05-24 07:21:11 +08:00