Commit graph

24671 commits

Author SHA1 Message Date
Lennart Poettering c5962fcff0 update TODO 2016-02-01 22:18:16 +01:00
Lennart Poettering cab2aca3e7 core: fix support for transient resource limit properties
Make sure we can properly process resource limit properties. Specifically, allow transient configuration of both the
soft and hard limit, the same way from the unit files. Previously, only the the hard rlimits could be configured but
they'd implicitly spill into the soft hard rlimits.

This also updates the client-side code to be able to parse hard/soft resource limit specifications. Since we need to
serialize two properties in bus_append_unit_property_assignment() now, the marshalling of the container around it is
now moved into the function itself. This has the benefit of shortening the calling code.

As a side effect this now beefs up the rlimit parser of "systemctl set-property" to understand time and disk sizes
where that's appropriate.
2016-02-01 22:18:16 +01:00
Lennart Poettering fb8a9fc9b5 resolve: work around clang limitation
clang is apparently not smart enough to detect when a switch statement contains case statements for all possible values
of the used type. Work around that.

(And while we are at it, normalize indentation a bit)

Fixes: #2504
2016-02-01 22:18:16 +01:00
Lennart Poettering 1e5b6b4f28 shared: simplify parsing of bus properties a bit
Let's write the property name and value in one call, when that's possible, shorthing our code a bit.
2016-02-01 22:18:16 +01:00
Lennart Poettering 5c1f0be1ef core: when saving timer unit time values, store them in raw µs
Let's simplify things a bit, and make sure we don't lose accuracy.
2016-02-01 22:18:16 +01:00
Lennart Poettering b93ea5d368 core: fix handling of AccuracyUSec and RandomDelayUSec bus properties
Clear up some confusion regarding the USec and Sec suffixes we use. In configuration files we usually use the Sec
suffix, to indicate the implied time unit if none is specified. The respective bus properties however use the USec
property, since they expose 64bit unsigned integers containing time in µs.

Before this patch timer units exposed a bus property AccuracyUSec (which hence is the correct name) but when parsing
transient property data would look for AccuracySec instead (which is incorrect). This patch ensures we look for
AccuracySec correctly, but keeps the code for AccuracyUSec in place for compatibility, but adds a warning to ensure
that apps are updated to use the right property.
2016-02-01 22:18:16 +01:00
Lennart Poettering 99d4f5e5c0 basic: add new rlimit_format() call
This formats a struct rlimit the way rlimit_parse() expects it.
2016-02-01 22:18:16 +01:00
Lennart Poettering cb9712492f gpt-auto: don't log an EIO error if blkid finds something which is not a partition table
Fixes: #2483
2016-02-01 22:18:16 +01:00
Lennart Poettering d0a7c5f692 core: move parsing of rlimits into rlimit-util.[ch]
This way we can reuse it for parsing rlimit settings in "systemctl set-property" and related commands.
2016-02-01 22:18:16 +01:00
Lennart Poettering a483fb59a8 core: store for each unit when the last low-level unit state change took place
This adds a new timestamp field to the Unit struct, storing when the last low-level state change took place, and make
sure this is restored after a daemon reload. This new field is useful to allow restarting of per-state timers exactly
where they originally started.
2016-02-01 22:18:16 +01:00
Lennart Poettering 393003e1de sd-event: permit a USEC_INFINITY timeout as an alternative to a disabling an event source
This should simplify handling of time events in clients and is in-line with the USEC_INFINITY macro we already have.
This way setting a timeout to 0 indicates "elapse immediately", and a timeout of USEC_INFINITY "elapse never".
2016-02-01 22:18:15 +01:00
Lennart Poettering 1bce0ffa66 sd-event: when determining the last allowed time a time event may elapse, deal with overflows 2016-02-01 22:18:15 +01:00
Lennart Poettering 53f555b6f6 util: add usec_add() which adds two usec_t values with overflow handling 2016-02-01 22:18:15 +01:00
Lennart Poettering 011696f762 resolved: rework what ResolveHostname() with family == AF_UNSPEC means
Previously, if a hostanem is resolved with AF_UNSPEC specified, this would be used as indication to resolve both an
AF_INET and an AF_INET6 address. With this change this logic is altered: an AF_INET address is only resolved if there's
actually a routable IPv4 address on the specific interface, and similar an AF_INET6 address is only resolved if there's
a routable IPv6 address. With this in place, it's ensured that the returned data is actually connectable by
applications. This logic mimics glibc's resolver behaviour.

Note that if the client asks explicitly for AF_INET or AF_INET6 it will get what it asked for.

This also simplifies the logic how it is determined whether a specific lookup shall take place on a scope.
Specifically, the checks with dns_scope_good_key() are now moved out of the transaction code and into the query code,
so that we don't even create a transaction object on a specific scope if we cannot execute the resolution on it anyway.
2016-02-01 22:18:15 +01:00
Lennart Poettering 2afcd6902b journal-cat: don't allocate memory for the syslog identifier
Fixes: #2490
2016-02-01 22:18:15 +01:00
Lennart Poettering 7e0cdf8f1f activate: reorder --help text
Make sure the --help and --version options are mentioned first, like in all our other tools.
2016-02-01 22:18:15 +01:00
Lennart Poettering fa994f917d activate: fix memory allocation for execv() parameters
Make sure we construct the full environment block on the heap, so that we can clean things up properly if execv()
fails.
2016-02-01 22:18:15 +01:00
Lennart Poettering b72190e90f Merge pull request #2505 from torstehu/fix-typo4
Fix typos and a small build fix
2016-02-01 22:09:54 +01:00
Torstein Husebø fa9e9f72b9 resolve: Silence build warning, when systemd is built without libidn
HAVE_IDN is not defined when systemd is build without it
2016-02-01 21:10:03 +01:00
Torstein Husebø e94968ba72 resolve: fix typos 2016-02-01 21:08:00 +01:00
Lennart Poettering fd04bba0e8 Merge pull request #2491 from martinpitt/master
tmpfiles: drop /run/lock/lockdev
2016-02-01 18:27:51 +01:00
Martin Pitt 61f32bff61 tmpfiles: drop /run/lock/lockdev
Hardly any software uses that any more, and better locking mechanisms like
flock() have been available for many years.

Also drop the corresponding "lock" group from sysusers.d/basic.conf.in, as
nothing else is using this.
2016-02-01 12:16:24 +01:00
Lennart Poettering f3ade27e68 Merge pull request #2497 from jsynacek/bootoffset-runtime-v4
Expose additional booleans in sd_journal and improve error messages in journalctl
2016-02-01 12:02:53 +01:00
Jan Synacek c34e939909 journalctl: improve error messages when the specified boot is not found 2016-02-01 11:59:33 +01:00
Jan Synacek 0f1a9a830c journalctl: show friendly info when using -b on runtime journal only
Make it clear that specifing boot when there is actually only one has no
effect. This cosmetic patch improves user experience a bit.
2016-02-01 11:59:33 +01:00
Jan Synacek 39fd5b08a7 sd-journal: introduce has_runtime_files and has_persistent_files
Also introduce sd_journal_has_runtime_files() and
sd_journal_has_persistent_files() to the public API. These functions
can be used to easily find out if the open journal files are runtime
and/or persistent.
2016-02-01 11:59:27 +01:00
Lennart Poettering c248c80dfd Merge pull request #2481 from xnox/pretty-ccw
udev: net_id - for ccw bus, shorten the identifier and stip leading z…
2016-02-01 11:39:11 +01:00
Lennart Poettering da21f8743a Merge pull request #2493 from evverx/fix-selinux-checks
Fix selinux check for ReloadUnit
2016-02-01 11:34:56 +01:00
Lennart Poettering a6c5361bb1 Merge pull request #2494 from michaelolbrich/resolved-without-gcrypt
Resolved without gcrypt
2016-02-01 11:05:45 +01:00
Zbigniew Jędrzejewski-Szmek c25bf528a1 Merge pull request #2496 from whot/hwdb-updates
hwdb: add Samsung 305V4A axis resolutions
2016-01-31 22:08:25 -05:00
Peter Hutterer d9a03677a5 hwdb: add Samsung 305V4A axis resolutions
From https://bugzilla.redhat.com/show_bug.cgi?id=1294022
2016-02-01 12:50:43 +10:00
Michael Olbrich 4709152273 resolved: allow building without libgcrypt 2016-01-31 23:54:12 +01:00
Michael Olbrich 421cc89d30 resolved: make dnssec_nsec_test_enclosed() static
It's not used anywhere else.
2016-01-31 23:54:12 +01:00
Michael Olbrich dbf0b8a281 resolved: reorder functions
Preparation to make gcrypt optional.
2016-01-31 23:54:12 +01:00
Evgeny Vereshchagin f596e00f32 core: let's check access before type modification 2016-01-31 14:23:46 +00:00
Evgeny Vereshchagin 94bd732348 core: refactoring: add job_type_to_access_method
remove duplication
2016-01-31 14:23:46 +00:00
Evgeny Vereshchagin 61ea63f1ab core: fix selinux check for reload
Fixes:
-bash-4.3# echo 1 >/sys/fs/selinux/enforce
-bash-4.3# runcon -t systemd_test_start_t systemctl start hola

-bash-4.3# sesearch --allow -s systemd_test_reload_t -c service
Found 1 semantic av rules:
   allow systemd_test_reload_t systemd_unit_file_t : service reload ;

-bash-4.3# runcon -t systemd_test_reload_t systemctl reload hola
Failed to reload hola.service: Access denied
See system logs and 'systemctl status hola.service' for details.

-bash-4.3# journalctl -b | grep -i user_avc | grep reload
USER_AVC pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0
msg='
avc:  denied  { start } for auid=0 uid=0 gid=0 path="/etc/systemd/system/hola.service" cmdline="systemctl reload hola"
scontext=unconfined_u:unconfined_r:systemd_test_reload_t:s0-s0:c0.c1023
tcontext=system_u:object_r:systemd_unit_file_t:s0
tclass=service

See
https://fedoraproject.org/wiki/Features/SELinuxSystemdAccessControl#Documentation
2016-01-31 14:19:15 +00:00
Lennart Poettering 09ce74e196 Merge pull request #2487 from msekletar/bootctl-foreach-dirent
bootctl: replace readdir() loops with FOREACH_DIRENT
2016-01-31 14:57:20 +01:00
Evgeny Vereshchagin 5c7290b195 tests: add test-selinux-checks 2016-01-31 09:02:51 +00:00
Michal Sekletar e41256dcec bootctl: replace readdir() loops with FOREACH_DIRENT 2016-01-31 09:44:53 +01:00
Lennart Poettering dcabda4155 Merge pull request #2469 from keszybz/resolved-2
Resolved 2
2016-01-30 15:04:56 +01:00
Zbigniew Jędrzejewski-Szmek 132bdb0cf8 Merge pull request #2478 from grawity/fix/touch-mode
basic: fix touch() creating files with 07777 mode
2016-01-29 21:19:21 -05:00
Mantas Mikulėnas 06eeacb6fe basic: fix touch() creating files with 07777 mode
mode_t is unsigned, so MODE_INVALID < 0 can never be true.

This fixes a possible DoS where any user could fill /run by writing to
a world-writable /run/systemd/show-status.
2016-01-29 23:41:09 +02:00
Zbigniew Jędrzejewski-Szmek c542f805dd man: reword sentence 2016-01-29 12:24:15 -05:00
Zbigniew Jędrzejewski-Szmek e3309036cd resolved: log server type when switching servers
I'm not defining _DNS_SERVER_TYPE_MAX/INVALID as usual in the enum,
because it wouldn't be used, and then gcc would complain that
various enums don't test for _DNS_SERVER_TYPE_MAX. It seems better
to define the macro rather than add assert_not_reached() in multiple
places.
2016-01-29 12:24:15 -05:00
Zbigniew Jędrzejewski-Szmek a43a068a30 resolved: add macro to compare sized fields
For consistency, generic.size is renamed to generic.data_size.

nsec3.next_hashed_name comparison was missing a size check.
2016-01-29 12:24:14 -05:00
Zbigniew Jędrzejewski-Szmek ba82da3bb5 resolve-host: add option to list protocols 2016-01-29 12:13:08 -05:00
Zbigniew Jędrzejewski-Szmek 869b3b67e3 resolve-host: allow specifying type as TYPEnn
This mirrors the behaviour of host and makes the conversion to and from
string symmetrical.
2016-01-29 12:13:08 -05:00
Zbigniew Jędrzejewski-Szmek f3367a64ca test-tables: ellide boring parts of sparse mappings 2016-01-29 12:13:08 -05:00
Zbigniew Jędrzejewski-Szmek c7472ce088 test-resolve-tables: new "test", useful to print mappings 2016-01-29 12:13:08 -05:00