chiark / gitweb /
4 years agotree-wide: make more code use safe_close()
Lennart Poettering [Tue, 8 Sep 2015 16:53:19 +0000 (18:53 +0200)]
tree-wide: make more code use safe_close()

Replace this:

        fd = -1;

write this:

        fd = safe_close(fd);

4 years agosd_pid_notify_with_fds: fix computing msg_controllen
Maciej Wereski [Tue, 8 Sep 2015 13:36:30 +0000 (15:36 +0200)]
sd_pid_notify_with_fds: fix computing msg_controllen

CMSG_SPACE(0) may return value other than 0. This caused sendmsg to fail
with EINVAL, when have_pid or n_fds was 0.

4 years agosmack: bugfix the smack label of symlink when '--with-smack-run-label' is set
Sangjung Woo [Tue, 8 Sep 2015 06:09:40 +0000 (15:09 +0900)]
smack: bugfix the smack label of symlink when '--with-smack-run-label' is set

Even though elogind has its own smack label since
'--with-smack-run-label' configuration is set, the smack label of each
CGROUP root directory should have the star (i.e. *) label. This is
mainly because current Linux Kernel set the label in this way.
(Refer to smack_d_instantiate() in security/smack/smack_lsm.c)

However, if elogind has its own smack label and arg_join_controllers is
explicitly set or initialized by initialize_join_controllers() function,
current elogind creates the symlink in CGROUP root directory with its
own smack label as below.

lrwxrwxrwx. 1 root root System  11 Dec 31 16:00 cpu -> cpu,cpuacct
dr-xr-xr-x. 4 root root *        0 Dec 31 16:01 cpu,cpuacct
lrwxrwxrwx. 1 root root System  11 Dec 31 16:00 cpuacct -> cpu,cpuacct

This patch fixes that bug by copying the smack label from the origin.

4 years agosmack: introduce new mac_smack_copy() function
Sangjung Woo [Tue, 8 Sep 2015 05:58:22 +0000 (14:58 +0900)]
smack: introduce new mac_smack_copy() function

This adds a new mac_smack_copy() function in order to read the smack
label from the source and apply it to the destination.

4 years agosd-daemon: fix sd_is_mq for non-mq fds
Zbigniew Jędrzejewski-Szmek [Sat, 5 Sep 2015 13:20:15 +0000 (15:20 +0200)]
sd-daemon: fix sd_is_mq for non-mq fds

mq_getattr returns -1/EBADF for file descriptors which are not mq.
But we should return 0 in this case.

We first check that fd is a valid fd, so we can assume that if
mq_getattr returns EBADF, it is simply a non-mq fd. There is a slight
race, but there doesn't seem to be a nice way to fix it.

4 years agosd-login: rework error handling
Lennart Poettering [Fri, 4 Sep 2015 07:05:52 +0000 (09:05 +0200)]
sd-login: rework error handling

Makre sure we always return sensible errors for the various, following
the same rules, and document them in a comment in sd-login.c. Also,
update all relevant man pages accordingly.

4 years agologind: Listen to WMI hotkeys to catch SW_DOCK state/events
Martin Pitt [Tue, 1 Sep 2015 08:51:15 +0000 (10:51 +0200)]
logind: Listen to WMI hotkeys to catch SW_DOCK state/events

On Dell and HP laptops the dock state/events (SW_DOCK) come from the "{Dell,HP}
WMI hotkeys" input devices. Tag them as power-switch so that login actually
considers them. Use a general match in case this affects other vendors, too.

Thanks to Andreas Schultz for debugging this!

4 years agosd-login: improve error handling
Lennart Poettering [Mon, 31 Aug 2015 22:40:20 +0000 (00:40 +0200)]
sd-login: improve error handling

let's return ENXIO whenever we don't know something rather than ENOENT.

ENOENT suggests this was really about a file or directory, while ENXIO
is a more generic "not found" indicator.

4 years agopager: set $LESSCHARSET when we output UTF8 chars
Lennart Poettering [Fri, 28 Aug 2015 16:17:14 +0000 (18:17 +0200)]
pager: set $LESSCHARSET when we output UTF8 chars

This way we can be sure that less has the same idea of the terminal as
we do.

This solves issues in systems that have locale uninitalized, where
elogind would output UTF-8 but less wouldn't allow it and show them as
control characters.

4 years agopager: also redirect stderr
Lennart Poettering [Thu, 27 Aug 2015 22:13:34 +0000 (00:13 +0200)]
pager: also redirect stderr

It's really confusing if stdout goes to the pager, but stderr is written
directly to the screen. Hence, make sure both stdout and stderr are
passed to the pager when doing autopaging.

4 years agologind: add standard gpio power button support
Kefeng Wang [Mon, 3 Aug 2015 01:55:07 +0000 (09:55 +0800)]
logind: add standard gpio power button support

Many boards like hisilicon D02 board use standard gpio key to power down system.
A description of gpio-key in dts shown below,

gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;

pwrbutton {
label = "Power Button";
gpios = <&porta 8 1>;
linux,code = <116>;  // KEY_POWER, used by SC System Power Down

-bash-4.3# udevadm info -a /dev/input/event3

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/gpio_keys/input/input3/event3':

  looking at parent device '/devices/platform/gpio_keys/input/input3':

  looking at parent device '/devices/platform/gpio_keys':

  looking at parent device '/devices/platform':

4 years agoVersion bump to v226.5 v226.5
Sven Eden [Wed, 29 Mar 2017 08:33:45 +0000 (10:33 +0200)]
Version bump to v226.5

5 years agoinclude sys/sysmacros.h in more places
Mike Frysinger [Mon, 14 Mar 2016 21:44:49 +0000 (17:44 -0400)]
include sys/sysmacros.h in more places

    Since glibc is moving away from implicitly including sys/sysmacros.h
    all the time via sys/types.h, include the header directly in more
    places.  This seems to cover most makedev/major/minor usage.

4 years agoVersion bump to 226.4 v226.4
Sven Eden [Tue, 21 Mar 2017 07:49:30 +0000 (08:49 +0100)]
Version bump to 226.4

4 years agoMerge pull request #3 from elogind/dev_v226-r1
Sven Eden [Tue, 21 Mar 2017 07:44:38 +0000 (08:44 +0100)]
Merge pull request #3 from elogind/dev_v226-r1

Full upgrade path via upstream to v226

4 years agobasic/musl_missing.h : __compar_fn_t was defined twice - fixed.
Sven Eden [Fri, 17 Mar 2017 15:37:52 +0000 (16:37 +0100)]
basic/musl_missing.h : __compar_fn_t was defined twice - fixed.

4 years agoVersion bump to 226.3
Sven Eden [Tue, 14 Mar 2017 11:13:14 +0000 (12:13 +0100)]
Version bump to 226.3

Sven Eden [Tue, 14 Mar 2017 10:56:01 +0000 (11:56 +0100)]

Although it is nice to have it read ELOGIND instead of SYSTEMD, all
diffs just show too many irrelevant (false) positives.

4 years agoMajor cleanup of all leftovers after rebasing on master.
Sven Eden [Tue, 14 Mar 2017 10:30:17 +0000 (11:30 +0100)]
Major cleanup of all leftovers after rebasing on 

The patching of elogind in several steps with only partly rebasing on
a common commit with upstream, left the tree in a state, that was
unmergeable with master. By rebasing on master and manually cleaning
up all commits, this merge is now possible.
However, this process left some orphans, that are cleanup now.

4 years agoUnifiy free() usage
Sven Eden [Mon, 13 Mar 2017 08:20:24 +0000 (09:20 +0100)]
Unifiy free() usage

This commit substitutes all occurrences of
        foo = NULL;
        foo = mfree(foo);

4 years agoFix bug that program_invocation_name is NULL when backgrounding
Sven Eden [Sun, 12 Mar 2017 11:34:34 +0000 (12:34 +0100)]
Fix bug that program_invocation_name is NULL when backgrounding

This is a weird issue. When elogind is started from a tty, everything
works just fine. But since adding the fixes to build elogind against
the musl libc, which does not provide program_invocation_name and
program_invocation_short_name, glibc does not set them when elogind
is background. Neither when done manually, nor when doing it using a
system init tool like openrc /sbin/start-stop-daemon.

The "workaround" is to allow elogind_set_program_name() to (re-)set
both globals if they are either NULL, or not set to the correct

This should work fine with both glibc and musl-libc.

4 years agoAdd mounting of a name=elogind cgroup if no init controller is found.
Sven Eden [Fri, 10 Mar 2017 07:33:22 +0000 (08:33 +0100)]
Add mounting of a name=elogind cgroup if no init controller is found.

This is done for systems, which init systems are no cgroup
controllers. One example is runit on Void Linux.

4 years agoAdd support for building elogind against musl libc
Sven Eden [Tue, 7 Mar 2017 09:29:34 +0000 (10:29 +0100)]
Add support for building elogind against musl libc

* Check whether printf.h is available and define/undef HAVE_PRINTF_H
* Added src/shared/parse-printf-format.[hc] by Emil Renner Berthing
  <> that provides parse_printf_format() if printf.h
  is unavailable
* Added src/basic/musl_missing.h by Juergen Buchmueller
  <> that implements glibc functions missing in
  musl libc as macros.
* Extended src/basic/musl_missing.h and added
  src/basic/musl_missing.c providing
  - program_invocation_name
  - program_invocation_short_name and
  - elogind_set_program_name() to set the two where appropriate.
* Added calls to elogind_set_program_name() to all main() functions
  where needed.
* A few other fixes to work nicely with musl libc.

4 years agoFixed gawk script for git-tar target.
Sven Eden [Thu, 23 Feb 2017 16:20:49 +0000 (17:20 +0100)]
Fixed gawk script for git-tar target.

The previous variant was nice and sleek. But unfortunately, there are
constructs like:

  #if 0
  (... old code ...)
  (... alternative code for elogind ...)
  #endif // 0

These fragments couldn't be handled by the old code, but can by the
new one.

To make this work, the precompiler macros must be set like shown above.
Apart from that, all lines like:

/// Any doxygen one-line-comments with elogind in it are removed

are removed, too. Please note the three slashes.

And finally, all commented out #include directives are removed as well.

4 years Add a git-tar target, that removes all elogind masks from the sources...
Sven Eden [Wed, 22 Feb 2017 14:13:33 +0000 (15:13 +0100)] Add a git-tar target, that removes all elogind masks from the sources before packing the tar.

4 years Do not allow -Werror in gperf length test.
Sven Eden [Wed, 22 Feb 2017 08:19:22 +0000 (09:19 +0100)] Do not allow -Werror in gperf length test.

4 years agoRemove (non.existent) support for logging to journald.
Sven Eden [Tue, 21 Feb 2017 22:16:29 +0000 (23:16 +0100)]
Remove (non.existent) support for logging to journald.

4 years agoCleaned up more unneeded functions and types in:
Sven Eden [Tue, 21 Feb 2017 18:16:19 +0000 (19:16 +0100)]
Cleaned up more unneeded functions and types in:

- src/basic/ioprio.h                     - removed
- src/basic/ring.h                       - removed

- src/basic/capability.[hc]              - cleaned
- src/basic/cgroup-util.[hc]             - cleaned
- src/basic/hostname-util.[hc]           - cleaned
- src/basic/path-util.[hc]               - cleaned
- src/basic/socket-util.h                - cleaned
- src/basic/strv.[hc]                    - cleaned
- src/basic/time-util.[hc]               - cleaned
- src/basic/unit-name.[hc]               - cleaned
- src/basic/util.[hc]                    - cleaned
- src/libelogind/sd-bus/bus-introspect.c - cleaned
- src/login/loginctl.c                   - cleaned
- src/login/logind-dbus.c                - cleaned
- src/login/logind.h                     - cleaned
- src/shared/conf-parser.[hc]            - cleaned

4 years agoelogind_cgroup_agent registers as elogind.Agent, not systemd1.Agent.
Sven Eden [Tue, 21 Feb 2017 18:15:20 +0000 (19:15 +0100)]
elogind_cgroup_agent registers as elogind.Agent, not systemd1.Agent.

4 years agoVersion bump to 226.2
Sven Eden [Mon, 20 Feb 2017 21:31:53 +0000 (22:31 +0100)]
Version bump to 226.2

4 years agoUpdated man pages.
Sven Eden [Tue, 21 Feb 2017 06:54:50 +0000 (07:54 +0100)]
Updated man pages.

4 years agoCleaned up more unneeded types and functions.
Sven Eden [Mon, 20 Feb 2017 16:13:50 +0000 (17:13 +0100)]
Cleaned up more unneeded types and functions.

- src/shared/install.h                 - removed

- src/basic/unit-name.[hc]             - cleaned
- src/core/cgroup.[hc]                 - cleaned
- src/libelogind/libelogind.sym        - cleaned
- src/libelogind/sd-daemon/sd-daemon.c - cleaned
- src/shared/acl-util.[hc]             - cleaned
- src/shared/bus-util.[hc]             - cleaned
- src/shared/output-mode.h             - cleaned
- src/shared/path-lookup.h             - cleaned
- src/systemd/sd-daemon.h              - cleaned

4 years agoFix
Sven Eden [Mon, 20 Feb 2017 21:13:35 +0000 (22:13 +0100)]

4 years agoVersion bump to 226.1
Sven Eden [Mon, 20 Feb 2017 08:08:41 +0000 (09:08 +0100)]
Version bump to 226.1

4 years agouser_start_slice() : The slice name must end with .slice:
Sven Eden [Mon, 20 Feb 2017 07:27:13 +0000 (08:27 +0100)]
user_start_slice() : The slice name must end with .slice:

4 years agocg_shift_path(): Do not shift if cgroup and root are equal
Sven Eden [Mon, 20 Feb 2017 07:26:32 +0000 (08:26 +0100)]
cg_shift_path(): Do not shift if cgroup and root are equal

4 years agoAdd --enable-debug=elogind configure option and fix cgroup path
Sven Eden [Mon, 20 Feb 2017 04:57:50 +0000 (05:57 +0100)]
Add --enable-debug=elogind configure option and fix cgroup path

a) Add some debugging messages to track what's going on with eloginds
   cgroup handling.
b) Do not create a cgroup path "/elogind" if our cgroup root is
   already "/elogind".

4 years Fixed paths and cleaned up unneeded values.
Sven Eden [Thu, 16 Feb 2017 15:46:53 +0000 (16:46 +0100)] Fixed paths and cleaned up unneeded values.

4 years agoAllow NULL session parameter for manager_get_session_by_pid()
Sven Eden [Thu, 16 Feb 2017 07:16:57 +0000 (08:16 +0100)]
Allow NULL session parameter for manager_get_session_by_pid()

The reason is, that method_create_session() calls that function to
detect whether there is already a running session.

4 years agoDetect running cgroup controller.
Sven Eden [Thu, 16 Feb 2017 05:16:10 +0000 (06:16 +0100)]
Detect running cgroup controller.

elogind has to run on any system, no matter which init system is in
control of the cgroups. So instead of hardcoding "name=foo",
configure now greps 1: in /proc/self/cgroup - which is hopefully
the right choice. (Well, to be honest, if it isn't, something is
really wrong with the running system...)

4 years agoEmit PrepareForSleep when resuming and clear pending action after resume from delayed...
Sven Eden [Fri, 10 Feb 2017 13:14:29 +0000 (14:14 +0100)]
Emit PrepareForSleep when resuming and clear pending action after resume from delayed sleep.

4 years agoClassify processes from sessions into cgroups
Sven Eden [Fri, 10 Feb 2017 13:09:39 +0000 (14:09 +0100)]
Classify processes from sessions into cgroups

Create a private cgroup tree associated with no controllers, and use it
to map PIDs to sessions.  Since we use our own path structure, remove
internal cgroup-related helpers that interpret the cgroup path structure
to pull out users, slices, and scopes.

4 years agoUpdate README
Sven Eden [Wed, 8 Feb 2017 06:57:09 +0000 (07:57 +0100)]

4 years agoStop sessions on ReleaseSession
Sven Eden [Wed, 8 Feb 2017 06:50:07 +0000 (07:50 +0100)]
Stop sessions on ReleaseSession

4 years agoPKTTYAGENT make variable
Sven Eden [Tue, 7 Feb 2017 08:56:44 +0000 (09:56 +0100)]
PKTTYAGENT make variable

* (PKTTYAGENT): Define as a variable so that users can make
  PKTTYAGENT=/whatever to select a specific pkttyagent path.

4 years agolibbasic_la_LDFLAGS : Add CAP_LDFLAGS.
Sven Eden [Tue, 7 Feb 2017 07:22:53 +0000 (08:22 +0100)]
libbasic_la_LDFLAGS : Add CAP_LDFLAGS.

4 years agoUninstall the cgroup release agent when the manager is shut down.
Sven Eden [Tue, 7 Feb 2017 06:26:17 +0000 (07:26 +0100)]
Uninstall the cgroup release agent when the manager is shut down.

4 years agoRemove src/basic/special.h, as all defines in there are systemd-only.
Sven Eden [Tue, 7 Feb 2017 05:50:04 +0000 (06:50 +0100)]
Remove src/basic/special.h, as all defines in there are systemd-only.

4 years agoAdd poweroff, suspend etc. loginctl commands
Sven Eden [Mon, 6 Feb 2017 06:28:54 +0000 (07:28 +0100)]
Add poweroff, suspend etc. loginctl commands

* src/login/loginctl.c: Add poweroff, reboot, suspend, hibernate, and
  hybrid-sleep commands.  Normally these are handled by systemctl but
  since elogind is targeted at the no-systemd use case, we incorporate
  them here.

4 years agoIncorporate sleep.conf into logind.conf
Sven Eden [Thu, 2 Feb 2017 08:10:41 +0000 (09:10 +0100)]
Incorporate sleep.conf into logind.conf

* src/login/logind-action.c (shutdown_or_sleep, do_sleep): Take modes
  from the manager instead of parsing them ourselves.

* src/login/logind-dbus.c (execute_shutdown_or_sleep): Adapt to
  shutdown_or_sleep prototype change.

* src/login/logind-gperf.gperf: Add config items from sleep.conf.
* src/login/logind.c (manager_new): Wire up defaults for new config
  (manager_free): Free new config items.
  (manager_parse_config_file): Arrange to parse a single
  elogind/logind.conf file, not grovelling all over the filesystem.
  Take the file from the ELOGIND_CONF_FILE environment variable if

4 years agoHandle suspend, shutdown, reboot, etc within elogind
Sven Eden [Wed, 1 Feb 2017 07:48:13 +0000 (08:48 +0100)]
Handle suspend, shutdown, reboot, etc within elogind

Since we are catching the keys, we might as well just do
suspend/reboot/etc handling here.

* Get paths of halt and reboot.
* (systemsleepdir, systemshutdowndir): New variables.  Look
  in them for hooks to run.

* src/login/logind-action.c: Inline the salient bits from systemd's
  sleep/sleep.c here.

* src/login/logind-dbus.c (execute_shutdown_or_sleep): Call our own
  shutdown_or_sleep helper instead of invoking a systemd method.

* src/login/logind-action.h: Declare shutdown_or_sleep.

4 years agoRemove support for auto-spawning VTs
Sven Eden [Thu, 26 Jan 2017 09:15:42 +0000 (10:15 +0100)]
Remove support for auto-spawning VTs

Auto-spawning VTs requires systemd in practice.  If you're using systemd
you can just use its logind :)

4 years agoRemove dependency of systemd units, services and slices for new sessions.
Sven Eden [Thu, 26 Jan 2017 08:56:23 +0000 (09:56 +0100)]
Remove dependency of systemd units, services and slices for new sessions.

* elogind does not support systemd services and units. But at least
  the units are needed to support the systemd cgroup slice/scope
* Remove systemd subscription to scope, service and slice jobs.
  These can not be supported in any way, as they depend on systemd
  running the machine.
* The functions session_start_scope(), user_start_service() and
  user_start_slice() no longer try to call systemd via dbus for
  This way they generate their proper scope, service and slice names,
  and store them in the Managers HashMaps for session and user units.
  This should enable us to reverse track pids to users and such
  stuff, as that is what systemd-logind does, not knowing whether any
  unit *really* has been started or not.
  However, this will not work out of the box until we find a way to
  integrate cg_create_everywhere() into elogind without becoming
  dependent of systemd unit, service and job knowledge again.

4 years ago[Patch 3/3] Add cgroups initialization and handling
Sven Eden [Thu, 26 Jan 2017 07:30:04 +0000 (08:30 +0100)]
[Patch 3/3] Add cgroups initialization and handling

Let elogind setup cgroups support on its manager initialization and
free the cgroups subsystem when the manager is destroyed.

4 years ago[Patch 2/3] Add cgroups initialization and handling
Sven Eden [Thu, 26 Jan 2017 07:21:20 +0000 (08:21 +0100)]
[Patch 2/3] Add cgroups initialization and handling

Add a highly reduced src/core/cgroup.[hc] to enable elogind to setup
cgroups for proper usage.

4 years ago[Patch 1/3] Add cgroups initialization and handling
Sven Eden [Thu, 26 Jan 2017 07:14:54 +0000 (08:14 +0100)]
[Patch 1/3] Add cgroups initialization and handling

Re-add elogind-cgroups-agent. elogind will not be able to support the
new unified hierarchy, and the agent is needed for the classical

4 years agoCreate /run/systemd as needed
Sven Eden [Fri, 20 Jan 2017 16:14:35 +0000 (17:14 +0100)]
Create /run/systemd as needed

* src/login/logind.c (main): Also create /run/systemd at startup.
* Create /run/systemd/machines, so that the login monitor works.
* Fail if any of the needed directories could not be created.
* But do not fail if any of the needed directories exist.

4 years agoFix logind startup
Sven Eden [Fri, 20 Jan 2017 15:35:48 +0000 (16:35 +0100)]
Fix logind startup

* src/login/logind.c (manager_connect_bus):
  - Notice instead of error if we can't subscribe to updates from
    systemd. Perhaps we should remove this entirely. But leaving
    it optional means, that a system managed by systemd can use
    elogind substituting systemd-login.
  - Warn instead of error if we can't add receiver matches from
    systemd events. On a system not run by systemd, such events
    wouldn't occur anyway.

4 years agoRemove obsolete headers and the src/core directory.
Sven Eden [Fri, 20 Jan 2017 04:39:16 +0000 (05:39 +0100)]
Remove obsolete headers and the src/core directory.

4 years agoRemove librt dependency.
Sven Eden [Fri, 20 Jan 2017 03:58:34 +0000 (04:58 +0100)]
Remove librt dependency.

The only function still using librt was

But that function is not really needed, because elogind does not call
mq_open() anywhere, or any other mqueue related functions.

4 years agoRemove sd_is_mq
Sven Eden [Thu, 19 Jan 2017 13:05:12 +0000 (14:05 +0100)]
Remove sd_is_mq

* src/systemd/sd-daemon.h:
* src/libelogind/sd-daemon/sd-daemon.c (sd_is_mq): Remove unused
  function that depended on librt.  Ultimately we should remove this
  header at some point.

4 years agoFix man page building to be less systemd and more elogind.
Sven Eden [Thu, 19 Jan 2017 12:04:18 +0000 (13:04 +0100)]
Fix man page building to be less systemd and more elogind.

4 years agoRemove man/sd[-_]bus[-_]error*.xml files, as elogind does not provide a systemd dbus...
Sven Eden [Thu, 19 Jan 2017 07:22:21 +0000 (08:22 +0100)]
Remove man/sd[-_]bus[-_]error*.xml files, as elogind does not provide a systemd dbus interface to control.

4 years agoChange systemd occurences in factory/etc/pam.d to elogind.
Sven Eden [Thu, 19 Jan 2017 07:21:21 +0000 (08:21 +0100)]
Change systemd occurences in factory/etc/pam.d to elogind.

4 years agoFix pkginclude_HEADERS to what elogind needs and provides.
Sven Eden [Thu, 19 Jan 2017 07:19:25 +0000 (08:19 +0100)]
Fix pkginclude_HEADERS to what elogind needs and provides.

4 years agoRemove APPARMOR, BLKID and SECCOMP checks and feature.
Sven Eden [Tue, 17 Jan 2017 07:51:20 +0000 (08:51 +0100)]
Remove APPARMOR, BLKID and SECCOMP checks and feature.
Remove logind check, it is always built as elogind anyway.
Remove ENABLE_LOGIND conditional from man pages.

4 years agoRemove dbus checks, it isn't used anywhere.
Sven Eden [Tue, 17 Jan 2017 07:46:02 +0000 (08:46 +0100)]
Remove dbus checks, it isn't used anywhere.

4 years agoRemove unused and invalid udev definitions
Sven Eden [Tue, 17 Jan 2017 07:34:05 +0000 (08:34 +0100)]
Remove unused and invalid udev definitions

These definitions were not valid when compiling against eudev.

As a nice consequence, our own copies of any udev includes are no
longer needed and could be removed for good.

Add label.h include to logind.c, as "udev.h" is no longer available which would have done so otherwise.

4 years agoRemove libidn feature
Sven Eden [Mon, 16 Jan 2017 07:42:48 +0000 (08:42 +0100)]
Remove libidn feature

Sven Eden [Mon, 16 Jan 2017 06:50:35 +0000 (07:50 +0100)]
LZ4 and XZ features from build.h

4 years agoRemove rogue compat-libs checks
Sven Eden [Mon, 16 Jan 2017 06:47:49 +0000 (07:47 +0100)]
Remove rogue compat-libs checks

4 years agoFix lookup_errno by adding a gperf length parameter detection.
Sven Eden [Thu, 12 Jan 2017 08:28:02 +0000 (09:28 +0100)]
Fix lookup_errno by adding a gperf length parameter detection.

build-sys: add check for gperf lookup function signature (#5055)

gperf-3.1 generates lookup functions that take a size_t length
parameter instead of unsigned int. Test for this at configure time.


4 years agoRemove sd-path interface.
Sven Eden [Thu, 12 Jan 2017 10:13:58 +0000 (11:13 +0100)]
Remove sd-path interface.

4 years agoCleanup a bit more and disable -flto support.
Sven Eden [Thu, 12 Jan 2017 09:19:34 +0000 (10:19 +0100)]
Cleanup a bit more and disable -flto support.

4 years agoRemove kmod
Sven Eden [Thu, 12 Jan 2017 09:06:55 +0000 (10:06 +0100)]
Remove kmod

4 years agoRemove cgroups-agent, it is not really needed.
Sven Eden [Thu, 12 Jan 2017 09:03:46 +0000 (10:03 +0100)]
Remove cgroups-agent, it is not really needed.

4 years agoRemove python dependencies for dist, we only need it for
Sven Eden [Thu, 12 Jan 2017 08:40:43 +0000 (09:40 +0100)]
Remove python dependencies for dist, we only need it for

4 years agoRemove SysV compat
Sven Eden [Thu, 12 Jan 2017 08:34:38 +0000 (09:34 +0100)]
Remove SysV compat

4 years agoRemove DISTRO_PORTING and catalog/ files that have slithered back in.
Sven Eden [Tue, 10 Jan 2017 04:20:43 +0000 (05:20 +0100)]
Remove DISTRO_PORTING and catalog/ files that have slithered back in.

4 years agoRemove utmp stuff that has found it's way back in.
Sven Eden [Thu, 12 Jan 2017 08:27:29 +0000 (09:27 +0100)]
Remove utmp stuff that has found it's way back in.

4 years agoRemove tmpfiles.d
Sven Eden [Tue, 10 Jan 2017 04:31:13 +0000 (05:31 +0100)]
Remove tmpfiles.d

4 years agoPrep 4xx6: Fix logind_gperf_lookup declaration
Sven Eden [Tue, 10 Jan 2017 04:17:13 +0000 (05:17 +0100)]
Prep 4xx6: Fix logind_gperf_lookup declaration

4 years agoPrep v226: Mask all unneeded functions
Sven Eden [Mon, 9 Jan 2017 05:04:26 +0000 (06:04 +0100)]
Prep v226: Mask all unneeded functions

4 years agoPrep v226: loginctl.c: Fix call to (changed) cg_is_empty_recursive().
Sven Eden [Mon, 9 Jan 2017 05:18:16 +0000 (06:18 +0100)]
Prep v226: loginctl.c: Fix call to (changed) cg_is_empty_recursive().

4 years agoPrep v226: Fix some function prototypes in bus-util.h
Sven Eden [Mon, 9 Jan 2017 05:16:42 +0000 (06:16 +0100)]
Prep v226: Fix some function prototypes in bus-util.h

4 years agoPrep v226: Add src/basic/copy.[hc] to libbasic, the function copy_bytes() is needed...
Sven Eden [Mon, 9 Jan 2017 05:13:40 +0000 (06:13 +0100)]
Prep v226: Add src/basic/copy.[hc] to libbasic, the function copy_bytes() is needed by pager.c

4 years agoPrep v220: Fix src/basic/time-util.h, unmask timezone_is_valid, mask unneeded functions.
Sven Eden [Mon, 9 Jan 2017 04:58:48 +0000 (05:58 +0100)]
Prep v220: Fix src/basic/time-util.h, unmask timezone_is_valid, mask unneeded functions.

4 years agoPrep v226: Apply missing fixes and changes to src/shared
Sven Eden [Mon, 9 Jan 2017 04:53:02 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/shared

4 years agoPrep v226: Apply missing fixes and changes to src/login
Sven Eden [Mon, 9 Jan 2017 04:53:01 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/login

4 years agoPrep v226: Apply missing fixes and changes to src/libelogind
Sven Eden [Mon, 9 Jan 2017 04:53:01 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/libelogind

4 years agoPrep v226: Apply missing fixes and changes to src/basic
Sven Eden [Mon, 9 Jan 2017 04:53:00 +0000 (05:53 +0100)]
Prep v226: Apply missing fixes and changes to src/basic

4 years agoPrep v226: Sync build files with upstream
Sven Eden [Thu, 5 Jan 2017 05:21:16 +0000 (06:21 +0100)]
Prep v226: Sync build files with upstream

4 years agosd-bus: when connecting to a container AF_UNIX bus, return error
Lennart Poettering [Mon, 7 Sep 2015 17:52:11 +0000 (19:52 +0200)]
sd-bus: when connecting to a container AF_UNIX bus, return error

When forking of a child process for connecting to a container, pass
the preicse connection error to the calling process.

We already did this correctly for kdbus busses, let's do so for dbus1
busses, too.

4 years agoUpdated Polish translation
Piotr Drąg [Sun, 6 Sep 2015 18:42:16 +0000 (20:42 +0200)]
Updated Polish translation

4 years agologind: make scope of wall message handling smaller
Lennart Poettering [Sat, 5 Sep 2015 18:24:08 +0000 (20:24 +0200)]
logind: make scope of wall message handling smaller

4 years agosd-bus: make introspection data non-recursive
David Herrmann [Sat, 5 Sep 2015 17:43:29 +0000 (19:43 +0200)]
sd-bus: make introspection data non-recursive

Currently, our introspection data looks like this:

         <interface name="org.freedesktop.DBus.Peer">
         <interface name="org.freedesktop.DBus.Introspectable">
         <interface name="org.freedesktop.DBus.Properties">
         <node name="org"/>
         <node name="org/freedesktop"/>
         <node name="org/freedesktop/login1"/>
         <node name="org/freedesktop/login1/user"/>
         <node name="org/freedesktop/login1/user/self"/>
         <node name="org/freedesktop/login1/user/_1000"/>
         <node name="org/freedesktop/login1/seat"/>
         <node name="org/freedesktop/login1/seat/self"/>
         <node name="org/freedesktop/login1/seat/seat0"/>
         <node name="org/freedesktop/login1/session"/>
         <node name="org/freedesktop/login1/session/self"/>
         <node name="org/freedesktop/login1/session/c1"/>

(ordered alphabetically for better visibility)

This is grossly incorrect. The spec says that we're allowed to return
non-directed children, however, it does not allow us to return data
recursively in multiple parents. If we return "org", then we must not
return anything else that starts with "org/".

It is unclear, whether we can include child-nodes as a tree. Moreover, it
is usually not what the caller wants. Hence, this patch changes sd-bus to
never return introspection data recursively. Instead, only a single
child-layer is returned.

This patch relies on enumerators to never return hierarchies. If someone
registers an enumerator via sd_bus_add_enumerator, they better register
sub-enumerators if they support *TRUE* hierarchies. Each enumerator is
treated as a single layer and not filtered.
Enumerators are still allowed to return nested data. However, that data
is still required to be a single hierarchy. For instance, returning
"/org/foo" and "/com/bar" is fine, but including "/com" or "/org" in that
dataset is not.
This should be the default for enumerators and I see no reason to filter
in sd-bus. Moreover, filtering that data-set would require to sort the
strv by path and then do prefix-filtering. This is O(n log n), which
would be fine, but still better to avoid.

Fixes #664.

4 years agosd-bus: derive uid from cgroup if possible
David Herrmann [Sat, 5 Sep 2015 15:54:30 +0000 (17:54 +0200)]
sd-bus: derive uid from cgroup if possible

Whenever we run in a user context, sd_bus_{default_user,open_user}() and
friends should always connect to the user-bus of the current context,
instead of deriving the uid from getuid(). This allows us running
programs via sudo/su, without the nasty side-effect of accidentally
connecting to the root user-bus.

This patch enforces the idea of making su/sudo *not* opening sessions by
default. That is, all they do is raising privileges, but keeping
everything set as before. You can still use su/sudo to open real sessions
by requesting a login-session (or loading pam_elogind otherwise).
However, in this case XDG_RUNTIME_DIR= will not be set (as usual in these
cases), hence, you will not be able to connect to *any* user-bus.

Long story short: With this patch applied, both:
        - ./busctl --user
        - sudo ./busctl --user
..will successfully connect to the user-bus of the local user.

Fixes #390.

4 years agologin: fix NULL-deref on wall_message
David Herrmann [Sat, 5 Sep 2015 10:56:04 +0000 (12:56 +0200)]
login: fix NULL-deref on wall_message

We treat an empty wall-message equal to a NULL wall-message since:

        commit 5744f59a3ee883ef3a78214bd5236157acdc35ba
        Author: Lennart Poettering <>
        Date:   Fri Sep 4 10:34:47 2015 +0200

            logind: treat an empty wall message like a NULL one

Fix the shutdown scheduler to not deref a NULL pointer, but properly
check for an empty wall-message.

Fixes: #1120

4 years agologind: when parsing a boolean via sd-bus the type must be "int"
Lennart Poettering [Fri, 4 Sep 2015 08:35:46 +0000 (10:35 +0200)]
logind: when parsing a boolean via sd-bus the type must be "int"

And not bool.

4 years agologind: treat an empty wall message like a NULL one
Lennart Poettering [Fri, 4 Sep 2015 08:34:47 +0000 (10:34 +0200)]
logind: treat an empty wall message like a NULL one