Commit graph

12942 commits

Author SHA1 Message Date
Lennart Poettering b1b533a060 analyze: trivial code cleanups 2015-10-07 15:45:39 +02:00
Daniel Mack 79bec997c9 Merge pull request #1484 from poettering/ask-pass-kernel-keyring
cache harddisk passwords in the kernel keyring
2015-10-07 15:32:42 +02:00
Lennart Poettering f74431288a Merge pull request #1485 from jsynacek/machine-long-filename-v5
import: hash URL in paths if they are too long
2015-10-07 15:59:51 +03:00
Lennart Poettering 5530caa20b Merge pull request #1487 from michich/fix-env-expansion
Fix env expansion
2015-10-07 15:54:04 +03:00
Michal Schmidt df553b586b basic: fix env expansion for strings leading with two dollar signs
The way to escape a literal dollar sign is to write "$$". But this does
not work right if it's at the beginning of the argument. Fix it.
2015-10-07 14:43:55 +02:00
Michal Schmidt 7d06dad900 core: always let the kernel reap zombies when we're about to freeze
Regardless of whether we're going to spawn a crash shell or not, let the
kernel reap zombies. It's more consistent this way.
2015-10-07 14:25:51 +02:00
Michal Schmidt 4cf0b03b97 core: change how crash_shell and crash_reboot interact
Instead of freezing in PID1 and letting the forked child freeze or
reboot when exec("/bin/sh") fails, just wait for the child's
exit and then do the freeze_or_reboot in PID1 as usual.

This means that when both crash_shell and crash_reboot are enabled, the
system will reboot after the shell exits.
2015-10-07 14:24:49 +02:00
Michal Schmidt 647cb08bc3 core: remove spurious assert in parsing CrashChangeVT=
"data" is always NULL (and unused) in config_parse_crash_chvt().
2015-10-07 14:24:49 +02:00
Jan Synacek 9818005de6 import: hash URL in paths if they are too long
https://bugzilla.redhat.com/show_bug.cgi?id=1266775
2015-10-07 14:06:49 +02:00
Michal Schmidt f7cd3d5fcb core: adjust error message about /etc/mtab
Since having /etc/mtab as a regular file is now a fatal error, stop
mentioning irrelevant minor consequences.
2015-10-07 13:08:05 +02:00
Lennart Poettering e287086b8a ask-password: add support for caching passwords in the kernel keyring
This adds support for caching harddisk passwords in the kernel keyring
if it is available, thus supporting caching without Plymouth being
around.

This is also useful for hooking up "gdm-auto-login" with the collected
boot-time harddisk password, in order to support gnome keyring
passphrase unlocking via the HDD password, if it is the same.

Any passwords added to the kernel keyring this way have a timeout of
2.5min at which time they are purged from the kernel.
2015-10-07 12:26:14 +02:00
Daniel Mack 42911a567d Merge pull request #1481 from again4you/devel/smack_sysuser_#4
smack: label /etc/passwd and friends as '_' smack label when --with-smack-run-label' is enabled (v3)
2015-10-07 11:37:21 +02:00
Daniel Mack 064d3eb5a5 Merge pull request #1478 from steelman/analyze-without-hostnamed-fix
analyze: minor fixes according to review
2015-10-07 11:36:29 +02:00
Daniel Mack dc086b5430 Merge pull request #1483 from reverendhomer/patch-2
service: fix memory leak in service_add_fd_store()
2015-10-07 11:18:27 +02:00
reverendhomer 17dec0f703 service: fix memory leak in service_add_fd_store()
fixes Coverity #1325767
2015-10-07 11:55:31 +03:00
reverendhomer 6fff8ac4a9 strv: fix infinite loop in strv_extend_n()
Fixes Coverity #1325768
2015-10-07 11:52:10 +03:00
Sangjung Woo c02e7b1ecc 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.
2015-10-07 16:37:25 +09:00
Łukasz Stelmach febda62a36 analyze: minor fixes according to review
+ use _cleanup_host_info in acquire_host_info()

+ revert the first strempty() to show "Linux" string in case
  os_pretty_name is missing.
2015-10-07 08:02:31 +02:00
Daniel Mack 69b8a8ebae Merge pull request #1475 from steelman/analyze-without-hostnamed
Analyze without hostnamed [V3]
2015-10-06 18:23:02 +02:00
Łukasz Stelmach caeacefe9f analyze: replace isempty()+ternary with strempty() 2015-10-06 17:56:19 +02:00
Łukasz Stelmach 6cdf0399f3 analyze: do not require information from hostnamed 2015-10-06 17:56:19 +02:00
Łukasz Stelmach 19f462f2de analyze: introduce _cleanup_host_info_ 2015-10-06 17:56:12 +02:00
Tom Gundersen 17010c230e siphash24: coding-style fixes
Drop custom types. Drop unnecessary macros. Fix whitespace. Add asserts.
2015-10-06 17:47:00 +02:00
Tom Gundersen 0cb3c28688 siphash24: unify API
Make the API of the new helpers more similar to the old wrapper.

In particular we now return the hash as a byte string to avoid
any endianness problems.
2015-10-06 17:47:00 +02:00
Lennart Poettering 0084360296 ask-password: various modernizations
Primarily clean-up error logging: log either all or no error messages in
the various functions. Mostly this means the actual password querying
calls no longer will log on their own, but the callers have to do so.

Contains various other fixes too, for example ports some code over to
use the clean-up macro.

Should contain no functional changes.
2015-10-06 16:27:24 +02:00
Lennart Poettering 8c60d978bd Merge pull request #1473 from michich/test-hashmap
test: hashmap - increase number of entries for crippled hash test
2015-10-06 17:18:20 +03:00
Daniel Mack 13af9152bc Merge pull request #1469 from poettering/even-more-fixed
Even more fixes
2015-10-06 14:59:24 +02:00
Michal Schmidt 11de3decc9 test: hashmap - increase number of entries for crippled hash test
The purpose of testing with the crippled hash function is to cover
the otherwise very unlikely codepath in bucket_calculate_dib() where
it has to fall back to recomputing the hash value.

This unlikely path was not covered by test-hashmap anymore after
57217c8f "test: hashmap - cripple the hash function by truncating the
input rather than the output".

Restore the test coverage by increasing the number of entries in the test.
The number was determined empirically by checking with lcov.
2015-10-06 14:56:33 +02:00
Lennart Poettering 20d2f7851a Merge pull request #1465 from teg/siphash24
hashmap/siphash24: refactor hash functions
2015-10-06 14:02:10 +03:00
Lennart Poettering 0a3bb96e2c util: some comment fixes in fdname_is_valid() 2015-10-06 12:33:14 +02:00
Lennart Poettering 5b70037083 strv: properly return ENOMEM where we should in strv_extend_n() 2015-10-06 12:32:50 +02:00
Lennart Poettering 163c76c930 activate: validate fdname when accepting it 2015-10-06 12:32:31 +02:00
Tom Gundersen e1719ef19d Merge pull request #1468 from poettering/fdnames
Add support for naming fds for socket activation and more
2015-10-06 12:06:56 +02:00
Tom Gundersen f0990739fc Merge pull request #1467 from jacob-keller/master
networkd: document ability to disable MACAddressPolicy
2015-10-06 11:58:52 +02:00
Tom Gundersen 3d366432c1 Merge pull request #1466 from kaysievers/wip
libsystemd: sd-device - translate / vs. ! in sysname
2015-10-06 11:57:53 +02:00
Lennart Poettering 8dd4c05b54 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.
2015-10-06 11:52:48 +02:00
Daniel Mack 6c8fe33031 Merge pull request #1452 from poettering/journal-vacuum
A variety of journal vacuuming improvements, plus an nspawn fix
2015-10-06 11:02:04 +02:00
Lennart Poettering 79c7626d1f core: simplify fd collection code, return number of fds as return value
Let's simplify the fd collection code a bit, and return the number of
collected fds as positive integer, the way it's customary in our usual
code.
2015-10-06 09:41:02 +02:00
Lennart Poettering 6ec4ed645e socket: don't double close the same fd for FIFOs 2015-10-06 09:41:02 +02:00
Lennart Poettering 42225ff62f gpt-auto-generator: fix duplicate backing partition check
We shouldn't exit the loop early, otherwise our duplicate backing
partition check won't work.
2015-10-06 09:41:02 +02:00
Jacob Keller 66d3752e81 document ability to disable MACAddressPolicy
While it is currently possible to either not set MACAddressPolicy or set
it to a value different from "persistent" or "random", it is not obvious
that a user can do so. Add a policy, "none", which simply retains kernel
MAC addresses (same as not filling in the policy at all) and document it
so that users are aware of this setting.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
2015-10-05 15:55:25 -07:00
Kay Sievers a9ec9f2942 libsystemd: sd-device - translate / vs. ! in sysname
The kernel replaces '/' in device names with '!', we translate that back
to '/' in sysname, when taking sysname as input, we should translate it
back again.
2015-10-06 00:41:32 +02:00
Tom Gundersen 8c1ba93e2a Merge pull request #1406 from blaskovic/journal-remote-typo
journal-remote: typo in log_error when no sources are specified

[tomegun: this was a pun, but let's not do that]
2015-10-05 23:24:09 +02:00
Tom Gundersen e78a29abfe Merge pull request #1448 from bengal/lldp-export-v5
LLDP: add API to export neighbors list (v5)
2015-10-05 23:16:43 +02:00
Tom Gundersen dc545f8331 Merge pull request #1459 from ssahani/bridge1
networkd: add bridge properties
2015-10-05 22:44:38 +02:00
Tom Gundersen 2b22ffaf60 Merge pull request #1372 from jemk/prefsrc
networkd: add support to configure preferred source of static routes
2015-10-05 22:42:44 +02:00
Tom Gundersen 1e2527a6fe hashmap: hash_funcs - make inputs unambiguous
Make sure all variable-length inputs are properly terminated or that
their length is encoded in some way. This avoids ambiguity of
adjacent inputs.

E.g., in case of a hash function taking two strings, compressing "ab"
followed by "c" is now distinct from "a" followed by "bc".
2015-10-05 19:21:02 +02:00
Tom Gundersen b826ab586c hashmap: refactor hash_func
All our hash functions are based on siphash24(), factor out
siphash_init() and siphash24_finalize() and pass the siphash
state to the hash functions rather than the hash key.

This simplifies the hash functions, and in particular makes
composition simpler as calling siphash24_compress() repeatedly
on separate chunks of input has the same effect as first
concatenating the input and then calling siphash23_compress()
on the result.
2015-10-05 18:22:10 +02:00
Tom Gundersen 57217c8f2a test: hashmap - cripple the hash function by truncating the input rather than the output
The reason for the crippled hash function is to reduce the distribution
of the hash function, do this by truncating the domain rather than the
range. This does introduce a change in behavoir as the range is no longer
contiguous, which greatly reduces collisions.

This is needed as a follow-up patch will no longer allow individual hash
functions to alter the output directly.
2015-10-05 18:19:18 +02:00
Tom Gundersen 1283d70417 test: siphash24 - verify internal state and composability
Verify the state of the hash-function according to the reference paper,
also verify that we can decompose the input and hash the chunks one
by one and still get the same result.
2015-10-05 17:33:58 +02:00