chiark / gitweb /
elogind.git
7 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.

7 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':
    KERNEL=="event3"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/platform/gpio_keys/input/input3':
    KERNELS=="input3"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="gpio_keys"
    ATTRS{phys}=="gpio-keys/input0"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/platform/gpio_keys':
    KERNELS=="gpio_keys"
    SUBSYSTEMS=="platform"
    DRIVERS=="gpio-keys"
    ATTRS{keys}=="116"
    ATTRS{switches}==""
    ATTRS{driver_override}=="(null)"
    ATTRS{disabled_keys}==""
    ATTRS{disabled_switches}==""

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

7 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

8 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.

7 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

7 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

7 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.

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

7 years agoRename ELOGIND_CGROUP_CONTROLLER back to SYSTEMD_CGROUP_CONTROLLER
Sven Eden [Tue, 14 Mar 2017 10:56:01 +0000 (11:56 +0100)]
Rename ELOGIND_CGROUP_CONTROLLER back to SYSTEMD_CGROUP_CONTROLLER

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

7 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.

7 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
        free(foo);
        foo = NULL;
with
        foo = mfree(foo);

7 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
value.

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

7 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.

7 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
  accordingly.
* Added src/shared/parse-printf-format.[hc] by Emil Renner Berthing
  <systemd@esmil.dk> that provides parse_printf_format() if printf.h
  is unavailable
* Added src/basic/musl_missing.h by Juergen Buchmueller
  <pullmoll@t-online.de> 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.

7 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 ...)
  #else
  (... 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.

7 years agoMakefile.am: 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)]
Makefile.am: Add a git-tar target, that removes all elogind masks from the sources before packing the tar.

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

7 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.

7 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

7 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.

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

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

7 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

7 years agoFix libelogind.pc.in
Sven Eden [Mon, 20 Feb 2017 21:13:35 +0000 (22:13 +0100)]
Fix libelogind.pc.in

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

7 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:

7 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

7 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".

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

7 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.

7 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...)

7 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.

7 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.

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

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

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

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

7 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.

7 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.

7 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.

7 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.

7 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
  items.
  (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
  present.

7 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.

* configure.ac: Get paths of halt and reboot.
* Makefile.am (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.

7 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 :)

7 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
  system.
* 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
  assistance.
  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.

7 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.

7 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.

7 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
hierarchy.

7 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.

7 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.

7 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.

7 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
src/shared/clean-ipc.c::clean_posix_mq().

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

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

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

7 years agoRemove ELFUTILS, GCRYPT, GNUTLS, IMA, LIBAUDIT, LIBCRYPTSETUP,
Sven Eden [Mon, 16 Jan 2017 06:50:35 +0000 (07:50 +0100)]
Remove ELFUTILS, GCRYPT, GNUTLS, IMA, LIBAUDIT, LIBCRYPTSETUP,
LZ4 and XZ features from build.h

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

7 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.

Fixes: https://github.com/systemd/systemd/issues/5039
7 years agoRemove sd-path interface.
Sven Eden [Thu, 12 Jan 2017 10:13:58 +0000 (11:13 +0100)]
Remove sd-path interface.

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

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

7 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.

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

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

7 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.

7 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.

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

7 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

7 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

7 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().

7 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

7 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

7 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.

7 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

7 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

7 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

7 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

7 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

7 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.

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

7 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

7 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:

        <node>
         <interface name="org.freedesktop.DBus.Peer">
           ...
         </interface>
         <interface name="org.freedesktop.DBus.Introspectable">
           ...
         </interface>
         <interface name="org.freedesktop.DBus.Properties">
           ...
         </interface>
         <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"/>
        </node>

(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.

7 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.

7 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 <lennart@poettering.net>
        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
7 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.

7 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

7 years agosd-login: minor header commenting improvements
Lennart Poettering [Fri, 4 Sep 2015 07:57:51 +0000 (09:57 +0200)]
sd-login: minor header commenting improvements

7 years agosd-login: add new sd_pid_get_cgroup() API
Lennart Poettering [Fri, 4 Sep 2015 07:54:14 +0000 (09:54 +0200)]
sd-login: add new sd_pid_get_cgroup() API

This adds a new sd_pid_get_cgroup() call to sd-login which may be used
to query the control path of a process. This is useful for programs when
making use of delegation units, in order to figure out which subtree has
been delegated.

In light of the unified control group hierarchy this is finally safe to
do, hence let's add a proper API for it, to make it easier to use this.

7 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.

7 years agocgroup: when comparing agent paths, use path_equal()
Lennart Poettering [Thu, 3 Sep 2015 16:27:19 +0000 (18:27 +0200)]
cgroup: when comparing agent paths, use path_equal()

After all a path is a path is a path and we should use path_equal() to
comapre those.

7 years agoaudit: audit calls should return ENODATA when process are not in an audit session
Lennart Poettering [Thu, 3 Sep 2015 16:24:57 +0000 (18:24 +0200)]
audit: audit calls should return ENODATA when process are not in an audit session

ENODATA is how we usually indicate such "missing info" cases, so we
should do this here, too.

7 years agoutil: add new uid_is_valid() call
Lennart Poettering [Thu, 3 Sep 2015 11:29:53 +0000 (13:29 +0200)]
util: add new uid_is_valid() call

This simply factors out the uid validation checks from parse_uid() and
uses them everywhere. This simply verifies that the passed UID is
neither 64bit -1 nor 32bit -1.

7 years agosd-bus: when connecting to a container, don't fall back to host bus
Lennart Poettering [Tue, 1 Sep 2015 18:38:37 +0000 (20:38 +0200)]
sd-bus: when connecting to a container, don't fall back to host bus

We should never connect to the host bus as fallback if connecting to a
container failed via one method. Otherwise connecting to a dbus1
container will always result in a connection to the host.

7 years agosd-bus: when connecting to a kdbus container bus pass error up
Lennart Poettering [Tue, 1 Sep 2015 18:36:52 +0000 (20:36 +0200)]
sd-bus: when connecting to a kdbus container bus pass error up

We rely on the correct error used when opening the kdbus device node,
hence let's make sure we pass it up from the namespaced child process to
the process which actually wants to connect.

7 years agocgroup: don't allow hidden cgroups
Lennart Poettering [Tue, 1 Sep 2015 15:54:17 +0000 (17:54 +0200)]
cgroup: don't allow hidden cgroups

We really should care for all cgroups, and not allow hidden ones.