1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 15:21:37 +03:00
Commit Graph

23915 Commits

Author SHA1 Message Date
Lennart Poettering
5449f1e331 Merge pull request #2073 from poettering/dns-label-fixes
Dns label fixes + unrelated selinux clean-up
2015-12-02 20:16:23 +01:00
Lennart Poettering
1eb30a4c5c Merge pull request #2084 from keszybz/ppc64-fixes-2
Test fixes to run in ppc64 mock
2015-12-02 20:15:34 +01:00
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
Zbigniew Jędrzejewski-Szmek
e43cec8e05 core: do not warn about Wants depencencies on masked units
When masking is used to prevent a unit from being loaded,
every transaction with dependent units would generate a warning.
Downgrade this warning to debug level.

transaction_add_job_and_dependencies only generated a few return
values found in the table in bus_common_errors.c, and EADDRNOTAVAIL
is not one of them, so do not try to suppress EADDRNOTAVAIL.

https://bugzilla.redhat.com/show_bug.cgi?id=1278264
2015-11-30 21:00:04 -05: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
Evgeny Vereshchagin
3c11da9d80 core: dump soft limits too 2015-11-30 21:29:39 +00:00
Evgeny Vereshchagin
147f6858ab core: expose soft limits on the bus
This is a follow-up for https://github.com/systemd/systemd/pull/1994

See https://github.com/systemd/systemd/pull/1994#issuecomment-160087219
2015-11-30 21:28:16 +00: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
6344f3e28d core: simplify selinux AVC initialization
Let's merge access_init() and mac_selinux_access_init(), and only call
mac_selinux_use() once, inside the merged function, instead of multiple
times, including in the caller.

See comments on:

https://github.com/systemd/systemd/pull/2053
2015-11-30 20:26:03 +01:00
Lennart Poettering
37ade12837 dns-domain: change error codes when dealing with too short buffers to ENOBUFS
Some calls used ENOBUFS to indicate too-short result buffers, others
used ENOSPC. Let's unify this on ENOBUFS.
2015-11-30 19:42:35 +01:00
Lennart Poettering
50dee79bfb dns-domain: check resulting domain name length in dns_name_to_wire_format()
Let's better be safe than sorry.
2015-11-30 19:42:35 +01:00
Lennart Poettering
c6cefd13eb dns-domain: make sure dns_name_to_wire_format() may properly encode the root domain
The root domain consists of zero labels, and we should be able to encode
that.
2015-11-30 19:42:35 +01:00
Lennart Poettering
1dfbf0007a dns-domain: don't accept overly long hostnames
Make sure dns_name_normalize(), dns_name_concat(), dns_name_is_valid()
do not accept/generate invalidly long hostnames, i.e. longer than 253
characters.
2015-11-30 19:42:35 +01:00
Lennart Poettering
3b37fa7352 dns-domain: be more strict when encoding/decoding labels
Labels of zero length are not OK, refuse them early on. The concept of a
"zero-length label" doesn't exist, a zero-length full domain name
however does (representing the root domain). See RFC 2181, Section 11.
2015-11-30 19:37:41 +01: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
Evgeny Vereshchagin
68a8f17775 tests: add basic rlimits test 2015-11-28 16:47:56 +00: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