diff options
-rw-r--r-- | .dir-locals.el | 6 | ||||
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | .mailmap | 21 | ||||
-rw-r--r-- | Makefile-man.am | 5 | ||||
-rw-r--r-- | Makefile.am | 99 | ||||
-rw-r--r-- | NEWS | 137 | ||||
-rw-r--r-- | TODO | 9 | ||||
-rw-r--r-- | cb/elogind.cbp | 9 | ||||
-rw-r--r-- | configure.ac | 40 | ||||
-rw-r--r-- | src/libelogind/sd-bus/test-bus-vtable.c | 81 | ||||
-rw-r--r-- | src/test/test-random-util.c | 65 |
11 files changed, 430 insertions, 52 deletions
diff --git a/.dir-locals.el b/.dir-locals.el index 3e1b2d76c..5ef7e1163 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -20,4 +20,8 @@ (eval . (c-set-offset 'arglist-intro '++)) (eval . (c-set-offset 'arglist-close 0)))) (nxml-mode . ((nxml-child-indent . 2) - (fill-column . 119)))) + (fill-column . 119))) + (meson-mode . ((meson-indent-basic . 8))) + (sh-mode . ((sh-basic-offset . 8) + (sh-indentation . 8))) + (awk-mode . ((c-basic-offset . 8)))) diff --git a/.gitignore b/.gitignore index 6b4d5ced2..7508a427c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ /TAGS /ata_id /bootctl -/build-aux +/build* /busctl /cdrom_id /collect @@ -160,6 +160,8 @@ /test-bus-server /test-bus-signature /test-bus-track +/test-bus-vtable +/test-bus-vtable-cc /test-bus-zero-copy /test-calendarspec /test-cap-list @@ -265,13 +267,16 @@ /test-process-util /test-pty /test-qcow2 +/test-random-util /test-ratelimit /test-replace-var /test-resolve /test-resolve-tables +/test-resolved-packet /test-ring /test-rlimit-util /test-sched-prio +/test-sd-dhcp-lease /test-seccomp /test-selinux /test-set @@ -290,6 +295,7 @@ /test-tables /test-terminal-util /test-time +/test-timesync /test-tmpfiles /test-udev /test-uid-range @@ -355,3 +361,5 @@ patches/ /coccinelle mask_po_files.sh cccc +*.v234 +*.v234.diff @@ -102,3 +102,24 @@ Paolo Giangrandi <paolo@luccalug.it> Karl Kraus <karl.kraus@tum.de> <laqueray@gmail.com> Tibor Nagy <xnagytibor@gmail.com> Stuart McLaren <stuart.mclaren@hp.com> +John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> +John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> <glaubitz@suse.com> +Sjoerd Simons <sjoerd.simons@collabora.co.uk> +Neil Brown <neil@brown.name> +Michal Suchanek <msuchanek@suse.de> <hramrach@gmail.com> +Michal Suchanek <msuchanek@suse.de> +Bastien Nocera <hadess@hadess.net> <hadess@users.noreply.github.com> +Umut Tezduyar Lindskog <umut@tezduyar.com> +Alexander Kurtz <alexander@kurtz.be> +Piotr Szydełko <wiertel@users.sourceforge.net> +Łukasz Stelmach <l.stelmach@samsung.com> <stlman@poczta.fm> +Krzysztof Jackiewicz <k.jackiewicz@samsung.com> <kjackiewicz@users.noreply.github.com> +Marcus Cooper <marcusc@axis.com> <codekipper@gmail.com> +Insun Pyo <insun.pyo@samsung.com> <iplayinsun@gmail.com> +Ted Wood <ted.l.wood@gmail.com> +Ted Wood <ted@mailchimp.com> +Anthony Parsons <flussence@users.noreply.github.com> +Federico Di Pierro <nierro92@gmail.com> +Josef Andersson <josef.andersson@fripost.org> +Josef Andersson <l10nl18nsweja@gmail.com> +Hendrik Westerberg <hendrik@gestorf.com> diff --git a/Makefile-man.am b/Makefile-man.am index b25bb0043..2355ff8a6 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -133,6 +133,7 @@ MANPAGES_ALIAS += \ man/sd_bus_message_append_array_iovec.3 \ man/sd_bus_message_append_array_memfd.3 \ man/sd_bus_message_append_array_space.3 \ + man/sd_bus_message_appendv.3 \ man/sd_bus_negotiate_creds.3 \ man/sd_bus_negotiate_timestamp.3 \ man/sd_bus_open.3 \ @@ -289,6 +290,7 @@ man/sd_bus_error_setf.3: man/sd_bus_error.3 man/sd_bus_message_append_array_iovec.3: man/sd_bus_message_append_array.3 man/sd_bus_message_append_array_memfd.3: man/sd_bus_message_append_array.3 man/sd_bus_message_append_array_space.3: man/sd_bus_message_append_array.3 +man/sd_bus_message_appendv.3: man/sd_bus_message_append.3 man/sd_bus_negotiate_creds.3: man/sd_bus_negotiate_fds.3 man/sd_bus_negotiate_timestamp.3: man/sd_bus_negotiate_fds.3 man/sd_bus_open.3: man/sd_bus_default.3 @@ -591,6 +593,9 @@ man/sd_bus_message_append_array_memfd.html: man/sd_bus_message_append_array.html man/sd_bus_message_append_array_space.html: man/sd_bus_message_append_array.html $(html-alias) +man/sd_bus_message_appendv.html: man/sd_bus_message_append.html + $(html-alias) + man/sd_bus_negotiate_creds.html: man/sd_bus_negotiate_fds.html $(html-alias) diff --git a/Makefile.am b/Makefile.am index f41296b13..029c5ff96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,9 +38,9 @@ SUBDIRS = . po # Keep the test-suite.log .PRECIOUS: $(TEST_SUITE_LOG) Makefile -LIBELOGIND_CURRENT=18 -LIBELOGIND_REVISION=3 -LIBELOGIND_AGE=18 +LIBELOGIND_CURRENT=19 +LIBELOGIND_REVISION=0 +LIBELOGIND_AGE=19 # Dirs of external packages dbuspolicydir=@dbuspolicydir@ @@ -260,9 +260,11 @@ man/index.html: man/elogind.index.html $(AM_V_LN)$(LN_S) -f elogind.index.html $@ if HAVE_PYTHON +if ENABLE_MANPAGES noinst_DATA += \ man/index.html endif +endif CLEANFILES += \ man/index.html @@ -509,7 +511,6 @@ libelogind_shared_la_CFLAGS = \ $(libelogind_journal_internal_la_CFLAGS) \ $(libudev_internal_la_CFLAGS) \ $(ACL_CFLAGS) \ - $(LIBIDN_CFLAGS) \ $(SECCOMP_CFLAGS) \ -fvisibility=default @@ -520,7 +521,6 @@ libelogind_shared_la_LIBADD = \ $(libelogind_internal_la_LIBADD) \ $(UDEV_LIBS) \ $(ACL_LIBS) \ - $(LIBIDN_LIBS) \ $(SECCOMP_LIBS) libelogind_shared_la_LDFLAGS = \ @@ -600,6 +600,7 @@ tests += \ test-list \ test-unaligned \ test-conf-files \ + test-random-util \ test-conf-parser \ test-locale-util \ test-copy \ @@ -640,6 +641,12 @@ test_copy_SOURCES = \ test_copy_LDADD = \ libshared.la +test_random_util_SOURCES = \ + src/test/test-random-util.c + +test_random_util_LDADD = \ + libelogind-shared.la + test_util_SOURCES = \ src/test/test-util.c @@ -751,9 +758,6 @@ test_selinux_LDADD = \ test_sizeof_SOURCES = \ src/test/test-sizeof.c -test_sizeof_LDADD = \ - libelogind-shared.la - BUILT_SOURCES += \ src/test/test-hashmap-ordered.c @@ -972,7 +976,6 @@ noinst_LTLIBRARIES += \ EXTRA_DIST += \ src/libelogind/libelogind.pc.in \ - src/libelogind/sd-bus/DIFFERENCES \ src/libelogind/sd-bus/GVARIANT-SERIALIZATION libelogind_la_SOURCES = @@ -1017,6 +1020,7 @@ tests += \ test-bus-server \ test-bus-match \ test-bus-introspect \ + test-bus-vtable \ test-bus-error \ test-event @@ -1032,6 +1036,12 @@ test_bus_server_SOURCES = \ test_bus_server_LDADD = \ libelogind-shared.la +test_bus_vtable_SOURCES = \ + src/libelogind/sd-bus/test-bus-vtable.c + +test_bus_vtable_LDADD = \ + libelogind-shared.la + test_bus_error_SOURCES = \ src/libelogind/sd-bus/test-bus-error.c @@ -1197,10 +1207,10 @@ test_login_tables_LDADD = \ libelogind-core.la manual_tests += \ - test-login \ test-inhibit tests += \ + test-login \ test-login-tables \ test-login-shared @@ -1284,15 +1294,13 @@ substitutions = \ '|exec_prefix=$(exec_prefix)|' \ '|libdir=$(libdir)|' \ '|includedir=$(includedir)|' \ - '|VERSION=$(VERSION)|' \ '|rootprefix=$(rootprefix)|' \ '|udevlibexecdir=$(udevlibexecdir)|' \ '|KILL=$(KILL)|' \ '|MKDIR_P=$(MKDIR_P)|' \ '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \ '|systemuidmax=$(SYSTEM_UID_MAX)|' \ - '|systemgidmax=$(SYSTEM_GID_MAX)|' \ - '|TTY_GID=$(TTY_GID)|' + '|systemgidmax=$(SYSTEM_GID_MAX)|' SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ @@ -1351,8 +1359,10 @@ if ENABLE_POLKIT nodist_polkitpolicy_DATA = \ $(polkitpolicy_files) polkitrules_DATA = $(polkitrules_files) +if ENABLE_POLKIT_PKLA polkitpkla_DATA = $(polkitpkla_files) endif +endif EXTRA_DIST += \ $(polkitpolicy_in_files) @@ -1375,7 +1385,7 @@ XSLTPROC_FLAGS = \ --stringparam funcsynopsis.style ansi \ --stringparam man.authors.section.enabled 0 \ --stringparam man.copyright.section.enabled 0 \ - --stringparam elogind.version $(VERSION) \ + --stringparam elogind.version $(PACKAGE_VERSION) \ --path '$(builddir)/man:$(srcdir)/man' XSLTPROC_PROCESS_MAN = \ @@ -1465,38 +1475,43 @@ dist: .PHONY: git-tag git-tag: - git tag -s "v$(VERSION)" -m "elogind $(VERSION)" + git tag -s "v$(PACKAGE_VERSION)" -m "elogind $(PACKAGE_VERSION)" .PHONY: git-tar git-tar: - $(AM_V_at)git archive --format=tar --prefix=elogind-$(VERSION)-raw/ HEAD | \ + $(AM_V_at)git archive --format=tar --prefix=elogind-$(PACKAGE_VERSION)-raw/ HEAD | \ (cd /var/tmp/ && tar xf -) - $(AM_V_GEN)(cd /var/tmp && rm -rf elogind-$(VERSION) && $(MKDIR_P) elogind-$(VERSION) && \ - for f in `find elogind-$(VERSION)-raw/ -type f | cut -d '/' -f 2-` ; do \ - $(MKDIR_P) elogind-$(VERSION)/`dirname $$f` ; \ - $(AWK) 'BEGIN { i=0;e=0 } \ - /^#if\s+0.*elogind.*$$/ { i=1;next } \ - /^#else\s*$$/ { \ - { if ( i==1 ) e=1; else print }{next} \ - } \ - /^#endif\s*\/\/\s*0\s*$$/ { \ - { if ( i==1 ) { i=0;e=0 } else print }{next} \ - } \ - /^\s*\/\/\/.*elogind.*$$/{ next } \ - /^\s*\/\/\s*#include.+$$/{ next } \ - { if ( (i==0) || (e==1) ) print }' \ - elogind-$(VERSION)-raw/$$f \ - > elogind-$(VERSION)/$$f ; \ - chmod `stat -c '%a' elogind-$(VERSION)-raw/$$f` \ - elogind-$(VERSION)/$$f ; \ - done ; \ - for l in `find elogind-$(VERSION)-raw/ -type l | cut -d '/' -f 2-` ; do \ - $(MKDIR_P) elogind-$(VERSION)/`dirname $$l` ; \ - cp -P elogind-$(VERSION)-raw/$$l elogind-$(VERSION)/$$l ; \ - done ; \ - tar czf elogind-$(VERSION).tar.gz elogind-$(VERSION) ; \ - rm -rf elogind-$(VERSION) elogind-$(VERSION)-raw) ; \ - $(AM_V_at)mv /var/tmp/elogind-$(VERSION).tar.gz ./ + $(AM_V_GEN)(cd /var/tmp && \ + rm -rf elogind-$(PACKAGE_VERSION) && \ + $(MKDIR_P) elogind-$(PACKAGE_VERSION) && \ + for f in `find elogind-$(PACKAGE_VERSION)-raw/ -type f | \ + cut -d '/' -f 2-` ; do \ + $(MKDIR_P) elogind-$(PACKAGE_VERSION)/`dirname $$f` ; \ + $(AWK) 'BEGIN { i=0;e=0 } \ + /^#if\s+0.*elogind.*$$/ { i=1;next } \ + /^#else\s*$$/ { \ + { if ( i==1 ) e=1; else print }{next} \ + } \ + /^#endif\s*\/\/\s*0\s*$$/ { \ + { if ( i==1 ) { i=0;e=0 } else print }{next} \ + } \ + /^\s*\/\/\/.*elogind.*$$/{ next } \ + /^\s*\/\/\s*#include.+$$/{ next } \ + { if ( (i==0) || (e==1) ) print }' \ + elogind-$(PACKAGE_VERSION)-raw/$$f \ + > elogind-$(PACKAGE_VERSION)/$$f ; \ + chmod `stat -c '%a' elogind-$(PACKAGE_VERSION)-raw/$$f` \ + elogind-$(PACKAGE_VERSION)/$$f ; \ + done ; \ + for l in `find elogind-$(PACKAGE_VERSION)-raw/ -type l | \ + cut -d '/' -f 2-` ; do \ + $(MKDIR_P) elogind-$(PACKAGE_VERSION)/`dirname $$l` ; \ + cp -P elogind-$(PACKAGE_VERSION)-raw/$$l \ + elogind-$(PACKAGE_VERSION)/$$l ; \ + done ; \ + tar czf elogind-$(PACKAGE_VERSION).tar.gz elogind-$(PACKAGE_VERSION) ; \ + rm -rf elogind-$(PACKAGE_VERSION) elogind-$(PACKAGE_VERSION)-raw) ; \ + $(AM_V_at)mv /var/tmp/elogind-$(PACKAGE_VERSION).tar.gz ./ .PHONY: install-tree install-tree: all @@ -1,7 +1,140 @@ systemd System and Service Manager +CHANGES WITH 234: + + * Meson is now supported as build system in addition to Automake. It is + our plan to remove Automake in one of our next releases, so that + Meson becomes our exclusive build system. Hence, please start using + the Meson build system in your downstream packaging. There's plenty + of documentation around how to use Meson, the extremely brief + summary: + + ./autogen.sh && ./configure && make && sudo make install + + becomes: + + meson build && ninja -C build && sudo ninja -C build install + + * Unit files gained support for a new JobRunningTimeoutUSec= setting, + which permits configuring a timeout on the time a job is + running. This is particularly useful for setting timeouts on jobs for + .device units. + + * Unit files gained two new options ConditionUser= and ConditionGroup= + for conditionalizing units based on the identity of the user/group + running a systemd user instance. + + * systemd-networkd now understands a new FlowLabel= setting in the + [VXLAN] section of .network files, as well as a Priority= in + [Bridge], GVRP= + MVRP= + LooseBinding= + ReorderHeader= in [VLAN] + and GatewayOnlink= + IPv6Preference= + Protocol= in [Route]. It also + gained support for configuration of GENEVE links, and IPv6 address + labels. The [Network] section gained the new IPv6ProxyNDP= setting. + + * .link files now understand a new Port= setting. + + * systemd-networkd's DHCP support gained support for DHCP option 119 + (domain search list). + + * systemd-networkd gained support for serving IPv6 address ranges using + the Router Advertisment protocol. The new .network configuration + section [IPv6Prefix] may be used to configure the ranges to + serve. This is implemented based on a new, minimal, native server + implementation of RA. + + * journalctl's --output= switch gained support for a new parameter + "short-iso-precise" for a mode where timestamps are shown as precise + ISO date values. + + * systemd-udevd's "net_id" builtin may now generate stable network + interface names from IBM PowerVM VIO devices as well as ACPI platform + devices. + + * MulticastDNS support in systemd-resolved may now be explicitly + enabled/disabled using the new MulticastDNS= configuration file + option. + + * systemd-resolved may now optionally use libidn2 instead of the libidn + for processing internationalized domain names. Support for libidn2 + should be considered experimental and should not be enabled by + default yet. + + * "machinectl pull-tar" and related call may now do verification of + downloaded images using SUSE-style .sha256 checksum files in addition + to the already existing support for validating using Ubuntu-style + SHA256SUMS files. + + * sd-bus gained support for a new sd_bus_message_appendv() call which + is va_list equivalent of sd_bus_message_append(). + + * sd-boot gained support for validating images using SHIM/MOK. + + * The SMACK code learnt support for "onlycap". + + * systemd-mount --umount is now much smarter in figuring out how to + properly unmount a device given its mount or device path. + + * The code to call libnss_dns as a fallback from libnss_resolve when + the communication with systemd-resolved fails was removed. This + fallback was redundant and interfered with the [!UNAVAIL=return] + suffix. See nss-resolve(8) for the recommended configuration. + + * systemd-logind may now be restarted without losing state. It stores + the file descriptors for devices it manages in the system manager + using the FDSTORE= mechanism. Please note that further changes in + other components may be required to make use of this (for example + Xorg has code to listen for stops of systemd-logind and terminate + itself when logind is stopped or restarted, in order to avoid using + stale file descriptors for graphical devices, which is now + counterproductive and must be reverted in order for restarts of + systemd-logind to be safe. See + https://cgit.freedesktop.org/xorg/xserver/commit/?id=dc48bd653c7e101.) + + * All kernel install plugins are called with the environment variable + KERNEL_INSTALL_MACHINE_ID which is set to the machine ID given by + /etc/machine-id. If the file is missing or empty, the variable is + empty and BOOT_DIR_ABS is the path of a temporary directory which is + removed after all the plugins exit. So, if KERNEL_INSTALL_MACHINE_ID + is empty, all plugins should not put anything in BOOT_DIR_ABS. + + Contributions from: Adrian Heine né Lang, Aggelos Avgerinos, Alexander + Kurtz, Alexandros Frantzis, Alexey Brodkin, Alex Lu, Amir Pakdel, Amir + Yalon, Anchor Cat, Anthony Parsons, Bastien Nocera, Benjamin Gilbert, + Benjamin Robin, Boucman, Charles Plessy, Chris Chiu, Chris Lamb, + Christian Brauner, Christian Hesse, Colin Walters, Daniel Drake, + Danielle Church, Daniel Molkentin, Daniel Rusek, Daniel Wang, Davide + Cavalca, David Herrmann, David Michael, Dax Kelson, Dimitri John + Ledkov, Djalal Harouni, Dušan Kazik, Elias Probst, Evgeny Vereshchagin, + Federico Di Pierro, Felipe Sateler, Felix Zhang, Franck Bui, Gary + Tierney, George McCollister, Giedrius Statkevičius, Hans de Goede, + hecke, Hendrik Westerberg, Hristo Venev, Ian Wienand, Insun Pyo, Ivan + Shapovalov, James Cowgill, James Hemsing, Janne Heß, Jan Synacek, Jason + Reeder, João Paulo Rechi Vita, John Paul Adrian Glaubitz, Jörg + Thalheim, Josef Andersson, Josef Gajdusek, Julian Mehne, Kai Krakow, + Krzysztof Jackiewicz, Lars Karlitski, Lennart Poettering, Lluís Gili, + Lucas Werkmeister, Lukáš Nykrýn, Łukasz Stelmach, Mantas Mikulėnas, + Marcin Bachry, Marcus Cooper, Mark Stosberg, Martin Pitt, Matija Skala, + Matt Clarkson, Matthew Garrett, Matthias Greiner, Matthijs van Duin, + Max Resch, Michael Biebl, Michal Koutný, Michal Sekletar, Michal + Soltys, Michal Suchanek, Mike Gilbert, Nate Clark, Nathaniel R. Lewis, + Neil Brown, Nikolai Kondrashov, Pascal S. de Kloe, Pat Riehecky, Patrik + Flykt, Paul Kocialkowski, Peter Hutterer, Philip Withnall, Piotr + Szydełko, Rafael Fontenelle, Ray Strode, Richard Maw, Roelf Wichertjes, + Ronny Chevalier, Sarang S. Dalal, Sjoerd Simons, slodki, Stefan + Schweter, Susant Sahani, Ted Wood, Thomas Blume, Thomas Haller, Thomas + H. P. Andersen, Timothée Ravier, Tobias Jungel, Tobias Stoeckmann, Tom + Gundersen, Tom Yan, Torstein Husebø, Umut Tezduyar Lindskog, + userwithuid, Vito Caputo, Waldemar Brodkorb, WaLyong Cho, Yu, Li-Yu, + Yusuke Nojima, Yu Watanabe, Zbigniew Jędrzejewski-Szmek, Дамјан + Георгиевски + + — Berlin, 2017-07-12 + CHANGES WITH 233: + * This version requires at least gperf 3.1 for building, 3.0 is not + sufficient. + * The "hybrid" control group mode has been modified to improve compatibility with "legacy" cgroups-v1 setups. Specifically, the "hybrid" setup of /sys/fs/cgroup is now pretty much identical to @@ -348,7 +481,7 @@ CHANGES WITH 233: these NTP servers officially. We still recommend downstreams to properly register an NTP pool with the NTP pool project though. - * coredumpctl gained new new "--reverse" option for printing the list + * coredumpctl gained a new "--reverse" option for printing the list of coredumps in reverse order. * coredumpctl will now show additional information about truncated and @@ -3315,7 +3448,7 @@ CHANGES WITH 216: like Cockpit which register web clients as PAM sessions. * timer units with at least one OnCalendar= setting will now - be started only after timer-sync.target has been + be started only after time-sync.target has been reached. This way they will not elapse before the system clock has been corrected by a local NTP client or similar. This is particular useful on RTC-less embedded @@ -24,6 +24,15 @@ Janitorial Clean-ups: Features: +* Add AddUser= setting to unit files, similar to DynamicUser=1 which however + creates a static, persistent user rather than a dynamic, transient user. We + can leverage code from sysusers.d for this. + +* add some optional flag to ReadWritePaths= and friends, that has the effect + that we create the dir in question when the service is started. Example: + + ReadWritePaths=:/var/lib/foobar + * sort generated hwdb files alphabetically when we import them, so that git diffs remain minimal (in particular: the OUI databases we import are not sorted, and not stable) diff --git a/cb/elogind.cbp b/cb/elogind.cbp index b1171e3e5..818c48570 100644 --- a/cb/elogind.cbp +++ b/cb/elogind.cbp @@ -396,6 +396,9 @@ <Unit filename="../src/libelogind/sd-bus/test-bus-signature.c"> <Option compilerVar="CC" /> </Unit> + <Unit filename="../src/libelogind/sd-bus/test-bus-vtable.c"> + <Option compilerVar="CC" /> + </Unit> <Unit filename="../src/libelogind/sd-daemon/sd-daemon.c"> <Option compilerVar="CC" /> </Unit> @@ -556,6 +559,9 @@ <Option compilerVar="CC" /> </Unit> <Unit filename="../src/shared/tests.h" /> + <Unit filename="../src/shared/udev-util.c"> + <Option compilerVar="CC" /> + </Unit> <Unit filename="../src/shared/udev-util.h" /> <Unit filename="../src/shared/utmp-wtmp.c"> <Option compilerVar="CC" /> @@ -656,6 +662,9 @@ <Unit filename="../src/test/test-process-util.c"> <Option compilerVar="CC" /> </Unit> + <Unit filename="../src/test/test-random-util.c"> + <Option compilerVar="CC" /> + </Unit> <Unit filename="../src/test/test-selinux.c"> <Option compilerVar="CC" /> </Unit> diff --git a/configure.ac b/configure.ac index b4f6bb519..df38297bf 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ AC_PREREQ([2.64]) AC_INIT([elogind], - [233.3], + [234], [https://github.com/elogind/elogind/issues], [elogind], [https://github.com/elogind/elogind]) @@ -378,7 +378,6 @@ AC_CHECK_DECLS([ pivot_root, name_to_handle_at, setns, - getrandom, renameat2, kcmp, keyctl, @@ -393,6 +392,13 @@ AC_CHECK_DECLS([ #include <sched.h> #include <string.h> #include <linux/loop.h> +]]) + +AC_CHECK_DECLS([getrandom], + [AC_DEFINE([USE_SYS_RANDOM_H], [], [sys/random.h is usable])], + [AC_CHECK_DECLS([getrandom], [], [], [[ +#include <sys/random.h> +]])], [[ #include <linux/random.h> ]]) @@ -410,7 +416,8 @@ AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE, IFLA_PHYS_PORT_ID, IFLA_BOND_AD_INFO, IFLA_VLAN_PROTOCOL, - IFLA_VXLAN_REMCSUM_NOPARTIAL, + IFLA_VXLAN_GPE, + IFLA_GENEVE_LABEL, IFLA_IPTUN_ENCAP_DPORT, IFLA_GRE_ENCAP_DPORT, IFLA_BRIDGE_VLAN_INFO, @@ -453,13 +460,27 @@ AC_ARG_WITH([udevbindir], AC_SUBST([udevbindir], [$with_udevbindir]) # ------------------------------------------------------------------------------ +have_glib=no +AC_ARG_ENABLE(glib, AS_HELP_STRING([--disable-glib], [disable usage of glib,gobject,gio in tests])) +AS_IF([test "x$enable_glib" != "xno"], [ + PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0 gio-2.0], + [AC_DEFINE(HAVE_GLIB, 1, [Define if glib,gobject,gio are available]) have_glib=yes], + [have_glib=no]) + AS_IF([test "x$have_glib" = "xno" -a "x$enable_glib" = "xyes"], + [AC_MSG_ERROR([*** glib support requested but libraries not found])])]) + +# ------------------------------------------------------------------------------ have_utmp=yes AC_ARG_ENABLE([utmp], AS_HELP_STRING([--disable-utmp], [disable utmp/wtmp log handling]), AS_CASE("x${enableval}", [xyes], [have_utmp=yes], [xno], [have_utmp=no], AC_MSG_ERROR(bad value ${enableval} for --enable-utmp))) -AS_IF([test "x$have_utmp" = "xyes"], [AC_DEFINE(HAVE_UTMP, 1, [Define if utmp/wtmp support is enabled])]) +AS_IF([test "x$have_utmp" = "xyes"], [ + AC_DEFINE(HAVE_UTMP, 1, [Define if utmp/wtmp support is enabled]) + have_utmp=yes + M4_DEFINES="$M4_DEFINES -DHAVE_UTMP"], + [have_utmp=no]) AM_CONDITIONAL([HAVE_UTMP], [test "x$have_utmp" = "xyes"]) # ------------------------------------------------------------------------------ @@ -668,8 +689,14 @@ AC_ARG_ENABLE(polkit, AS_HELP_STRING([--disable-polkit], [disable PolicyKit supp if test "x$enable_polkit" != "xno"; then AC_DEFINE(ENABLE_POLKIT, 1, [Define if PolicyKit support is to be enabled]) have_polkit=yes + + # also enable support for *.pkla files on old polkit + PKG_CHECK_MODULES(POLKIT, [ polkit-gobject-1 < 0.106 ], + [polkit_pkla=yes], + [polkit_pkla=no]) fi AM_CONDITIONAL(ENABLE_POLKIT, [test "x$have_polkit" = "xyes"]) +AM_CONDITIONAL(ENABLE_POLKIT_PKLA, [test "x$polkit_pkla" = "xyes"]) # ------------------------------------------------------------------------------ AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h valgrind/valgrind.h]) @@ -823,7 +850,7 @@ AC_CONFIG_FILES([ AC_OUTPUT AC_MSG_RESULT([ - $PACKAGE_NAME $VERSION + $PACKAGE_NAME $PACKAGE_VERSION PAM: . . . . . . . . . . . . . . . ${have_pam} SELinux: . . . . . . . . . . . . . ${have_selinux} @@ -831,7 +858,8 @@ AC_MSG_RESULT([ ACL: . . . . . . . . . . . . . . . ${have_acl} default cgroup hierarchy: . . . . ${DEFAULT_HIERARCHY} default KillUserProcesses setting: ${KILL_USER_PROCESSES} - polkit: . . . . . . . . . . . . . ${have_polkit} + polkit: . . . . . . . . . . . . . ${have_polkit} (legacy pkla support: ${polkit_pkla}) + glib: . . . . . . . . . . . . . . ${have_glib} Python: . . . . . . . . . . . . . ${have_python} man pages: . . . . . . . . . . . . ${have_manpages} test coverage: . . . . . . . . . . ${have_coverage} diff --git a/src/libelogind/sd-bus/test-bus-vtable.c b/src/libelogind/sd-bus/test-bus-vtable.c new file mode 100644 index 000000000..fd9ad8121 --- /dev/null +++ b/src/libelogind/sd-bus/test-bus-vtable.c @@ -0,0 +1,81 @@ +#include <stdbool.h> +#include <stddef.h> + +/* We use system assert.h here, because we don't want to keep macro.h and log.h C++ compatible */ +#undef NDEBUG +#include <assert.h> +#include <errno.h> + +#include "sd-bus-vtable.h" + +#define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket" + +struct context { + bool quit; + char *something; + char *automatic_string_property; + uint32_t automatic_integer_property; +}; + +static int handler(sd_bus_message *m, void *userdata, sd_bus_error *error) { + return 1; +} + +static int value_handler(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { + return 1; +} + +static int get_handler(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { + return 1; +} + +static int set_handler(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error) { + return 1; +} + +static const sd_bus_vtable vtable[] = { + SD_BUS_VTABLE_START(0), + SD_BUS_METHOD("AlterSomething", "s", "s", handler, 0), + SD_BUS_METHOD("Exit", "", "", handler, 0), + SD_BUS_METHOD_WITH_OFFSET("AlterSomething2", "s", "s", handler, 200, 0), + SD_BUS_METHOD_WITH_OFFSET("Exit2", "", "", handler, 200, 0), + SD_BUS_PROPERTY("Value", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("Value2", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), + SD_BUS_PROPERTY("Value3", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("Value4", "s", value_handler, 10, 0), + SD_BUS_PROPERTY("AnExplicitProperty", "s", NULL, offsetof(struct context, something), + SD_BUS_VTABLE_PROPERTY_EXPLICIT|SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), + SD_BUS_WRITABLE_PROPERTY("Something", "s", get_handler, set_handler, 0, 0), + SD_BUS_WRITABLE_PROPERTY("AutomaticStringProperty", "s", NULL, NULL, + offsetof(struct context, automatic_string_property), 0), + SD_BUS_WRITABLE_PROPERTY("AutomaticIntegerProperty", "u", NULL, NULL, + offsetof(struct context, automatic_integer_property), 0), + SD_BUS_METHOD("NoOperation", NULL, NULL, NULL, 0), + SD_BUS_SIGNAL("DummySignal", "b", 0), + SD_BUS_SIGNAL("DummySignal2", "so", 0), + SD_BUS_VTABLE_END +}; + +static void test_vtable(void) { + sd_bus *bus = NULL; + struct context c = {}; + int r; + + assert(sd_bus_new(&bus) >= 0); + + assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable", vtable, &c) >= 0); + assert(sd_bus_add_object_vtable(bus, NULL, "/foo", "org.freedesktop.systemd.testVtable2", vtable, &c) >= 0); + + assert(sd_bus_set_address(bus, DEFAULT_BUS_PATH) >= 0); + r = sd_bus_start(bus); + assert(r == 0 || /* success */ + r == -ENOENT /* dbus is inactive */ ); + + sd_bus_unref(bus); +} + +int main(int argc, char **argv) { + test_vtable(); + + return 0; +} diff --git a/src/test/test-random-util.c b/src/test/test-random-util.c new file mode 100644 index 000000000..50f4da270 --- /dev/null +++ b/src/test/test-random-util.c @@ -0,0 +1,65 @@ +/*** + This file is part of systemd. + + Copyright 2017 Zbigniew Jędrzejewski-Szmek + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include "hexdecoct.h" +#include "random-util.h" +#include "log.h" + +static void test_acquire_random_bytes(bool high_quality_required) { + uint8_t buf[16] = {}; + unsigned i; + + log_info("/* %s */", __func__); + + for (i = 1; i < sizeof buf; i++) { + assert_se(acquire_random_bytes(buf, i, high_quality_required) == 0); + if (i + 1 < sizeof buf) + assert_se(buf[i] == 0); + + hexdump(stdout, buf, i); + } +} + +static void test_pseudorandom_bytes(void) { + uint8_t buf[16] = {}; + unsigned i; + + log_info("/* %s */", __func__); + + for (i = 1; i < sizeof buf; i++) { + pseudorandom_bytes(buf, i); + if (i + 1 < sizeof buf) + assert_se(buf[i] == 0); + + hexdump(stdout, buf, i); + } +} + +int main(int argc, char **argv) { + log_set_max_level(LOG_DEBUG); + log_parse_environment(); + log_open(); + + test_acquire_random_bytes(false); + test_acquire_random_bytes(true); + + test_pseudorandom_bytes(); + + return 0; +} |