1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

23752 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
b3aa622929 lz4: fix size check which had no chance of working on big-endian 2015-12-02 09:50:01 -05:00
Zbigniew Jędrzejewski-Szmek
1d31abf792 tests: fix newlines in skip message 2015-12-02 09:50:01 -05:00
Zbigniew Jędrzejewski-Szmek
8b3aa503c1 tests: turn check if manager cannot be intialized into macro
We need to check the same thing in multiple tests. Use a shared
macro to make it easier to update the list of errnos.

Change the errno code for "unitialized cgroup fs" for ENOMEDIUM.
Exec format error looks like something more serious.

This fixes test-execute invocation in mock.
2015-12-02 09:50:00 -05:00
Zbigniew Jędrzejewski-Szmek
ade61d3b48 basic/virt: add missing includes to compile on ppc64 2015-12-01 22:56:06 -05:00
Tom Gundersen
375f1b0491 Merge pull request #2082 from phomes/basic-sort-includes
basic: re-sort includes
2015-12-02 00:27:02 +01:00
Thomas Hindoe Paaboel Andersen
93cc7779e0 basic: re-sort includes
My previous patch to only include what we use accidentially placed
the added inlcudes in non-sorted order.
2015-12-01 23:40:17 +01:00
Tom Gundersen
c0f1f52317 Merge pull request #2074 from keszybz/test-acl-util-fix
test-acl-util: fix two issues from review
2015-12-01 00:25:47 +01:00
Tom Gundersen
9b86cda0a9 Merge pull request #2075 from phomes/includes-cleanup-basic
basic: include only what we use
2015-12-01 00:25:07 +01:00
Thomas Hindoe Paaboel Andersen
11c3a36649 basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
2015-11-30 21:51:03 +01:00
Zbigniew Jędrzejewski-Szmek
d879fca6bc test-acl-util: fix two issues from review
https://github.com/systemd/systemd/pull/2063
2015-11-30 15:48:21 -05:00
Lennart Poettering
bca27e1729 Merge pull request #2068 from grawity/cgls-error-v2
cgls: add a better error message for missing cgroupfs [v2]
2015-11-30 19:32:19 +01:00
David Herrmann
de418eb91c Merge pull request #2053 from poettering/selinux-fix
Two unrelated fixes
2015-11-30 19:30:03 +01:00
Mantas Mikulėnas
e97a84757f cgls: add a better error message for missing cgroupfs 2015-11-30 19:06:43 +02:00
Lennart Poettering
a00405285e Merge pull request #2063 from keszybz/issue-1977-2
journal: clean up permission setting and acl adjustements on user journals
2015-11-30 17:53:39 +01:00
Zbigniew Jędrzejewski-Szmek
afae249efa tmpfiles: set acls on system.journal explicitly
https://github.com/systemd/systemd/issues/1397
2015-11-29 23:38:09 -05:00
Zbigniew Jędrzejewski-Szmek
57d5b3130c tmpfiles: also set acls on /var/log/journal
This way, directories created later for containers or for
journald-remote, will be readable by adm & wheel groups by default,
similarly to /var/log/journal/%m itself.

https://github.com/systemd/systemd/issues/1971
2015-11-29 18:37:01 -05:00
Ronny Chevalier
3a89c3a0fc Merge pull request #2058 from phomes/unused-variable2
tree-wide: remove unused variables
2015-11-29 15:43:02 +01:00
Thomas Hindoe Paaboel Andersen
ae96c4eb2c tree-wide: remove unused variables 2015-11-29 08:59:40 +01:00
Zbigniew Jędrzejewski-Szmek
6debb39826 acl-util: only set the mask if not present
When we have non-owner user or group entries, we need the mask
for the acl to be valid. But acl_calc_mask() calculates the mask
to include all permissions, even those that were masked before.
Apparently this happens when we inherit *:r-x permissions from
a parent directory — the kernel sets *:r-x, mask:r--, effectively
masking the executable bit. acl_calc_mask() would set the mask:r-x,
effectively enabling the bit. To avoid this, be more conservative when
to add the mask entry: first iterate over all entries, and do nothing
if a mask.

This returns the code closer to J.A.Steffens' original version
in v204-90-g23ad4dd884.

Should fix https://github.com/systemd/systemd/issues/1977.
2015-11-28 18:48:03 -05:00
Zbigniew Jędrzejewski-Szmek
5bb5b236fe test-acl-util: add new test
For now, only add_acls_for_user is tested. When run under root, it
actually sets the acls. When run under non-root, it sets the acls for
the user, which does nothing, but at least calls the functions.
2015-11-28 18:47:34 -05:00
Zbigniew Jędrzejewski-Szmek
5c3bde3fa8 journal: move the gist of server_fix_perms to acl-util.[hc]
Most of the function is moved to acl-util.c to make it possible to
add tests in subsequent commit.

Setting of the mode in server_fix_perms is removed:
- we either just created the file ourselves, and the permission be better right,
- or the file was already there, and we should not modify the permissions.

server_fix_perms is renamed to server_fix_acls to better reflect new
meaning, and made static because it is only used in one file.
2015-11-27 23:32:32 -05:00
Lennart Poettering
20ba6c2ebe libsystemd: make sure we prefix even the dirty secrets in our API with "_sd_"
This renames __useless_struct_to_allow_trailing_semicolon__ everywhere
to _sd_useless_struct_to_allow_trailing_semicolon_, to follow our usual
rule of prefixing stuff from public headers that should be considered
internal with "_sd_".

While we are at it, also to be safe: when the struct is used in the C++
protector macros make sure to use two different names depending on
whether it appears in the C++ or C side of things. After all, there
might be compilers that don't consider C++ and C structs the same.

See https://github.com/systemd/systemd/pull/2052#discussion_r46067059
2015-11-27 20:33:04 +01:00
Lennart Poettering
6355e75610 selinux: split up mac_selinux_have() from mac_selinux_use()
Let's distuingish the cases where our code takes an active role in
selinux management, or just passively reports whatever selinux
properties are set.

mac_selinux_have() now checks whether selinux is around for the passive
stuff, and mac_selinux_use() for the active stuff. The latter checks the
former, plus also checks UID == 0, under the assumption that only when
we run priviliged selinux management really makes sense.

Fixes: #1941
2015-11-27 20:28:13 +01:00
David Herrmann
564c44436c Merge pull request #2052 from poettering/export-cleanup
Make gcc cleanup helper calls public in most of our sd-xyz APIs
2015-11-27 20:26:33 +01:00
Lennart Poettering
e900a84679 Merge pull request #2043 from teg/resolved-edns0-5
resolved: add edns0 support
2015-11-27 19:29:04 +01:00
Lennart Poettering
9ead3519c5 resolved: add one more comment with a link to the matching RFC 2015-11-27 19:23:46 +01:00
Lennart Poettering
6b25959dfa util-lib: move nss-util.h from shared/ to basic/
The header file defines some helpers for GLIBC NSS and doesn't include
anything else but glibc headers, hence there's little reason to keep it
in shared/.

See: #2008
2015-11-27 19:23:29 +01:00
Lennart Poettering
4afd3348c7 tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.

With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.

The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).

This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.

Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:

       #define _cleanup_(function) __attribute__((cleanup(function)))

Or similar, to make the gcc feature easier to use.

Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.

See #2008.
2015-11-27 19:19:36 +01:00
Daniel Mack
f5edf80e29 Merge pull request #2049 from evverx/journal-test-dont-run-on-incomplete-setup
tests: don't run test on incomplete setup; use sync
2015-11-27 15:26:21 +01:00
Evgeny Vereshchagin
e8e5a6e255 tests: use sync instead of flush
flush doesn't sync a journal -> tests sometimes fail
2015-11-27 13:55:23 +00:00
Daniel Mack
23ede49ee2 Merge pull request #2048 from poettering/fork-errno
core:execute: fix fork() fail handling in exec_spawn()
2015-11-27 14:35:56 +01:00
Evgeny Vereshchagin
c7bb28732f tests: don't run test on incomplete setup
This is a follow-up commit for
https://github.com/systemd/systemd/pull/1937

See https://github.com/systemd/systemd/pull/2030
2015-11-27 13:29:51 +00:00
lc85446
74129a1276 core:execute: fix fork() fail handling in exec_spawn()
If pid < 0 after fork(), 0 is always returned because r =
    exec_context_load_environment() has exited successfully.

    This will make the caller of exec_spawn() not able to handle
    the fork() error case and make systemd abort assert() possibly.
2015-11-27 14:15:33 +01:00
Lennart Poettering
59a99b2007 Merge pull request #1833 from utezduyar/drop-warning-on-preset
drop warning if setting preset worked anyways
2015-11-27 14:06:36 +01:00
Lennart Poettering
d353a16d1f Merge pull request #1937 from evverx/fix-stdout-parsing
Fix stdout stream parsing
2015-11-27 14:03:49 +01:00
Lennart Poettering
97839ed6b7 Merge pull request #2017 from haraldh/nobinddevice2
core: Do not bind a mount unit to a device, if it was from mountinfo
2015-11-27 14:02:25 +01:00
Lennart Poettering
2281b56044 Merge pull request #1828 from fbuihuu/set-property-on-inactive-unit
core: allow 'SetUnitProperties()' to run on inactive units too
2015-11-27 14:00:57 +01:00
Lennart Poettering
a8273d1253 Merge pull request #1989 from keszybz/filetriggers-v2
Return of the file triggers
2015-11-27 13:52:43 +01:00
Lennart Poettering
6182e51efa Merge pull request #2040 from keszybz/randomized-delay
core: rename Random* to RandomizedDelay*
2015-11-27 13:48:12 +01:00
Daniel Mack
ab57824597 Merge pull request #2046 from evverx/rlimit-parsing
Fix rlimit parsing
2015-11-27 12:45:04 +01:00
Evgeny Vereshchagin
fdbbadbd0d core: dump rlim_cur too 2015-11-27 11:26:55 +00:00
Evgeny Vereshchagin
0316f2aeeb core: fix rlimit parsing
* refuse limits if soft > hard
* print an actual value instead of (null)

see https://github.com/systemd/systemd/pull/1994#issuecomment-159999123
2015-11-27 11:26:37 +00:00
Daniel Mack
c9ff64f725 Merge pull request #2030 from evverx/dont-run-tests-on-incomplete-setup
tests: don't run tests on incomplete setup
2015-11-27 12:22:12 +01:00
David Herrmann
ff7d5a5c7c Merge pull request #2044 from grawity/patch-1
resolved: fix typo in in_addr_is_localhost()
2015-11-27 10:35:34 +01:00
Martin Pitt
827661914a Merge pull request #2029 from teg/network-fixes
Network fixes
2015-11-27 10:20:18 +01:00
Mantas Mikulėnas
db15affc05 resolved: fix typo in in_addr_is_localhost() 2015-11-27 08:36:37 +02:00
Zbigniew Jędrzejewski-Szmek
e0d8c8015a Merge commit 'pr/2036^^' 2015-11-26 21:24:08 -05:00
Tom Gundersen
d74fb368b1 resolved: announce support for large UDP packets
This is often needed for proper DNSSEC support, and even to handle AAAA records
without falling back to TCP.

If the path between the client and server is fully compliant, this should always
work, however, that is not the case, and overlarge packets will get mysteriously
lost in some cases.

For that reason, we use a similar fallback mechanism as we do for palin EDNS0,
EDNS0+DO, etc.:

The large UDP size feature is different from the other supported feature, as we
cannot simply verify that it works based on receiving a reply (as the server
will usually send us much smaller packets than what we claim to support, so
simply receiving a reply does not mean much).

For that reason, we keep track of the largest UDP packet we ever received, as this
is the smallest known good size (defaulting to the standard 512 bytes). If
announcing the default large size of 4096 fails (in the same way as the other
features), we fall back to the known good size. The same logic of retrying after a
grace-period applies.
2015-11-27 01:35:47 +01:00
Tom Gundersen
7586f4d172 resolved: set the DNSSEC OK (DO) flag
This indicates that we can handle DNSSEC records (per RFC3225), even if
all we do is silently drop them. This feature requires EDNS0 support.

As we do not yet support larger UDP packets, this feature increases the
risk of getting truncated packets.

Similarly to how we fall back to plain UDP if EDNS0 fails, we will fall
back to plain EDNS0 if EDNS0+DO fails (with the same logic of remembering
success and retrying after a grace period after failure).
2015-11-27 01:35:34 +01:00
Tom Gundersen
9c5e12a431 resolved: implement minimal EDNS0 support
This is a minimal implementation of RFC6891. Only default values
are used, so in reality this will be a noop.

EDNS0 support is dependent on the current server's feature level,
so appending the OPT pseudo RR is done when the packet is emitted,
rather than when it is assembled. To handle different feature
levels on retransmission, we strip off the OPT RR again after
sending the packet.

Similarly, to how we fall back to TCP if UDP fails, we fall back
to plain UDP if EDNS0 fails (but if EDNS0 ever succeeded we never
fall back again, and after a timeout we will retry EDNS0).
2015-11-27 01:35:34 +01:00