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

7 years agocgroup: never migrate kernel threads out of the root cgroup
Lennart Poettering [Tue, 1 Sep 2015 15:53:14 +0000 (17:53 +0200)]
cgroup: never migrate kernel threads out of the root cgroup

It won't work anyway.

7 years agoset: return NULL on destructors
Lennart Poettering [Tue, 1 Sep 2015 15:13:53 +0000 (17:13 +0200)]
set: return NULL on destructors

Like we do it pretty much everywhere else.

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

https://launchpad.net/bugs/1450009

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

7 years agologin: support user-bus on dbus1
David Herrmann [Mon, 31 Aug 2015 16:07:46 +0000 (18:07 +0200)]
login: support user-bus on dbus1

dbus-1.10 was just released, including systemd units to run
`dbus-daemon --session` as systemd user unit. This allows using a
user-bus with dbus1, just like we do per default with kdbus.

All the dbus libraries have already been fixed long ago to use the
user-bus as default. Hence, there's no need to set
DBUS_SESSION_BUS_ADDRESS= if we use the user-bus. However, gdm and
friends continue to spawn a session bus if this variable is not set
(instead of checking for the existence of the user-bus). Hence, we force
the user-bus, if it is available, in pam_elogind. Once gdm and friends
are fixed, we can continue to drop this again. However, that might take
a while.

With this in place, all that is needed to make the user-bus work is:
    `systemctl --global enable dbus.socket`

If dbus.socket is not enabled, the legacy session-bus is still used.

Based on a patch by: Jan Alexander Steffens <jan.steffens@gmail.com>

7 years agosd-event: improve debug message when we fail to remove and fd from an epoll
Lennart Poettering [Mon, 31 Aug 2015 11:07:24 +0000 (13:07 +0200)]
sd-event: improve debug message when we fail to remove and fd from an epoll

Let's help users to debug issues with epoll fd removal by printing the
name of the event source.

7 years agoextract_first_word: Refactor EXTRACT_DONT_COALESCE_SEPARATORS handling
Filipe Brandenburger [Mon, 31 Aug 2015 02:40:44 +0000 (19:40 -0700)]
extract_first_word: Refactor EXTRACT_DONT_COALESCE_SEPARATORS handling

Refactor allocation of the result string to the top, since it is
currently done in both branches of the condition.

Remove unreachable code checking for EXTRACT_DONT_COALESCE_SEPARATORS
when state == SEPARATOR (the only place where SEPARATOR is assigned to
state follows a check for EXTRACT_DONT_COALESCE_SEPARATORS that jumps to
the end of the function.)

Tested by running test-util successfully.

Follow up to: 206644aedeb8859801051ac170ec562c6a113a79

7 years agoextract_first_word: Refactor allocation in empty argument case
Filipe Brandenburger [Mon, 31 Aug 2015 02:16:50 +0000 (19:16 -0700)]
extract_first_word: Refactor allocation in empty argument case

This covers the case where an argument is an empty string, such as ''.

Instead of allocating the empty string in the individual conditions when
state == VALUE, just always allocate it at the end of state == START, at
which point we know we will have an argument.

Tested that test-util keeps passing after the refactor.

Follow up to: 14e685c29d5b317b815e3e9f056648027852b07e

7 years agopo: update Polish translation
Piotr Drąg [Sat, 29 Aug 2015 18:33:02 +0000 (20:33 +0200)]
po: update Polish translation

7 years agoutil: make malloc0 ask calloc for one block of size n
Thomas Hindoe Paaboel Andersen [Fri, 28 Aug 2015 19:16:39 +0000 (21:16 +0200)]
util: make malloc0 ask calloc for one block of size n

... instead of an array of n individual bytes.

Silences a lot of warnings in smatch.

7 years agoprocess-util: trivial optimization
Lennart Poettering [Fri, 28 Aug 2015 17:29:03 +0000 (19:29 +0200)]
process-util: trivial optimization

7 years agoutil: treat 'C' and 'POSIX' locale identical
Lennart Poettering [Fri, 28 Aug 2015 16:22:14 +0000 (18:22 +0200)]
util: treat 'C' and 'POSIX' locale identical

7 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
systemd would output UTF-8 but less wouldn't allow it and show them as
control characters.

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 agocgroup-show: unescape cgroups on presentation
Lennart Poettering [Thu, 27 Aug 2015 22:12:38 +0000 (00:12 +0200)]
cgroup-show: unescape cgroups on presentation

Let's unescape cgroups on presentation, so that we show literal unit
names.

7 years agopager: port fallback pager to use copy_bytes()
Lennart Poettering [Thu, 27 Aug 2015 22:11:49 +0000 (00:11 +0200)]
pager: port fallback pager to use copy_bytes()

7 years agosd-bus: it's not a user error to query the error contained in a bus message
Lennart Poettering [Thu, 27 Aug 2015 10:54:35 +0000 (12:54 +0200)]
sd-bus: it's not a user error to query the error contained in a bus message

It's an OK way to check whether a message contains an erro, let's not
consider this a loggable assertion event.

7 years agobasic: document that people shouldn't use refcnt.h without reason
Lennart Poettering [Wed, 26 Aug 2015 19:04:38 +0000 (21:04 +0200)]
basic: document that people shouldn't use refcnt.h without reason

refcnt.h only exists for cases where objects are simultaneously handled
by different threads. Otherwise it should not be used. The only case
where this applies is sd_bus, really, and pretty much none of our APIs,
since we do not claim thread-safety for them.

7 years agoPrep v225: Added needed udev support and re-enabled some masked cgroup functions.
Sven Eden [Wed, 4 Jan 2017 11:55:04 +0000 (12:55 +0100)]
Prep v225: Added needed udev support and re-enabled some masked cgroup functions.

7 years agoPrep v225: Applying various fixes and changes to src/systemd that got lost during...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/systemd that got lost during git am transfer.

7 years agoPrep v225: Applying various fixes and changes to src/shared that got lost during...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/shared that got lost during git am transfer.

7 years agoPrep v225: Applying various fixes and changes to src/login that got lost during git...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/login that got lost during git am transfer.

7 years agoPrep v225: Applying various fixes and changes to src/libelogind/sd-login that got...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/libelogind/sd-login that got lost during git am transfer.

7 years agoPrep v225: Applying various fixes and changes to src/libelogind/sd-event that got...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/libelogind/sd-event that got lost during git am transfer.

7 years agoPrep v225: Applying various fixes and changes to src/libelogind/sd-bus that got lost...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/libelogind/sd-bus that got lost during git am transfer.

7 years agoPrep v225: Applying various fixes and changes to src/cgroups-agent that got lost...
Sven Eden [Wed, 4 Jan 2017 05:40:46 +0000 (06:40 +0100)]
Prep v225: Applying various fixes and changes to src/cgroups-agent that got lost during git am transfer.