Commit Graph

2392 Commits

Author SHA1 Message Date
Evgeny Vereshchagin 03ae6f7dee tests: add test for #3171 (#3206) 2016-05-06 23:05:59 +02:00
Lennart Poettering 5119d304ff Merge pull request #3156 from keszybz/duid-settings
Rework DUID setting
2016-05-04 11:31:59 +02:00
Zbigniew Jędrzejewski-Szmek c41aa4b4da test-networkd-conf: add tests for the parsing functions 2016-05-03 12:26:42 -04:00
Evgeny Vereshchagin 0b2abe0f03 tests: add test for #3166 (#3180) 2016-05-03 11:43:22 +02:00
Zbigniew Jędrzejewski-Szmek 8ad54a0182 Merge pull request #3153 from poettering/async-clone
machined: make "clone" asynchronous, and support copy-based fall-back
2016-05-02 13:56:07 -04:00
Lennart Poettering 5659958529 machined: run clone operation asynchronously in the background
Cloning an image can be slow, if the image is not on a btrfs subvolume, hence
let's make sure we do this asynchronously in a child process, so that machined
isn't blocked as long as we process the client request.

This adds a new, generic "Operation" object to machined, that is used to track
these kind of background processes.

This is inspired by the MachineOperation object that already exists to make
copy operations asynchronous. A later patch will rework the MachineOperation
logic to use the generic Operation instead.
2016-05-02 11:15:30 +02:00
Evgeny Vereshchagin 33e40442c6 tests: add test for https://github.com/systemd/systemd/issues/2467 (#3168) 2016-05-02 10:57:19 +02:00
Evgeny Vereshchagin 52c0bed3fb build-sys: add TEST-0[89]-* to dist
Follow-up for 91f9f8f1ba and 4f4d6ee4be
2016-05-01 16:30:53 +00:00
Lennart Poettering 7336138eed nspawn: optionally fix up OS tree uid/gids for userns
This adds a new --private-userns-chown switch that may be used in combination
with --private-userns. If it is passed a recursive chmod() operation is run on
the OS tree, fixing all file owner UID/GIDs to the right ranges. This should
make user namespacing pretty workable, as the OS trees don't need to be
prepared manually anymore.
2016-04-25 12:15:57 +02:00
Lennart Poettering 766cd08152 shared: move output_mode_to_string() into output-mode.c
After all, the enum definition is in output-mode.h
2016-04-22 16:16:59 +02:00
Lennart Poettering 291d565a04 core,systemctl: add bus API to retrieve processes of a unit
This adds a new GetProcesses() bus call to the Unit object which returns an
array consisting of all PIDs, their process names, as well as their full cgroup
paths. This is then used by "systemctl status" to show the per-unit process
tree.

This has the benefit that the client-side no longer needs to access the
cgroupfs directly to show the process tree of a unit. Instead, it now uses this
new API, which means it also works if -H or -M are used correctly, as the
information from the specific host is used, and not the one from the local
system.

Fixes: #2945
2016-04-22 16:06:20 +02:00
Lennart Poettering 52b9b66b7d Merge pull request #3005 from keszybz/kill-user-proceses
Kill user session scope by default
2016-04-21 12:29:36 +02:00
Zbigniew Jędrzejewski-Szmek 95365a576f build-sys: add --without-kill-user-processes configure option 2016-04-21 00:21:32 -04:00
Evgeny Vereshchagin e669a55b2c build-sys: add missing -ldl
Fixes #3035
2016-04-14 00:27:04 +00:00
Lennart Poettering d2120590ff tests: override XDG_RUNTIME_DIR where we use the user runtime dir
We don#t really support systems where XDG_RUNTIME_DIR is not supported for
systemd --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that
involve systemd --user, so that we know it is set, and that it doesn't polute
the user's actual runtime dir.
2016-04-12 13:43:33 +02:00
Lennart Poettering 4c310c073a basic: remove rbtree code, it's unused
it's unused, and should we need it one day we can always resurrect it from git
history.
2016-04-12 13:43:32 +02:00
Lennart Poettering 5de344704d localed: downgrade libxkbcommon to an optional runtime dependency
Previously, libxkbcommon was a compile-time option. When enabled the localed
binary would strictly depend on it, thus pulling in libxkbcommon and its
dependencies, which are non-trivial in size.

With this change we dlopen() libxkbcommon when it is available instead. If the
library is available behaviour is as before. However, if it isn't the system is
considered "headless", i.e. without local hardware and all attempts to set the
local keyboard configuration will be refused.

This is useful for general-purpose distributions which want to support
"headless" (such as container systems) and "full" systems with the same build.
2016-04-12 13:43:31 +02:00
Lennart Poettering 70a399c43a Merge pull request #3014 from msekletar/nspawn-empty-machine-id-v3
nspawn: always setup machine id (v3)
2016-04-11 17:27:11 +02:00
Michal Sekletar e01ff70a77 nspawn: always setup machine id
We check /etc/machine-id of the container and if it is already populated
we use value from there, possibly ignoring value of --uuid option from
the command line. When dealing with R/O image we setup transient machine
id.

Once we determined machine id of the container, we use this value for
registration with systemd-machined and we also export it via
container_uuid environment variable.

As registration with systemd-machined is done by the main nspawn process
we communicate container machine id established by setup_machine_id from
outer child to the main process by unix domain socket. Similarly to PID
of inner child.
2016-04-11 16:43:16 +02:00
Evgeny Vereshchagin 17d6dede6a build-sys: test/sys depends on test/sys.tar.xz
Fixes:
$ ls -ld test/sys
drwxr-xr-x. 12 vagrant vagrant 4096 Jan  6  2012 test/sys

$ git pull
Updating d4337c1..710a885
Fast-forward
 ...
 test/sys.tar.xz                             | Bin 261380 -> 165116 bytes
 test/udev-test.pl                           |  67 ++++++++++++-----

$ sudo make check TESTS=test/udev-test.pl
...
FAIL: test/udev-test.pl

$ rm -r test/sys
$ make test/sys
$ sudo make check TESTS=test/udev-test.pl
...
PASS: test/udev-test.pl
2016-04-08 13:53:03 +00:00
Zbigniew Jędrzejewski-Szmek 56815242ac build-sys: force generation of triggers.systemd file
We don't want to actually install it anywhere, because it
is only usable copied or %included directly into a spec file,
and must be available before %prep is run. But still, it's
useful to generate it automatically so it's easier to copy
and it doesn't go stale.
2016-04-07 14:29:34 -04:00
Martin Pitt f7152c19b9 Merge pull request #2981 from keszybz/test-nss
build-sys: move test-nss to manual_tests
2016-04-07 17:01:12 +02:00
Zbigniew Jędrzejewski-Szmek b7b61747b0 build-sys: move test-nss to manual_tests 2016-04-07 09:02:12 -04:00
Lennart Poettering 056f0498fe Merge pull request #2947 from keszybz/test-nss
Add a test for nss modules and some related fixes
2016-04-06 10:48:55 +02:00
Zbigniew Jędrzejewski-Szmek 2abb5b3b10 test-nss: test the resolution of various names
nss-dns is also "tested". It should be almost always available,
and provides a reference for comparison.
2016-04-05 23:19:56 -04:00
Zbigniew Jędrzejewski-Szmek 1db30aeab1 Merge pull request #2915 from vinaykul/master 2016-03-31 00:52:23 -04:00
Vinay Kulkarni 413708d106 DHCP DUID, IAID configuration options 2016-03-30 16:33:55 -07:00
Zbigniew Jędrzejewski-Szmek ab19c9e457 Merge pull request #2898 from bengal/lldp-api
lldp: move public macros to sd-lldp.h and namespace them
2016-03-29 21:00:58 -04:00
Zbigniew Jędrzejewski-Szmek b68f10bf1f build-sys: fix build with libgrcypt disabled
- Move gcrypt.h include inside grcrypt-util.h.
- Allow gcrypt-util.[ch] to be compiled even without gcrypt.
This allows the logic in files using gcrypt to be simplified.

- Fix compilation of systemd-resolve without gcrypt.
systemd-resolved already supported that.

Fixes #2711.
2016-03-27 21:51:44 -04:00
Beniamino Galvani 6afa676780 lldp: move public macros to sd-lldp.h and namespace them
lldp.h contains definitions of LLDP types, subtypes and capabilities which
should be exposed in public headers. Get rid of the file and move those
definitions to sd-lldp.h with the SD_ prefix.
2016-03-24 16:41:48 +01:00
Daniel Mack 99d91109a6 Merge pull request #2880 from keszybz/more-tests
Add some simple tests for env_value_is_valid and env_assignment_is_valid
2016-03-22 10:23:12 +01:00
Zbigniew Jędrzejewski-Szmek afec45395f Revert "DHCP DUID and IAID configurability" 2016-03-21 18:24:24 -04:00
Zbigniew Jędrzejewski-Szmek 93515caebf tests: rename test-env-replace to test-env-util 2016-03-21 16:17:18 -04:00
Daniel Mack 68de79d6a4 Merge pull request #2760 from ronnychevalier/rc/core_no_new_privileges_seccompv3
core: set NoNewPrivileges for seccomp if we don't have CAP_SYS_ADMIN
2016-03-21 12:57:43 +01:00
Umut Tezduyar Lindskog 2adeb166da journal-upload: remove microhttpd dependency
journal-upload doesn't really need microhttpd to run.
Without the dependency, we can cross compile systemd
without microhttpd and get the uploader part of the
remote logging.

Change-Id: I28dfa5ad2aae94e50de1d32713e1827623c3fd1d
2016-03-18 11:35:37 +01:00
Daniel Mack 5fec580c84 Merge pull request #2839 from keszybz/use-sendfile-smarter
Use sendfile smarter
2016-03-17 20:33:41 +01:00
Zbigniew Jędrzejewski-Szmek 2f368e4a11 basic/missing: move syscall definitions to basic/missing_syscall.h
We have a bunch of syscall wrapper definitions and it's easier to
see that they follow the same pattern if they are not interspersed
with other defines.

Change the wrappers to be uniform:
- if __NR_XXX is not defined, do not bother to call the syscall,
  and return -1/ENOSYS immediately.
- do not check __NR_XXX defines if we detect the symbol as defined,
  since we don't need them anyway
- reindent stuff for readability

New file basic/missing_syscall.h is included at the end of missing.h
because it might make use of some of the definitions in missing.h.
2016-03-17 13:34:34 -04:00
Zbigniew Jędrzejewski-Szmek 7f495b9848 build-sys: add check that our headers are ANSI compatible 2016-03-11 13:33:43 -05:00
Tom Gundersen ead02a14ed Merge pull request #2818 from vinaykul/master
DHCP DUID and IAID configurability
2016-03-10 14:38:42 +01:00
Vinay Kulkarni c83321e6d4 DHCP DUID and IAID configurability 2016-03-09 21:58:44 -08:00
Zbigniew Jędrzejewski-Szmek c41d3b3a0c Merge pull request #2792 from ronnychevalier/rc/tests_movev2
tests: move out unrelated tests from test-util to their own file
2016-03-09 23:53:54 -05:00
Zbigniew Jędrzejewski-Szmek ce1e49c3d6 test-journal-enum: enable by default
It will get at most ten values, I don't know why we wouldn't
always run this test.
2016-03-04 21:45:45 -05:00
Zbigniew Jędrzejewski-Szmek 301a9c67aa test-libudev: disable monitor mode by default and add to automatic tests 2016-03-04 21:45:45 -05:00
Zbigniew Jędrzejewski-Szmek c1ab819162 Enable test-ipcrm, test-hostname in unsafe tests 2016-03-04 21:45:45 -05:00
Zbigniew Jędrzejewski-Szmek 134953c99c Enable test-daemon, test-log, test-watchdog by default
Those should be safe to run, resulting in some messages in logs.
2016-03-04 21:45:45 -05:00
Zbigniew Jędrzejewski-Szmek a4bfedec70 Rename test-boot-timestamp to test-boot-timestamps and enable by default
The source file name and the binary name were mismatched.
Rename binary to match.

Make the test exit with TEST_SKIP if the data is missing or we
have no permissions. Otherwise, the data will be printed, which
should be safe to enable by default.
2016-03-04 21:45:45 -05:00
Zbigniew Jędrzejewski-Szmek f26b57d12a Move test-loopback to normal tests
In the normal case lo should be already configured and this should be
a noop, even when run under root.
2016-03-04 21:45:44 -05:00
Ronny Chevalier ac229ed890 tests: move xattr-util related tests to test-xattr-util.c 2016-03-03 19:04:07 +01:00
Ronny Chevalier 6a4f4a0fa0 tests: move glob-util related tests to test-glob-util.c 2016-03-03 19:04:07 +01:00
Ronny Chevalier ac933e8ec4 tests: move io-util related tests to test-io-util 2016-03-03 19:04:06 +01:00
Ronny Chevalier d376cbb7b0 tests: move proc-cmdline related tests to test-proc-cmdline.c 2016-03-03 19:04:06 +01:00
Ronny Chevalier c270684afd tests: move fs-util related tests to test-fs-util.c 2016-03-03 19:04:06 +01:00
Ronny Chevalier 0999c8ade8 tests: move fd-util related tests to test-fd-util.c 2016-03-03 19:04:06 +01:00
Ronny Chevalier f4c13ad76f tests: move stat-util related tests to test-stat-util.c 2016-03-03 19:04:06 +01:00
Ronny Chevalier 7ba365a9b2 tests: move cpu-set-util related tests to test-cpu-set-util.c 2016-03-03 18:46:58 +01:00
Ronny Chevalier cd3510707a tests: move web-util related tests to test-web-util.c 2016-03-03 18:46:58 +01:00
Ronny Chevalier b66de1f9d4 tests: move alloc related tests to test-alloc-util.c 2016-03-03 18:46:58 +01:00
Ronny Chevalier 45e0b1f68c tests: move escape related tests to test-escape.c 2016-03-03 18:46:58 +01:00
Ronny Chevalier 134714368e tests: move hexdecoct tests to test-hexdecoct.c 2016-03-03 18:46:58 +01:00
Zbigniew Jędrzejewski-Szmek fed527aa5b test-sizeof: add a helper which prints variable sizes and signedness
This helps to understand misleading gcc warnings about type mismatches.
2016-03-02 10:42:27 -05:00
Zbigniew Jędrzejewski-Szmek ada94e69cd test-selinux: add some simple tests which call functions and print the results and timings 2016-03-02 10:42:27 -05:00
Ronny Chevalier 50f130c286 test-execute: add nfsnobody alternative as a nobody user 2016-02-28 15:00:18 +01:00
Ronny Chevalier 19c0b0b9a5 core: set NoNewPrivileges for seccomp if we don't have CAP_SYS_ADMIN
The manpage of seccomp specify that using seccomp with
SECCOMP_SET_MODE_FILTER will return EACCES if the caller do not have
CAP_SYS_ADMIN set, or if the no_new_privileges bit is not set. Hence,
without NoNewPrivilege set, it is impossible to use a SystemCall*
directive with a User directive set in system mode.

Now, NoNewPrivileges is set if we are in user mode, or if we are in
system mode and we don't have CAP_SYS_ADMIN, and SystemCall*
directives are used.
2016-02-28 14:44:26 +01:00
Martin Pitt 6369641d6f clock-util: make clock_is_localtime() testable and add initial tests
Add path argument to clock_is_localtime() and default to "/etc/adjtime" if it's
NULL. This makes the function testable.

Add test-clock: initial test cases for some scenarios, using a temporary file.
This also checks the behaviour with a NULL (i. e. the system's /etc/adjtime)
file.
2016-02-26 11:28:49 +01:00
Martin Pitt 77d9510adc Merge pull request #2719 from evverx/add-test-to-makefile
tests: various fixes
2016-02-24 08:06:53 +01:00
Evgeny Vereshchagin bd3bc54620 tests: add exec-capabilityambientset* to Makefile.am
This is a follow-up to 70d7aea5c
2016-02-23 17:01:12 +00:00
Evgeny Vereshchagin 5a7c1eaedd tests: add exec-runtimedirectory* to Makefile.am
This is a follow-up to cc3ddc851
2016-02-23 17:01:12 +00:00
Evgeny Vereshchagin dcf7860e11 tests: add exec-spec-interpolation.service to Makefile.am
This is a follow-up to 2525499
2016-02-23 17:01:12 +00:00
Daniel Mack 232c84b2d2 Remove systemd-bootchart
This commit rips out systemd-bootchart. It will be given a new home, outside
of the systemd repository. The code itself isn't actually specific to
systemd and can be used without systemd even, so let's put it somewhere
else.
2016-02-23 13:30:09 +01:00
Lennart Poettering 0f9ae7d73d build-sys: move shared/architecture.[ch] into basic/
After all, it is pretty generic, has no external deps besides libc, and is very
similar to virt.[ch] which is also in basic/
2016-02-22 23:23:06 +01:00
Lennart Poettering 13b3cdb91f build-sys: add missing header file to Makefile.am
Fixes: #2700
2016-02-22 21:55:22 +01:00
Lennart Poettering 8e1ad1eaf7 networkd: add basic LLDP transmission support
Let's add some minimalistic LLDP sender support. The idea is that this is
either on or off, and all fields determined automatically rather than
configured explicitly.
2016-02-21 20:58:59 +01:00
Lennart Poettering 34437b4f9c sd-lldp: rework sd-lldp API
This reworks the sd-lldp substantially, simplifying things on one hand, and
extending the logic a bit on the other.

Specifically:

- Besides the sd_lldp object only one other object is maintained now,
  sd_lldp_neighbor. It's used both as storage for literal LLDP packets, and for
  maintainging info about peers in the database. Separation between packet, TLV
  and chassis data is not maintained anymore. This should be a major
  simplification.

- The sd-lldp API has been extended so that a couple of per-neighbor fields may
  be queried directly, without iterating through the object. Other fields that
  may appear multiple times, OTOH have to be iterated through.

- The maximum number of entries in the neighbor database is now configurable
  during runtime.

- The generation of callbacks from sd_lldp objects is more restricted:
  callbacks are only invoked when actual data changed.

- The TTL information is now hooked with a timer event, so that removals from
  the neighbor database due to TTLs now result in a callback event.

- Querying LLDP neighbor database will now return a strictly ordered array, to
  guarantee stability.

- A "capabilities" mask may now be configured, that selects what type of LLDP
  neighbor data is collected. This may be used to restrict collection of LLDP
  info about routers instead of all neighbors. This is now exposed via
  networkd's LLDP= setting.

- sd-lldp's API to serialize the collected data to text files has been removed.
  Instead, there's now an API to extract the raw binary data from LLDP neighbor
  objects, as well as one to convert this raw binary data back to an LLDP
  neighbor object. networkd will save this raw binary data to /run now, and the
  client side can simply parse the information.

- support for parsing the more exotic TLVs has been removed, since we are not
  using that. Instead there are now APIs to extract the raw data from TLVs.
  Given how easy it is to parse the TLVs clients should do so now directly
  instead of relying on our APIs for that.

- A lot of the APIs that parse out LLDP strings have been simplified so that
  they actually return strings, instead of char arrays with a length. To deal
  with possibly dangerous characters the strings are escaped if needed.

- APIs to extract and format the chassis and port IDs as strings has been
  added.

- lldp.h has been simplified a lot. The enums are anonymous now, since they
  were never used as enums, but simply as constants. Most definitions we don't
  actually use ourselves have eben removed.
2016-02-21 20:40:56 +01:00
Lennart Poettering 032b27f534 sd-lldp: drop "port" object
Let's just keep the few parts we actually need of it in the main sd_lldp
object, so that we can simplify things quite a bit.

While we are at it, remove ifname and mac fields which we make no use of
whatsoever.
2016-02-20 22:42:29 +01:00
Martin Pitt e4d86881d5 Merge pull request #2648 from keszybz/dnssec-work
Better support for DANE, shell completion
2016-02-19 07:50:50 +01:00
Zbigniew Jędrzejewski-Szmek e81eb2874e systemd-resolve: initial shell completion
v2:
- use /sys/class/net to list interfaces,
  also copy the same code to systemd-nspawn
v3:
- do not propose "any" twice for --type
2016-02-18 11:50:53 -05:00
Zbigniew Jędrzejewski-Szmek 43a90c32c2 build-sys: remove duplicated entry in tests
test-dns-domain should be built and run even without ENABLE_RESOLVED.
2016-02-18 08:30:18 -05:00
Filipe Brandenburger e49a8dcc29 build-sys: Do not build tests that depend on resolved when it has been disabled
If ./configure --disable-resolved has been used, do not try to build
test-dns-packet and test-resolve-tables which depend on it.

Previously, the SOURCES, LIBS and LDADDs for these tests were made conditional
while the main rules for them weren't, causing build failures trying to build a
binary with no sources.

This was uncovered when trying to build udeb for systemd in CI, which uses
--disable-resolved for a minimal build, which uncovered the issue.

Fixes #2651.
2016-02-18 00:39:38 -08:00
Lennart Poettering 61ecb465b1 resolved: turn on DNSSEC by default, unless configured otherwise
Let's make sure DNSSEC gets more testing, by defaulting DNSSEC to
"allow-downgrade" mode. Since distros should probably not ship DNSSEC enabled
by default add a configure switch to disable this again.

DNSSEC in "allow-downgrade" mode should mostly work without affecting user
experience. There's one exception: some captive portal systems rewrite DNS in
order to redirect HTTP traffic to the captive portal. If these systems
implement DNS servers that are otherwise DNSSEC-capable (which in fact is
pretty unlikely, but still...), then this will result in the captive portal
being inaccessible. To fix this support in NetworkManager (or any other network
management solution that does captive portal detection) is required, which
simply turns off DNSSEC during the captive portal detection, and resets it back
to the default (i.e. on) after captive portal authentication is complete.
2016-02-16 15:22:05 +01:00
Lennart Poettering 8eff97a103 Merge pull request #2618 from zonque/busproxy-removal
remove bus-proxyd
2016-02-15 14:54:09 +01:00
Zbigniew Jędrzejewski-Szmek 7f6e804332 Promote systemd-activate to /usr/bin/systemd-socket-activate
It has fairly wide functionality now and the interface has been
stable for a while. It it a useful testing tool.

The name is changed to better indicate what it does.
2016-02-14 20:33:32 -05:00
Zbigniew Jędrzejewski-Szmek 06e948901a Merge pull request #2603 from poettering/drop-compat-libs
Some spring cleaning
2016-02-13 10:36:02 -05:00
Lennart Poettering 0655ef96fd build-sys: drop aufs-util.[ch]
Left over cruft from the dkr excercise.
2016-02-13 12:03:16 +01:00
Lennart Poettering 2621af5346 util-lib: drop json parser
This was used by the dkr logic, which is gone now, hence remove this too.
Should we need it one day again the git history never forgets...

Note that this only covers the JSON parser. The JSON generator used by
"journalctl -o json" remains, as its much much simpler and requires no
infrastructure except printf() and the most basic escaping.
2016-02-13 11:57:14 +01:00
Lennart Poettering 4de282cf93 build-sys: drop libsystemd-{id128,daemon,login,journal}.so compat libs
They have long been obsolete, and upstream distros and packages have mostly
switched over, let's get rid of it for good.
2016-02-13 11:57:14 +01:00
Lennart Poettering 91ba5ac7d0 Merge pull request #2589 from keszybz/resolve-tool-2
Better support of OPENPGPKEY, CAA, TLSA packets and tests
2016-02-13 11:15:41 +01:00
Zbigniew Jędrzejewski-Szmek 718af59e9a resolve: always align flags to 8th column and print CAA flags
Left-over unknown flags are printed numerically. Otherwise,
it wouldn't be known what bits are remaining without knowning
what the known bits are.

A test case is added to verify the flag printing code:
============== src/resolve/test-data/fake-caa.pkts ==============
google.com. IN CAA   0 issue "symantec.com"
google.com. IN CAA   128 issue "symantec.com"
        -- Flags: critical
google.com. IN CAA   129 issue "symantec.com"
        -- Flags: critical 1
google.com. IN CAA   22 issue "symantec.com"
        -- Flags: 22
2016-02-12 20:00:42 -05:00
Zbigniew Jędrzejewski-Szmek fa45182ed6 Fix hashing of TLSA packets
Also add example files with TLSA and SSHFP records.
2016-02-12 20:00:42 -05:00
Zbigniew Jędrzejewski-Szmek fff85dbe15 test-dns-packet: allow running without arguments 2016-02-12 20:00:42 -05:00
Zbigniew Jędrzejewski-Szmek 6d99904f5a test-dns-packet: add framework to read and dump packets
Packets are stored in a simple format:
<size> <packet-wire-format> <size> <packet-wire-format> ...

Packets for some example domains are dumped, to test rr code for various
record types. Currently:
A
AAAA
CAA
DNSKEY
LOC
MX
NS
NSEC
OPENPGPKEY
SOA
SPF
TXT

The hashing code is executed, but results are not checked.

Also build other tests in src/resolve only with --enable-resolve.
2016-02-12 20:00:42 -05:00
Daniel Mack 798c486fbc remove bus-proxyd
As kdbus won't land in the anticipated way, the bus-proxy is not needed in
its current form. It can be resurrected at any time thanks to the history,
but for now, let's remove it from the sources. If we'll have a similar tool
in the future, it will look quite differently anyway.

Note that stdio-bridge is still available. It was restored from a version
prior to f252ff17, and refactored to make use of the current APIs.
2016-02-12 19:10:01 +01:00
Daniel Mack 9ca6ff50ab Remove kdbus custom endpoint support
This feature will not be used anytime soon, so remove a bit of cruft.

The BusPolicy= config directive will stay around as compat noop.
2016-02-11 22:12:04 +01:00
Lennart Poettering c8b166b3ea Merge pull request #2587 from haraldh/tpmv3
sd-boot: put hashed kernel command line in a PCR of the TPM
2016-02-11 20:38:03 +01:00
Zbigniew Jędrzejewski-Szmek 4ac2ca1bdb systemd-resolve: allow easy querying of openpgp keys
$ systemd-resolve --openpgp zbyszek@fedoraproject.org
d08ee310438ca124a6149ea5cc21b6313b390dce485576eff96f8722._openpgpkey.fedoraproject.org. IN OPENPGPKEY
        mQINBFBHPMsBEACeInGYJCb+7TurKfb6wGyTottCDtiSJB310i37/6ZYoeIay/5soJjlM
        yfMFQ9T2XNT/0LM6gTa0MpC1st9LnzYTMsT6tzRly1D1UbVI6xw0g0vE5y2Cjk3xUwAyn
        ...
2016-02-11 13:12:41 -05:00
Zbigniew Jędrzejewski-Szmek 91e023d896 Move initialize_libgcrypt to separate file
It's annoying to have the exact same function in three places.
It's stored in src/shared, but it's not added to the library to
avoid the dependency on libgcrypt.
2016-02-11 13:12:40 -05:00
Harald Hoyer 92ed3bb49e sd-boot: put hashed kernel command line in a PCR of the TPM
The UEFI BIOS already hashes the contents of the loaded image, so the
initrd and the command line of the binary are recorded.

Because manually added LoadOptions are not taken into account, these
should be recorded also.

This patch logs and extends a TPM PCR register with the LoadOptions.

This feature can be enabled with configure --enable-tpm

The PCR register index can be specified with
configure --with-tpm-pcrindex=<NUM>
2016-02-11 17:48:09 +01:00
Lennart Poettering cf92d86020 build-sys: bump so version 2016-02-11 13:16:39 +01:00
Evgeny Vereshchagin 586bedd41a build-sys: add TEST-06-SELINUX to dist
This is a follow-up to https://github.com/systemd/systemd/pull/2493
2016-02-10 18:20:45 +00:00
Evgeny Vereshchagin 09f6f45a29 tests: add test for https://github.com/systemd/systemd/issues/1981 2016-02-10 18:19:08 +00:00
Lennart Poettering 888e378da2 coredump: dump priviliges when processing system coredumps
Let's add an extra-safety net and change UID/GID to the "systemd-coredump" user when processing coredumps from system
user. For coredumps of normal users we keep the current logic of processing the coredumps from the user id the coredump
was created under.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=87354
2016-02-10 16:09:24 +01:00
Lennart Poettering 3c171f0b1e coredump: rework coredumping logic
This reworks the coredumping logic so that the coredump handler invoked from the kernel only collects runtime data
about the crashed process, and then submits it for processing to a socket-activate coredump service, which extracts a
stacktrace and writes the coredump to disk.

This has a number of benefits: the disk IO and stack trace generation may take a substantial amount of resources, and
hence should better be managed by PID 1, so that resource management applies. This patch uses RuntimeMaxSec=, Nice=, OOMScoreAdjust=
and various sandboxing settings to ensure that the coredump handler doesn't take away unbounded resources from normally
priorized processes.

This logic is also nice since this makes sure the coredump processing and storage is delayed correctly until
/var/systemd/coredump is mounted and writable.

Fixes: #2286
2016-02-10 16:08:32 +01:00
Lennart Poettering f50cd2b2f5 build-sys: move coredump logic into subdir of its own 2016-02-10 14:32:27 +01:00
Daniel Mack 684d3dabef Makefile.am: remove some relicts 2016-02-10 13:27:24 +01:00
Lennart Poettering 14f4532026 Merge pull request #2543 from keszybz/build-sys-and-man-fixes
Build sys and man fixes
2016-02-08 12:52:39 +01:00
Zbigniew Jędrzejewski-Szmek 17163897d4 build-sys: simplify conditionals around shell completion files
Repeating those conditionals for every program is
annoying. Use a helper variable to avoid conditionals.

Also always add generated completion files to CLEANFILES.
2016-02-06 17:54:48 -05:00
Zbigniew Jędrzejewski-Szmek 4c32f2c96b build-sys: move CLEANFILES additions out from under HAVE_GNUEFI
It's better to always include them in 'make clean'.
It is also easier to read Makefile.am when less stuff is conditional.
2016-02-06 17:54:47 -05:00
Lennart Poettering 7732f92bad nspawn: optionally run a stub init process as PID 1
This adds a new switch --as-pid2, which allows running commands as PID 2, while a stub init process is run as PID 1.
This is useful in order to run arbitrary commands in a container, as PID1's semantics are different from all other
processes regarding reaping of unknown children or signal handling.
2016-02-03 23:58:24 +01:00
Lennart Poettering c5c41f1e57 Merge pull request #2510 from msekletar/journalctl-dev-sda-v4
journalctl: make "journalctl /dev/sda" work
2016-02-02 19:34:39 +01:00
Michal Sekletar 795ab08f78 journalctl: make "journalctl /dev/sda" work
Currently when journalctl is called with path to block device node we
add following match _KERNEL_DEVICE=b$MAJOR:$MINOR.

That is not sufficient to actually obtain logs about the disk because
dev_printk() kernel helper puts to /dev/kmsg information about the
device in following format, +$SUBSYSTEM:$ADDRESS,
e.g. "+pci:pci:0000:00:14.0".

Now we will walk upward the syspath and add match for every device in
format produced by dev_printk() as well as match for its device node if
it exists.
2016-02-02 16:46:28 +01:00
Michael Olbrich 4709152273 resolved: allow building without libgcrypt 2016-01-31 23:54:12 +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 c7472ce088 test-resolve-tables: new "test", useful to print mappings 2016-01-29 12:13:08 -05:00
Zbigniew Jędrzejewski-Szmek fc8eec10f6 resolved: calculate and print tags for DNSKEY records 2016-01-29 12:13:06 -05:00
Lennart Poettering 6c38b6c04e build-sys: install systemd-resolve in /usr/bin
The command has a man page now and is public, hence add it to /usr/bin.
2016-01-29 14:45:41 +01:00
Lennart Poettering 0c5eb0562a nss: block various signals while running NSS lookups
Let's make sure our poll() calls don't get interrupted where they shouldn't (SIGALRM, ...), but allow them to be
interrupted where they should (SIGINT, ...).

Fixes #1965
2016-01-27 02:22:58 +01:00
Lennart Poettering 47889a8367 Merge pull request #2446 from keszybz/ask-password
Ask password unicode fix
2016-01-26 23:42:38 +01:00
Zbigniew Jędrzejewski-Szmek 8a1baa3ad1 test-ask-password-api: add a manual test for password reading 2016-01-26 17:07:14 -05:00
Lennart Poettering 0061695507 networkd: use an OrderedSet instead of Set to collect link domains
For the search domain logic the order is highly relevant, hence make sure when collecting the various search domains to
add them to an ordered set, so that the order between search domains of a specific link is retained.
2016-01-26 14:42:03 +01:00
Zbigniew Jędrzejewski-Szmek ce245c842b build-sys: provide fallback value for xsltproc
Commit ab6f56debf made the change to allow building man pages even when disabled
with ./configure --disable-manpages. This works fine, as long as xsltproc is
present. If xsltproc is not present, the command to build a man page (obviously)
fails. Unfortnately it fails with a cryptic message '-o not found', because
$(XSLTPROC) is empty. Add a fallback, to use 'xsltproc' is $(XSLTPROC) is not
defined. This way we get a nice message:

make: xsltproc: Command not found
2016-01-25 19:10:46 -05:00
Lennart Poettering dd0bc0f141 resolved: synthesize RRs for data from /etc/hosts
This way the difference between lookups via NSS and our native bus API should become minimal.
2016-01-25 17:19:19 +01:00
Lennart Poettering b5eb973b39 resolve: rename "systemd-resolve-host" tool to simply "systemd-resolve"
The tool resolves way more than just hosts, hence give it a more generic name. This should be safe, as the tool is
currently undocumented. Before we add documentation for it, let's get the name right.

This also moves the C source into src/resolve/ (from src/resolve-host/), since the old name is a misnomer now. Also,
since it links directly to many of the C files of resolved it really belongs into resolved's directory anyway.
2016-01-25 16:00:28 +01:00
Lennart Poettering 839a4a20d8 resolved: split out RR synthesis logic into its own C file
Also, while we are at it, set the "authenticated" bit for everything we synthesize
2016-01-25 15:59:40 +01:00
Lennart Poettering d90833c93c Merge pull request #2054 from keszybz/nss-link-less-2
Nss link less 2
2016-01-20 17:39:07 +01:00
Tom Gundersen f7e29f72bf Merge pull request #2372 from poettering/dnssec17
resolved bus API improvements
2016-01-20 11:30:20 +01:00
Lennart Poettering 3abaabdab7 resolved: expose bus objects for each Link
The link objects expose as properties the current settings made with SetLinkDNS() and related calls, plus some more
information.
2016-01-19 21:56:54 +01:00
Daniel Mack d619a0c4a5 Merge pull request #2373 from keszybz/man-api-build-3
Man page grammar and build tweaks v3
2016-01-19 20:44:58 +01:00
Zbigniew Jędrzejewski-Szmek ab6f56debf build-sys: allow building man pages even if disabled in ./configure
This is purely for developer convenience: building man pages is slow
so people tend to disable them when not working on documentation. But
sometimes it is useful to build the man page to look something up,
especially when working on an older machine which has outdated
documentation, or to test some change to documentation. The rules to build
man pages are now outside of the ENABLE_MANPAGES conditional, but they
are not used unless manually invoked, and only the inclusion of man
pages in build and install targets is affected by the conditional.

Also, more generated files are removed in clean, which seems to be
good thing, and Makefile.am is simplified.
2016-01-18 16:19:13 -05:00
Lennart Poettering 412577e3c8 resolved: add complex test case
This new test case tries to resolve a couple of known domains, to verify the validation results. It talks to resolved
via the bus, thus comprehensively testing the whole shebang.

Of course, it requires network connectivity and a DNSSEC capable DNS server, hence this is a manual test.
2016-01-17 20:47:46 +01:00
Lennart Poettering 7e48712407 Merge pull request #2131 from evverx/regenerate-m4-on-reconfigure
build-sys: regenerate %.m4 -> % on reconfigure
2016-01-12 20:35:55 +01:00
Lennart Poettering 758dd67e8d basic: split hash functions into their own header files
The hash operations are not really that specific to hashmaps, hence split them into a .c module of their own.
2016-01-11 19:39:59 +01:00
Tom Gundersen 4b4310db94 Merge pull request #2276 from poettering/dnssec12
Twelfth DNSSEC PR
2016-01-07 15:05:58 +01:00
Evgeny Vereshchagin 70fd79177f build-sys: valgrind-tests: exclude python scripts too 2016-01-07 10:01:45 +00:00
Lennart Poettering af49ca27ff resolved,networkd: unify ResolveSupport enum
networkd previously knew an enum "ResolveSupport" for configuring
per-interface LLMNR support, resolved had a similar enum just called
"Support", with the same value and similar pasers.

Unify this, call the enum ResolveSupport, and port both daemons to it.
2016-01-05 17:30:51 +01:00
Evgeny Vereshchagin 4854dc589f build-sys: fix valgrind-tests
Fixes:
```
$ make valgrind-tests TESTS=test-acl-util
  GEN      valgrind-tests
  Running test-acl-util
  /bin/bash: line 4: libtool: command not found
```
2015-12-29 07:44:56 +00:00
Evgeny Vereshchagin 5433c3e1a3 build-sys: fix --disable-tests
Fixes:
$ ./configure ... --disable-tests
$ make
$ sudo make check
FAIL: test/udev-test.pl
PASS: test/rule-syntax-check.py
PASS: test/sysv-generator-test.py
...
2015-12-13 07:50:11 +00:00
Lennart Poettering b43d75c378 importd: drop dkr support
The current code is not compatible with current dkr protocols anyway,
and dkr has a different focus ("microservices") than nspawn anyway
("whole machine containers"), hence drop support for it, we cannot
reasonably keep this up to date, and it creates the impression we'd
actually care for the microservices usecase.
2015-12-10 16:54:41 +01:00
Lennart Poettering 312501458d Merge pull request #2086 from evverx/fix-journal-upload-installation
build: fix systemd-journal-upload installation
2015-12-10 12:05:26 +01:00
Lennart Poettering e4b0e86225 Merge pull request #2056 from evverx/expose-soft-limits-on-the-bus
Expose soft limits on the bus
2015-12-10 11:20:03 +01:00
Evgeny Vereshchagin f39675846a build-sys: regenerate %.m4 -> % on reconfigure
Fixes:
```
$ ./configure ... --enable-resolved
$ make
$ cat tmpfiles.d/etc.conf
...
L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
...
$ ./configure ... --disable-resolved
$ make
$ cat tmpfiles.d/etc.conf
...
L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
...
```
2015-12-10 02:41:08 +00:00
Evgeny Vereshchagin e400d4b3f5 build: fix systemd-journal-upload installation
Fixes:

$ ./configure ... --disable-microhttpd --enable-libcurl
--enable-sysusers
$ make && make install DESTDIR=$(pwd)/INST
$ ls INST/usr/lib/sysusers.d/
basic.conf  systemd.conf

There is no a file with `systemd-journald-upload`
2015-12-09 03:48:56 +00:00
Evgeny Vereshchagin 955c5010c1 build-sys: move "dist" parts out of conditionals
This is a follow-up for commit f47477332f
2015-12-08 21:39:42 +00:00
Tom Gundersen 319c29920c Merge pull request #2115 from dvdhrm/rbtree
basic: add RB-Tree implementation
2015-12-08 17:31:09 +01:00
Daniel Mack bc7702b098 resolved: add infrastructure for mDNS related sockets
Just hook up mDNS listeners with an empty packet dispather function,
introduce a config directive, man page updates etc.
2015-12-08 16:37:40 +01:00
Zbigniew Jędrzejewski-Szmek 2af917de2d Merge pull request #2104 from evverx/rlimit-util-test
tests: add test-rlimit-util
2015-12-07 23:47:45 -05:00
Evgeny Vereshchagin 7118d2f795 build-sys: remove dist-check-python
added: 279419b379
obsoleted: 2c8849add4
2015-12-08 02:33:52 +00:00
David Herrmann a0e4cae820 basic: add RB-Tree implementation
This adds an self-standing RB-Tree implementation to src/basic/. This
will be needed for NSEC RR lookups, since we need "close lookups", which
hashmaps (not even ordered-hashmaps) can give us in reasonable time.
2015-12-07 18:34:05 +01:00
Evgeny Vereshchagin 5414b34c4b tests: disable hard errors
we don't use it
https://www.gnu.org/software/automake/manual/automake.html#Scripts_002dbased-Testsuites
2015-12-07 09:43:43 +00:00
Evgeny Vereshchagin fe39daf2c1 tests: add test-rlimit-util 2015-12-07 09:41:15 +00:00
Evgeny Vereshchagin abd544d576 build-sys: remove unnecessary check
added: 65adc982d
obsoleted: 2c8849add
2015-12-07 07:05:42 +00:00
Lennart Poettering 1fbcad80f0 Merge pull request #2095 from evverx/fix-distcheck-for-disable-timesync
build-sys: move "dist" parts out of conditional
2015-12-06 20:58:11 +01:00
Evgeny Vereshchagin f47477332f build-sys: move "dist" parts out of conditional
Fixes:
$ ./autogen.sh
$ ./configure ... --disable-timesyncd
$ make distcheck
...
make[1]: *** No rule to make target 'src/timesync/timesyncd-gperf.gperf', needed by 'src/timesync/timesyncd-gperf.c'.  Stop.
2015-12-04 06:26:34 +00:00
Lennart Poettering 0d2cd47617 resolved: add a simple trust anchor database as additional RR source
When doing DNSSEC lookups we need to know one or more DS or DNSKEY RRs
as trust anchors to validate lookups. With this change we add a
compiled-in trust anchor database, serving the root DS key as of today,
retrieved from:

https://data.iana.org/root-anchors/root-anchors.xml

The interface is kept generic, so that additional DS or DNSKEY RRs may
be served via the same interface, for example by provisioning them
locally in external files to support "islands" of security.

The trust anchor database becomes the fourth source of RRs we maintain,
besides, the network, the local cache, and the local zone.
2015-12-03 21:17:49 +01:00
Tom Gundersen 5fa3be82e5 Merge pull request #1934 from martinpitt/master
tests: add networkd integration test
2015-12-03 18:22:06 +01:00
Lennart Poettering 2b442ac878 resolved: add basic DNSSEC support
This adds most basic operation for doing DNSSEC validation on the
client side. However, it does not actually add the verification logic to
the resolver. Specifically, this patch only includes:

- Verifying DNSKEY RRs against a DS RRs
- Verifying RRSets against a combination of RRSIG and DNSKEY RRs
- Matching up RRSIG RRs and DNSKEY RRs
- Matching up RR keys and RRSIG RRs
- Calculating the DNSSEC key tag from a DNSKEY RR

All currently used DNSSEC combinations of SHA and RSA are implemented. Support
for MD5 hashing and DSA or EC cyphers are not. MD5 and DSA are probably
obsolete, and shouldn't be added. EC should probably be added
eventually, if it actually is deployed on the Internet.
2015-12-02 22:50:11 +01: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 8c78165d43 nss-resolve: link less
This reduces libraries reported by ldd by liblzma,
liblz4, libgcrypt, libgpg-error, libacl, libidn, libseccomp.
2015-11-27 21:00:44 -05:00
Zbigniew Jędrzejewski-Szmek d6ce77dbc2 nss-mymachines: link less
This reduces libraries reported by ldd by liblzma,
liblz4, libgcrypt, libgpg-error, libacl, libidn, libseccomp.
2015-11-27 21:00:44 -05:00
Zbigniew Jędrzejewski-Szmek b4a4417ca8 nss-myhostname: link less
This reduces libraries reported by ldd by liblzma,
liblz4, libgcrypt, libgpg-error, libacl, libidn, libseccomp.
2015-11-27 20:53:35 -05: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
Lennart Poettering d353a16d1f Merge pull request #1937 from evverx/fix-stdout-parsing
Fix stdout stream parsing
2015-11-27 14:03:49 +01:00
Martin Pitt 4ddb85b18b tests: add networkd integration test
This uses temporary configuration in /run and temporary veth devices, and does
not write anything on disk or change any system configuration; but it assumes
(and checks at the beginning) that networkd is not currently running.

This can be run on a normal installation, in QEMU, nspawn, or LXC.

As this requires root privileges, this is not integrated into "make check".
2015-11-27 11:53:07 +01:00
Lennart Poettering a51c10485a resolved: add a generic DnsSearchDomain concept
With this change, we add a new object to resolved, "DnsSearchDomain="
which wraps a search domain. This is then used to introduce a global
search domain list, in addition to the existing per-link search domain
list which is reword to make use of this new object too.

This is preparation for implement proper unicast DNS search domain
support.
2015-11-25 21:58:38 +01:00
Lennart Poettering f8dc7e343d resolved: split out all code dealing with /etc/resolv.conf into its own .c file
No functional changes.
2015-11-25 21:58:37 +01:00
Daniel Mack 9e6a4d57b6 Merge pull request #1996 from eworm-de/editorconfig
add editorconfig configuration
2015-11-23 18:17:57 +01:00
Christian Hesse db787e7926 add editorconfig configuration
We want indention with spaces, so specify in editorconfig.
http://editorconfig.org/
2015-11-23 12:32:59 +01:00
Evgeny Vereshchagin ceb2840951 build: install bash completion for systemd-path
This is a follow-up for commit e50e53876f
2015-11-21 07:19:12 +00:00
Tom Gundersen c665ffa9b1 Merge pull request #1962 from mbiebl/install-completion-networkctl
build: install bash completion for networkctl
2015-11-20 04:04:24 +01:00
Michael Biebl e7035a4779 build: install bash completion for networkctl
This is a follow-up for commit e4f246b1b5.
2015-11-19 17:41:41 +01:00
David Herrmann dd050decb6 build: bump version numbers
Prepare for v228 release and bump version numbers.
2015-11-18 08:59:06 +01:00
Evgeny Vereshchagin 1c36b4a73b tests: add basic journal test 2015-11-17 23:46:31 +00:00
Lennart Poettering 233f353a22 Merge pull request #1909 from keszybz/filetriggers-v2
Move daemon-reload from package %post scripts to file triggers
2015-11-17 12:30:44 +01:00
Zbigniew Jędrzejewski-Szmek 873e413323 Move daemon-reload from package %post scripts to file triggers
This uses new functionality added in rpm 4.13. Instead of doing
one daemon-reload per packages, we do just one or two
(When both installing and uninstalling packages, we do
two. Unfortunately this also includes the common case of upgrades.
When only installing or when only installing, we do just one.)

New file triggers.systemd can be built, but the contents have
to be copied into the rpm spec file by hand. Using %{load} does
not seem to work. It can serve as documentation.
2015-11-15 18:38:37 -05:00
Kay Sievers eee15abcdb hwdb: update 2015-11-14 09:54:17 +01:00
Lennart Poettering 0ec0deaa30 install: follow unit file symlinks in /usr, but not /etc when looking for [Install] data
Some distributions use alias unit files via symlinks in /usr to cover
for legacy service names. With this change we'll allow "systemctl
enable" on such aliases.

Previously, our rule was that symlinks are user configuration that
"systemctl enable" + "systemctl disable" creates and removes, while unit
files is where the instructions to do so are store. As a result of the
rule we'd never read install information through symlinks, since that
would mix enablement state with installation instructions.

Now, the new rule is that only symlinks inside of /etc are
configuration. Unit files, and symlinks in /usr are now valid for
installation instructions.

This patch is quite a rework of the whole install logic, and makes the
following addional changes:

- Adds a complete test "test-instal-root" that tests the install logic
  pretty comprehensively.

- Never uses canonicalize_file_name(), because that's incompatible with
  operation relative to a specific root directory.

- unit_file_get_state() is reworked to return a proper error, and
  returns the state in a call-by-ref parameter. This cleans up confusion
  between the enum type and errno-like errors.

- The new logic puts a limit on how long to follow unit file symlinks:
  it will do so only for 64 steps at max.

- The InstallContext object's fields are renamed to will_process and
  has_processed (will_install and has_installed) since they are also
  used for deinstallation and all kinds of other operations.

- The root directory is always verified before use.

- install.c is reordered to place the exported functions together.

- Stricter rules are followed when traversing symlinks: the unit suffix
  must say identical, and it's not allowed to link between regular units
  and templated units.

- Various modernizations

- The "invalid" unit file state has been renamed to "bad", in order to
  avoid confusion between UNIT_FILE_INVALID and
  _UNIT_FILE_STATE_INVALID. Given that the state should normally not be
  seen and is not documented this should not be a problematic change.
  The new name is now documented however.

Fixes #1375, #1718, #1706
2015-11-12 17:57:04 +01:00
Michal Sekletar 100582b8cc build-sys: fix dependencies
update-man-list needs man/custom-entities.ent. Bug is nicely reproducible when
running make update-man-list.
2015-11-12 14:07:41 +01:00
Filipe Brandenburger 4c80d201ac test-execute: Add tests for new PassEnvironment= directive
Check the base case, plus erasing the list, listing the same variable
name more than once and when variables are absent from the manager
execution environment.

Confirmed that `sudo ./test-execute` passes and that modifying the test
cases (or the values of the set variables in test-execute.c) is enough
to make the test cases fail.
2015-11-11 07:55:23 -08:00
Zbigniew Jędrzejewski-Szmek 36b4a7ba55 Remove snapshot unit type
Snapshots were never useful or used for anything. Many systemd
developers that I spoke to at systemd.conf2015, didn't even know they
existed, so it is fairly safe to assume that this type can be deleted
without harm.

The fundamental problem with snapshots is that the state of the system
is dynamic, devices come and go, users log in and out, timers fire...
and restoring all units to some state from the past would "undo"
those changes, which isn't really possible.

Tested by creating a snapshot, running the new binary, and checking
that the transition did not cause errors, and the snapshot is gone,
and snapshots cannot be created anymore.

New systemctl says:
Unknown operation snapshot.
Old systemctl says:
Failed to create snapshot: Support for snapshots has been removed.

IgnoreOnSnaphost settings are warned about and ignored:
Support for option IgnoreOnSnapshot= has been removed and it is ignored

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034872.html
2015-11-10 19:33:06 -05:00
Evgeny Vereshchagin 5c404f1ab8 tests: various fixes
* remove journal flushing (systemd-journal-flush.service runs journalctl --flush on boot)
* use sh -c and PATH instead of @SYSTEMCTL@ expansion
* remove unnecessary semicolons etc
2015-11-10 18:01:15 +00:00
Tom Gundersen 0f8980e48b sd-pppoe: drop
It is really unclear if we want to / have the resources to support this fully, so drop it
for now. It can easily be brought back if a killer usecase emerges.

Note that this code was never hooked up, so this does not remove any features.
2015-11-03 16:14:12 +01:00
Lennart Poettering 9fe4ea21be string-util: rework memory_erase() so that it cannot be optimized away
memory_erase() so far just called memset(), which the compiler might
optimize away under certain conditions if it feels there's benefit in
it. C11 knows a new memset_s() call that is like memset(), but may not
be optimized away. Ideally, we'd just use that call, but glibc currently
does not support it. Hence, implement our own simplistic version of it.

We use a GCC pragma to turn off optimization for this call, and also use
the "volatile" keyword on the pointers to ensure that gcc will use the
pointers as-is. According to a variety of internet sources, either one
does the trick. However, there are also reports that at least the
volatile thing isn't fully correct, hence let's add some snake oil and
employ both techniques.

https://news.ycombinator.com/item?id=4711346
2015-11-02 23:07:20 +01:00
Ronny Chevalier aa8e00da54 test-path: move all related test files to a specific directory
To avoid polluting test/
2015-10-31 15:07:19 +01:00
Ronny Chevalier ac40081621 test-execute: move all files related to a specific directory
To avoid polluting test/
2015-10-31 15:07:19 +01:00
Ronny Chevalier 7d0f09a932 build-sys: add missing test files to EXTRA_DIST 2015-10-31 15:07:19 +01:00
Ronny Chevalier a622675862 test-execute: add tests for IOSchedulingClass 2015-10-31 15:07:19 +01:00
Ronny Chevalier c388dfea5a test-execute: add tests for OOMScoreAdjust 2015-10-31 15:07:19 +01:00
Ronny Chevalier 03bd70dd01 test-execute: add test for EnvironmentFile 2015-10-31 15:07:19 +01:00
Ronny Chevalier 63447f1153 test-execute: add test for PrivateNetwork 2015-10-31 15:07:19 +01:00
Filipe Brandenburger bb269eed0e test-parse-util: Move parse-util tests into their own test case
Tests for the functions defined in src/basic/parse-util.c. Reorder them
to match the order in which the functions are defined in the source
file. Adjusted the list of include files to remove the ones no longer
needed in test-util.c.

Tested that `make check` still passes as expected. Also checked the
number of lines removed from test-util.c matches the expected, as an
additional verification that no tests were dropped or duplicated in the
move.
2015-10-28 08:17:10 -07:00
Filipe Brandenburger 23a3c91617 test-extract-word: Move extract-word tests into their own test case
Tests for the functions defined in src/basic/extract-word.c.

Tested that `make check` still passes as expected.
2015-10-28 08:16:00 -07:00
Boyuan Yang e0c7a4e07d l10n: add zh_CN translation. 2015-10-28 16:40:41 +08:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 7d50b32a12 util-lib: split out globbing related calls into glob-util.[ch] 2015-10-27 13:25:58 +01:00
Lennart Poettering 15a5e95075 util-lib: split out printf() helpers to stdio-util.h 2015-10-27 13:25:57 +01:00
Lennart Poettering 49cf4170d0 util-lib: move web-related calls into web-util.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 7ccbd1ae84 util-lib: split out syslog-related calls into syslog-util.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 4e731273ed util-lib: move /proc/cmdline parsing code to proc-cmdline.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 430f0182b7 src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → capability-util.[ch]
The files are named too generically, so that they might conflict with
the upstream project headers. Hence, let's add a "-util" suffix, to
clarify that this are just our utility headers and not any official
upstream headers.
2015-10-27 13:25:57 +01:00
Lennart Poettering affb60b1ef util-lib: split out umask-related code to umask-util.h 2015-10-27 13:25:56 +01:00