chiark / gitweb /
elogind.git
6 years agoVersion v231.2
Sven Eden [Thu, 29 Jun 2017 08:02:40 +0000 (10:02 +0200)]
Version v231.2

6 years agoPrep v231.2: Make sure logs go to syslog or kmsg if elogind was started in debug...
Sven Eden [Wed, 28 Jun 2017 16:56:23 +0000 (18:56 +0200)]
Prep v231.2: Make sure logs go to syslog or kmsg if elogind was started in debug mode, even if it was started from a tty.

6 years agoPrep v231.2: Minor changes to make future patching easier.
Sven Eden [Wed, 28 Jun 2017 08:48:10 +0000 (10:48 +0200)]
Prep v231.2: Minor changes to make future patching easier.

6 years agoPrep v231.2: Move elogind specific code in logind-dbus.c to elogind-dbus.c
Sven Eden [Wed, 28 Jun 2017 08:41:24 +0000 (10:41 +0200)]
Prep v231.2: Move elogind specific code in logind-dbus.c to elogind-dbus.c

6 years agoPrep v231.2: Do not set a wall message when suspending (none there anyway)
Sven Eden [Wed, 28 Jun 2017 05:49:45 +0000 (07:49 +0200)]
Prep v231.2: Do not set a wall message when suspending (none there anyway)

6 years agoPrep v231.2: elogind is a stand-alone daemon, so do not exit if suspending the system...
Sven Eden [Tue, 27 Jun 2017 06:25:23 +0000 (08:25 +0200)]
Prep v231.2: elogind is a stand-alone daemon, so do not exit if suspending the system fails.

6 years agoPrep v231.2: Send processes the wakeup signal, even if suspending the system failed.
Sven Eden [Tue, 27 Jun 2017 06:05:27 +0000 (08:05 +0200)]
Prep v231.2: Send processes the wakeup signal, even if suspending the system failed.

6 years agoPrep v231.2: Only check time and wall arguments for shutdown and reboot.
Sven Eden [Mon, 26 Jun 2017 17:09:25 +0000 (19:09 +0200)]
Prep v231.2: Only check time and wall arguments for shutdown and reboot.

6 years agoPrep v231.2: elogind_log_special() : Add missing case breaks.
Sven Eden [Mon, 26 Jun 2017 16:39:03 +0000 (18:39 +0200)]
Prep v231.2: elogind_log_special() : Add missing case breaks.

6 years agoPrep v231.2: Add mor debug messages to find out, why 'loginctl suspend' isn't working.
Sven Eden [Mon, 26 Jun 2017 07:03:51 +0000 (09:03 +0200)]
Prep v231.2: Add mor debug messages to find out, why 'loginctl suspend' isn't working.

6 years agoPrep v231.2: Really set an extra wall message (if any) and display it when cancelling...
Sven Eden [Mon, 26 Jun 2017 06:18:53 +0000 (08:18 +0200)]
Prep v231.2: Really set an extra wall message (if any) and display it when cancelling a pending shutdown/reboot

6 years agoPrep v231.2: loginctl: Move check for cancelling a scheduled shutdown to allow extra...
Sven Eden [Mon, 26 Jun 2017 06:03:24 +0000 (08:03 +0200)]
Prep v231.2: loginctl: Move check for cancelling a scheduled shutdown to allow extra wall messages.

6 years agoPrep v231.2: Add log messages for loginctl invoking system commands.
Sven Eden [Thu, 22 Jun 2017 16:22:58 +0000 (18:22 +0200)]
Prep v231.2: Add log messages for loginctl invoking system commands.

6 years agoPrep v231.2: Mask get_startup_time(), it won't work without systemd running the show...
Sven Eden [Thu, 22 Jun 2017 16:21:16 +0000 (18:21 +0200)]
Prep v231.2: Mask get_startup_time(), it won't work without systemd running the show anyway.

6 years agoPrep v231.2: Mask unsupported bus errors.
Sven Eden [Thu, 22 Jun 2017 16:20:09 +0000 (18:20 +0200)]
Prep v231.2: Mask unsupported bus errors.

6 years agoPrep v231.2: login1.policy vendor is the project, not it's description.
Sven Eden [Thu, 22 Jun 2017 16:18:07 +0000 (18:18 +0200)]
Prep v231.2: login1.policy vendor is the project, not it's description.

6 years agoPrep v321.2: Fix org.freedesktop.login1 where named org.freedesktop.elogind
Sven Eden [Thu, 22 Jun 2017 16:17:20 +0000 (18:17 +0200)]
Prep v321.2: Fix org.freedesktop.login1 where named org.freedesktop.elogind

6 years agoPrep v231.2: Fix missing/double wall msgs on scheduled shutdown/reboot
Sven Eden [Wed, 21 Jun 2017 08:57:17 +0000 (10:57 +0200)]
Prep v231.2: Fix missing/double wall msgs on scheduled shutdown/reboot

- Do not do anything in manager_setup_wall_message_timer() if wall
  messages are disabled anyway.
- Set up a wall timer in any case there is time left. The original
  sources would not even set up a timer if the next messages would
  be now. As time is measured in USEC, that's pretty rare, but
  possible.
- If less than 1 Second is left to the first message, delay it.
- systemd would print out a message at once, if less than 15 minutes
  are left to the event. Do this only, if the next scheduled message
  wouldn't come within the next 3 seconds, or it might come to
  awkward double messages.

6 years agoPrep v231.2: Remove modes and states assertion in do_sleep()
Sven Eden [Wed, 21 Jun 2017 06:49:50 +0000 (08:49 +0200)]
Prep v231.2: Remove modes and states assertion in do_sleep()

It is perfectly valid to have NULL modes. The default configuration
for suspend to ram is such a case.
Having NULL states doesn't make any sense other than no suspension is
possible any more. But a user might have set any *State value to an
empty string, so better assume (and assert) nothing here.

6 years agoPrep v231.2: login/elogind.c: Remove bus_forward_agent_released()
Sven Eden [Tue, 20 Jun 2017 04:48:14 +0000 (06:48 +0200)]
Prep v231.2: login/elogind.c: Remove bus_forward_agent_released()

This method is called from a systemd manager that is the system
instance to inform all user instances of systemd about the pending
cgroup release.

elogind on the other hand is always there just once. And the release
of cgroups is handled by the local cgroups manager, which should be
provided by the running init system.

Even if there is no cgroup management, so elogind sets itself up as
a small cgroups manager itself, there aren't any user instances that
could react on the forwarding anyway.

6 years agoPrep v231.2: Remove --disable-kdbus option from configure.
Sven Eden [Mon, 19 Jun 2017 17:28:05 +0000 (19:28 +0200)]
Prep v231.2: Remove --disable-kdbus option from configure.

Support for kdbus can no longer be enabled or disabled. It is simply
there and will be used if needed and possible.
So if you have kdbus available, elogind might use it.

6 years agoPrep v231.2: Remove orphaned files
Sven Eden [Mon, 19 Jun 2017 17:27:19 +0000 (19:27 +0200)]
Prep v231.2: Remove orphaned files

6 years agoPrep v231.2: pam_elogind must be linked against libshared, not libelogind-shared.
Sven Eden [Mon, 19 Jun 2017 17:03:17 +0000 (19:03 +0200)]
Prep v231.2: pam_elogind must be linked against libshared, not libelogind-shared.

6 years agoPrep v231.2: Make elogind musl-libc-compatible again.
Sven Eden [Mon, 19 Jun 2017 09:51:42 +0000 (11:51 +0200)]
Prep v231.2: Make elogind musl-libc-compatible again.

6 years agoPrep v231.2: basic/stdio-util.h must include parse-printf-format.h instead of printf.h
Sven Eden [Mon, 19 Jun 2017 09:04:44 +0000 (11:04 +0200)]
Prep v231.2: basic/stdio-util.h must include parse-printf-format.h instead of printf.h

6 years agoPrep v231.2: Apply some minor style fixes
Sven Eden [Mon, 19 Jun 2017 08:17:56 +0000 (10:17 +0200)]
Prep v231.2: Apply some minor style fixes

6 years agosd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)
Franck Bui [Wed, 8 Feb 2017 19:56:22 +0000 (20:56 +0100)]
sd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)

The code make the following assertion: when freeing a event loop object
(usually it's done after exiting from the main event loop), no signal events
are still queued and are pending.

This assertion can be found in event_unmask_signal_data() with
"assert(!d->current);" assertion.

It appears that this assertion can be wrong at least in a specific case
described below.

Consider the following example which is inspired from udev: a process defines 3
source events: 2 are created by sd_event_add_signal() and 1 is created by
sd_event_add_post().

 1. the process receives the 2 signals consecutively so that signal 'A' source
     event is queued and pending. Consequently the post source event is also
     queued and pending. This is done by sd_event_wait().

 2. The callback for signal 'A' is called by sd_event_dispatch().

 3. The next call to sd_event_wait() will queue signal 'B' source event.

 4. The callback for the post source event is called and calls sd_event_exit().

 5. the event loop is exited.

 6. freeing the event loop object will lead to the assertion failure in
     event_unmask_signal_data().

This patch simply removes this assertion as it doesn't seem to be a
bug if the signal data still reference a signal source at this point.

(cherry picked from commit 4470860388e12a5dda1d65773e411a349221a3e9)

6 years agoacl-util: fix memleak
Evgeny Vereshchagin [Thu, 3 Nov 2016 22:04:40 +0000 (22:04 +0000)]
acl-util: fix memleak

Fixes:
$ ./libtool --mode execute valgrind --leak-check=full ./journalctl >/dev/null
==22309== Memcheck, a memory error detector
==22309== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22309== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==22309== Command: /home/vagrant/elogind/.libs/lt-journalctl
==22309==
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'elogind-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
==22309==
==22309== HEAP SUMMARY:
==22309==     in use at exit: 8,680 bytes in 4 blocks
==22309==   total heap usage: 5,543 allocs, 5,539 frees, 9,045,618 bytes allocated
==22309==
==22309== 488 (56 direct, 432 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 4
==22309==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
==22309==    by 0x6F37A0A: __new_var_obj_p (__libobj.c:36)
==22309==    by 0x6F362F7: __acl_init_obj (acl_init.c:28)
==22309==    by 0x6F37731: __acl_from_xattr (__acl_from_xattr.c:54)
==22309==    by 0x6F36087: acl_get_file (acl_get_file.c:69)
==22309==    by 0x4F15752: acl_search_groups (acl-util.c:172)
==22309==    by 0x113A1E: access_check_var_log_journal (journalctl.c:1836)
==22309==    by 0x113D8D: access_check (journalctl.c:1889)
==22309==    by 0x115681: main (journalctl.c:2236)
==22309==
==22309== LEAK SUMMARY:
==22309==    definitely lost: 56 bytes in 1 blocks
==22309==    indirectly lost: 432 bytes in 1 blocks
==22309==      possibly lost: 0 bytes in 0 blocks
==22309==    still reachable: 8,192 bytes in 2 blocks
==22309==         suppressed: 0 bytes in 0 blocks

(cherry picked from commit 29d87223d54fc13e16f444677f0a94ed0755bd88)

6 years agologind: don't hit assert when we try to free NULL manager object
Lennart Poettering [Thu, 20 Oct 2016 17:19:46 +0000 (19:19 +0200)]
logind: don't hit assert when we try to free NULL manager object

Fixes: #4431
(cherry picked from commit 84a4e6608dbda38c724ab196a226db209a50b224)

6 years agoelogind: ignore lack of tty when checking whether colors should be enabled
Zbigniew Jędrzejewski-Szmek [Fri, 19 Aug 2016 02:03:56 +0000 (22:03 -0400)]
elogind: ignore lack of tty when checking whether colors should be enabled

When started by the kernel, we are connected to the console, and we'll set TERM
properly to some value in fixup_environment(). We'll then enable or disable
colors based on the value of $SYSTEMD_COLORS and $TERM.

When reexecuting, TERM should be already set, so we can use this value.
Effectively, behaviour is the same as before affd7ed1a was reverted, but instead
of reopening the console before configuring color output, we just ignore what
stdout is connected to and decide based on the variables only.

(cherry picked from commit 158fbf7661912adf0f42c93155499119811dde82)

6 years agoman: explain that *KeyIgnoreInhibited only apply to a subset of locks
Zbigniew Jędrzejewski-Szmek [Sun, 14 Aug 2016 20:27:59 +0000 (16:27 -0400)]
man: explain that *KeyIgnoreInhibited only apply to a subset of locks

Follow-up for #3924.

(cherry picked from commit 05b2a8fd7a0533758d2f532df798cabc3c442683)

6 years agoRevert "logind: really handle *KeyIgnoreInhibited options in logind.conf"
Mantas Mikulėnas [Mon, 8 Aug 2016 08:07:38 +0000 (11:07 +0300)]
Revert "logind: really handle *KeyIgnoreInhibited options in logind.conf"

This reverts commit 8121f4d209eca85dcb11830800483cdfafbef9b7.

The special 'key handling' inhibitors should always work regardless of
any *IgnoreInhibited settings – otherwise they're nearly useless.

Reverts: #3470
Fixes: #3897
(cherry picked from commit 06a70b918d4d753769a727239f75af8896006467)

6 years agologind: 0% and 100% should be valid for UserTasksMax (#3836)
Tejun Heo [Mon, 1 Aug 2016 01:38:47 +0000 (21:38 -0400)]
logind: 0% and 100% should be valid for UserTasksMax (#3836)

config_parse_user_tasks_max() was incorrectly accepting percentage value
between 1 and 99.  Update it to accept 0% and 100%.  This brings it in line
with TasksMax handling in elogind.
(cherry picked from commit cb3e4417590196bd30e1b8097348dca6ba34bd15)

6 years agov231.1 - mark commit before applying upstream stable patches.
Sven Eden [Mon, 19 Jun 2017 06:59:37 +0000 (08:59 +0200)]
v231.1 - mark commit before applying upstream stable patches.

6 years agoPrep v229.6: Send wakeup call to suspended processes.
Sven Eden [Thu, 15 Jun 2017 14:51:11 +0000 (16:51 +0200)]
Prep v229.6: Send wakeup call to suspended processes.

Somewhere in the update stream from 227.x to 228.x the sending of the
wakeup signal to sleeping processes got lost.

Re-add the sending of the wakeup signal.

Fixes issue 17
 ( https://github.com/elogind/elogind/issues/17 )

6 years agoPrep v231: Add missing line breaks in loginctl help text
Sven Eden [Wed, 14 Jun 2017 15:57:24 +0000 (17:57 +0200)]
Prep v231: Add missing line breaks in loginctl help text

6 years agoPrep v231: Update man pages to include upstream changes
Sven Eden [Wed, 14 Jun 2017 15:42:55 +0000 (17:42 +0200)]
Prep v231: Update man pages to include upstream changes

6 years agoPrep v231: Updated POT-Files to upstream version
Sven Eden [Mon, 12 Jun 2017 14:47:56 +0000 (16:47 +0200)]
Prep v231: Updated POT-Files to upstream version

6 years agoPrep v231: Add new files to Makefile.am and Code::Blocks project file.
Sven Eden [Wed, 14 Jun 2017 15:45:33 +0000 (17:45 +0200)]
Prep v231: Add new files to Makefile.am and Code::Blocks project file.

6 years agoPrep v231: Move elogind specific code in login/loginctl.c to login/eloginctl.c
Sven Eden [Wed, 14 Jun 2017 15:41:36 +0000 (17:41 +0200)]
Prep v231: Move elogind specific code in login/loginctl.c to login/eloginctl.c

6 years agoPrep v231: Reorganize elogind specific code in login/logind-action.c
Sven Eden [Wed, 14 Jun 2017 15:23:00 +0000 (17:23 +0200)]
Prep v231: Reorganize elogind specific code in login/logind-action.c

- Move elogind specific code in login/logind-action.c to
  login/elogind-action.c
- Remove login/logind-sleep.*
- Add src/sleep from upstream
- Integrate the systemd-sleep utility, so future fixes and updates
  will be easier to spot and to apply.

6 years agoPrep v231: Move elogind specific code in login/logind.c to login/elogind.c
Sven Eden [Wed, 14 Jun 2017 15:39:24 +0000 (17:39 +0200)]
Prep v231: Move elogind specific code in login/logind.c to login/elogind.c

6 years agoPrep v231: Move can_sleep() back to src/shared/sleep-config.c
Sven Eden [Wed, 14 Jun 2017 15:37:58 +0000 (17:37 +0200)]
Prep v231: Move can_sleep() back to src/shared/sleep-config.c

6 years agoPrep v231: Update build root files to upstream
Sven Eden [Mon, 12 Jun 2017 14:29:59 +0000 (16:29 +0200)]
Prep v231: Update build root files to upstream

6 years agoPrep v231: Minor fix for update-utmp
Sven Eden [Wed, 14 Jun 2017 15:21:19 +0000 (17:21 +0200)]
Prep v231: Minor fix for update-utmp

6 years agoPrep v231: Apply missing fixes from upstream (6/6) src/systemd
Sven Eden [Wed, 14 Jun 2017 15:44:53 +0000 (17:44 +0200)]
Prep v231: Apply missing fixes from upstream (6/6) src/systemd

6 years agoPrep v231: Apply missing fixes from upstream (5/6) src/shared
Sven Eden [Wed, 14 Jun 2017 15:44:53 +0000 (17:44 +0200)]
Prep v231: Apply missing fixes from upstream (5/6) src/shared

6 years agoPrep v231: Apply missing fixes from upstream (4/6) src/login
Sven Eden [Wed, 14 Jun 2017 15:44:53 +0000 (17:44 +0200)]
Prep v231: Apply missing fixes from upstream (4/6) src/login

6 years agoPrep v231: Apply missing fixes from upstream (3/6) src/libelogind
Sven Eden [Wed, 14 Jun 2017 15:44:53 +0000 (17:44 +0200)]
Prep v231: Apply missing fixes from upstream (3/6) src/libelogind

6 years agoPrep v231: Apply missing fixes from upstream (2/6) src/core
Sven Eden [Wed, 14 Jun 2017 15:44:53 +0000 (17:44 +0200)]
Prep v231: Apply missing fixes from upstream (2/6) src/core

6 years agoPrep v231: Apply missing fixes from upstream (1/6) src/basic
Sven Eden [Wed, 14 Jun 2017 15:44:53 +0000 (17:44 +0200)]
Prep v231: Apply missing fixes from upstream (1/6) src/basic

6 years agoPrep v231: Cleaned up tree
Sven Eden [Mon, 12 Jun 2017 14:47:37 +0000 (16:47 +0200)]
Prep v231: Cleaned up tree

6 years agofileio: imply /tmp as directory if passed as NULL to open_tmpfile_unlinkable()
Lennart Poettering [Mon, 25 Jul 2016 18:35:04 +0000 (20:35 +0200)]
fileio: imply /tmp as directory if passed as NULL to open_tmpfile_unlinkable()

We can make this smarter one day, to honour $TMPDIR and friends, but for now,
let's just use /tmp.

6 years agonamespace: don't fail on masked mounts (#3794)
Alban Crequy [Mon, 25 Jul 2016 13:39:46 +0000 (15:39 +0200)]
namespace: don't fail on masked mounts (#3794)

Before this patch, a service file with ReadWriteDirectories=/file...
could fail if the file exists but is not a mountpoint, despite being
listed in /proc/self/mountinfo. It could happen with masked mounts.

Fixes https://github.com/elogind/elogind/issues/3793

6 years agoUse "return log_error_errno" in more places"
Zbigniew Jędrzejewski-Szmek [Sat, 23 Jul 2016 00:27:45 +0000 (20:27 -0400)]
Use "return log_error_errno" in more places"

6 years agocgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy.
Alessandro Puccetti [Fri, 22 Jul 2016 10:00:49 +0000 (12:00 +0200)]
cgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy.

https://github.com/elogind/elogind/pull/3685 introduced
/run/elogind/inaccessible/{chr,blk} to map inacessible devices,
this patch allows elogind running inside a nspawn container to create
/run/elogind/inaccessible/{chr,blk}.

6 years agosd-id128: handle NULL return parameter in sd_id128_from_string() nicer
Lennart Poettering [Thu, 21 Jul 2016 18:23:51 +0000 (20:23 +0200)]
sd-id128: handle NULL return parameter in sd_id128_from_string() nicer

If the return parameter is NULL, simply validate the string, and return no
error.

6 years agosd-id128: split UUID file read/write code into new id128-util.[ch]
Lennart Poettering [Thu, 21 Jul 2016 15:57:57 +0000 (17:57 +0200)]
sd-id128: split UUID file read/write code into new id128-util.[ch]

We currently have code to read and write files containing UUIDs at various
places. Unify this in id128-util.[ch], and move some other stuff there too.

The new files are located in src/libelogind/sd-id128/ (instead of src/shared/),
because they are actually the backend of sd_id128_get_machine() and
sd_id128_get_boot().

In follow-up patches we can use this reduce the code in nspawn and
machine-id-setup by adopted the common implementation.

6 years agotree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate
Lennart Poettering [Thu, 21 Jul 2016 14:06:31 +0000 (16:06 +0200)]
tree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate

It's a bit easier to read because shorter. Also, most likely a tiny bit faster.

6 years agomissing_syscall: add __NR_copy_file_range for powerpc architecture (#3772)
Alessio Igor Bogani [Thu, 21 Jul 2016 09:40:35 +0000 (11:40 +0200)]
missing_syscall: add __NR_copy_file_range for powerpc architecture (#3772)

6 years agocore: remove duplicate includes (#3771)
Thomas H. P. Andersen [Thu, 21 Jul 2016 08:52:07 +0000 (10:52 +0200)]
core: remove duplicate includes (#3771)

6 years agocgroup: suppress sending follow-up SIGCONT after sending SIGCONT/SIGKILL anyway
Lennart Poettering [Wed, 20 Jul 2016 09:16:53 +0000 (11:16 +0200)]
cgroup: suppress sending follow-up SIGCONT after sending SIGCONT/SIGKILL anyway

6 years agocore: when forcibly killing/aborting left-over unit processes log about it
Lennart Poettering [Wed, 20 Jul 2016 09:16:05 +0000 (11:16 +0200)]
core: when forcibly killing/aborting left-over unit processes log about it

Let's lot at LOG_NOTICE about any processes that we are going to
SIGKILL/SIGABRT because clean termination of them didn't work.

This turns the various boolean flag parameters to cg_kill(), cg_migrate() and
related calls into a single binary flags parameter, simply because the function
now gained even more parameters and the parameter listed shouldn't get too
long.

Logging for killing processes is done either when the kill signal is SIGABRT or
SIGKILL, or on explicit request if KILL_TERMINATE_AND_LOG instead of LOG_TERMINATE
is passed. This isn't used yet in this patch, but is made use of in a later
patch.

6 years agoutil: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont()
Lennart Poettering [Wed, 20 Jul 2016 09:14:48 +0000 (11:14 +0200)]
util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont()

6 years agologind: change TasksMax= value for user logins to 33%
Lennart Poettering [Tue, 19 Jul 2016 15:19:58 +0000 (17:19 +0200)]
logind: change TasksMax= value for user logins to 33%

Let's change from a fixed value of 12288 tasks per user to a relative value of
33%, which with the kernel's default of 32768 translates to 10813. This is a
slight decrease of the limit, for no other reason than "33%" sounding like a nice
round number that is close enough to 12288 (which would translate to 37.5%).
(Well, it also has the nice effect of still leaving a bit of room in the PID
space if there are 3 cooperating evil users that try to consume all PIDs...
Also, I like my bikesheds blue).

Since the new value is taken relative, and machined's TasksMax= setting
defaults to 16384, 33% inside of containers is usually equivalent to 5406,
which should still be ample space.

To summarize:

               | on the host | in the container
   old default |       12288 |            12288
   new default |       10813 |             5406

6 years agobasic: fix whitespace
Thomas Hindoe Paaboel Andersen [Mon, 18 Jul 2016 20:14:23 +0000 (22:14 +0200)]
basic: fix whitespace

6 years agotree-wide: get rid of selinux_context_t (#3732)
Zbigniew Jędrzejewski-Szmek [Fri, 15 Jul 2016 16:44:02 +0000 (12:44 -0400)]
tree-wide: get rid of selinux_context_t (#3732)

https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9
deprecated selinux_context_t. Replace with a simple char* everywhere.

Alternative fix for #3719.

6 years agoconf-parser: minor coding style improvements
Lennart Poettering [Thu, 14 Jul 2016 10:24:59 +0000 (12:24 +0200)]
conf-parser: minor coding style improvements

6 years agobasic/mount-util: recognize ocfs2 as network fs (#3713)
Valentin Vidić [Thu, 14 Jul 2016 05:34:36 +0000 (07:34 +0200)]
basic/mount-util: recognize ocfs2 as network fs (#3713)

6 years agoVarious fixes for typos found by lintian (#3705)
Michael Biebl [Tue, 12 Jul 2016 10:52:11 +0000 (12:52 +0200)]
Various fixes for typos found by lintian (#3705)

6 years agotreewide: fix typos and remove accidental repetition of words
Torstein Husebø [Sun, 10 Jul 2016 12:48:23 +0000 (14:48 +0200)]
treewide: fix typos and remove accidental repetition of words

6 years agobasic: log: Increase static buffer for source file location (#3674)
Daniel Mack [Thu, 7 Jul 2016 04:30:34 +0000 (06:30 +0200)]
basic: log: Increase static buffer for source file location (#3674)

Commit d054f0a4 ("tree-wide: use xsprintf() where applicable") used a
semantic patch approach to change a number of locations from

  snprintf(buf, sizeof(buf), FMT, ...)

to

  xsprintf(buf, FMT, ...)

The problem is that xsprintf() wraps the snprintf() in an
assert_message_se(), so if snprintf() reports an overflow of the
destination buffer, the binary will now terminate.

This hit a user running a version of elogind that was built from a
deeply nested system path.

Fix this by

a) Switching back to snprintf() for this particular case. We should really
rather truncate the location string than crash in such situations.

b) Increasing the size of that static string buffer, to make the event more
unlikely.

6 years agonamespace: unify limit behavior on non-directory paths
Alessandro Puccetti [Wed, 6 Jul 2016 07:48:58 +0000 (09:48 +0200)]
namespace: unify limit behavior on non-directory paths

Despite the name, `Read{Write,Only}Directories=` already allows for
regular file paths to be masked. This commit adds the same behavior
to `InaccessibleDirectories=` and makes it explicit in the doc.
This patch introduces `/run/elogind/inaccessible/{reg,dir,chr,blk,fifo,sock}`
{dile,device}nodes and mounts on the appropriate one the paths specified
in `InacessibleDirectories=`.

Based on Luca's patch from https://github.com/elogind/elogind/pull/3327

6 years agotreewide: use stdio_unset_cloexec() function
Alexander Kuleshov [Sat, 2 Jul 2016 17:42:01 +0000 (23:42 +0600)]
treewide: use stdio_unset_cloexec() function

6 years agobasic/fd-util: introduce stdio_unset_cloexec() function
Alexander Kuleshov [Sat, 2 Jul 2016 17:38:47 +0000 (23:38 +0600)]
basic/fd-util: introduce stdio_unset_cloexec() function

There are some places in the elogind which are use the same pattern:

    fd_cloexec(STDIN_FILENO, false);
    fd_cloexec(STDOUT_FILENO, false);
    fd_cloexec(STDERR_FILENO, false);

to unset CLOEXEC for standard file descriptors. This patch introduces
the stdio_unset_cloexec() function to hide this and make code cleaner.

6 years agosd-bus: Fix a read after free error in bus-match. (#3624) (#3625)
Weng Xuetian [Wed, 29 Jun 2016 20:22:12 +0000 (13:22 -0700)]
sd-bus: Fix a read after free error in bus-match. (#3624) (#3625)

The loop on bus_match_run should break and return immediately if
bus->match_callbacks_modified is true. Otherwise the loop may access
free'd data.

6 years agoDrop parentheses in two places
Zbigniew Jędrzejewski-Szmek [Tue, 28 Jun 2016 19:12:01 +0000 (15:12 -0400)]
Drop parentheses in two places

6 years agoAdded Indonesian translation (#3615)
Andika Triwidada [Tue, 28 Jun 2016 08:14:27 +0000 (15:14 +0700)]
Added Indonesian translation (#3615)

6 years agobasic/strv: introduce STRV_IGNORE macro (#3601)
0xAX [Mon, 27 Jun 2016 21:26:07 +0000 (00:26 +0300)]
basic/strv: introduce STRV_IGNORE macro (#3601)

to hide casting of '-1' strings and make code cleaner.

6 years agobasic: pass flags to the fnmatch (#3606)
Evgeny Vereshchagin [Mon, 27 Jun 2016 12:47:37 +0000 (15:47 +0300)]
basic: pass flags to the fnmatch (#3606)

Fixes:
```
$ systemctl list-unit-files 'hey\*'

0 unit files listed.

$ systemctl list-unit-files | grep hey
hey\x7eho.service                          static
```

6 years agobasic/strv: use SWAP_TWO() macro (#3602)
0xAX [Sun, 26 Jun 2016 10:37:00 +0000 (13:37 +0300)]
basic/strv: use SWAP_TWO() macro (#3602)

6 years agotree-wide: some work-arounds for gcc false positives regarding uninitialized variables
Lennart Poettering [Tue, 21 Jun 2016 11:20:02 +0000 (13:20 +0200)]
tree-wide: some work-arounds for gcc false positives regarding uninitialized variables

6 years agocore: log the right set of the supported controllers (#3558)
Evgeny Vereshchagin [Mon, 20 Jun 2016 18:40:46 +0000 (21:40 +0300)]
core: log the right set of the supported controllers (#3558)

Jun 16 05:12:08 elogind[1]: Controller 'io' supported: yes
Jun 16 05:12:08 elogind[1]: Controller 'memory' supported: yes
Jun 16 05:12:08 elogind[1]: Controller 'pids' supported: yes

instead of

Jun 16 04:06:50 elogind[1]: Controller 'memory' supported: yes
Jun 16 04:06:50 elogind[1]: Controller 'devices' supported: yes
Jun 16 04:06:50 elogind[1]: Controller 'pids' supported: yes

6 years agoprocess-util: fix two bugs in get_process_cmdline() (#3555)
Lennart Poettering [Thu, 16 Jun 2016 20:46:44 +0000 (22:46 +0200)]
process-util: fix two bugs in get_process_cmdline() (#3555)

See:

https://github.com/elogind/elogind/pull/3529#issuecomment-226421007

6 years agosystemctl: make sure we terminate the bus connection first, and then close the pager...
Lennart Poettering [Thu, 16 Jun 2016 13:29:16 +0000 (15:29 +0200)]
systemctl: make sure we terminate the bus connection first, and then close the pager (#3550)

If "systemctl -H" is used, let's make sure we first terminate the bus
connection, and only then close the pager. If done in this order ssh will get
an EOF on stdin (as we speak D-Bus through ssh's stdin/stdout), and then
terminate. This makes sure the standard error we were invoked on is released by
ssh, and only that makes sure we don't deadlock on the pager which waits for
all clients closing its input pipe.

(Similar fixes for the various other xyzctl tools that support both pagers and
-H)

Fixes: #3543
6 years agosd-bus: make sure bus_map_all_properties() handle booleans right
Lennart Poettering [Wed, 15 Jun 2016 20:41:56 +0000 (22:41 +0200)]
sd-bus: make sure bus_map_all_properties() handle booleans right

sd-bus generally exposes bools as "int" instead of "bool" in the public API.
This is relevant when unmarshaling booleans, as the relevant functions expect
an int* pointer and no bool* pointer. Since sizeof(bool) is not necessarily the
same as sizeof(int) this is problematic and might result in memory corruption.

Let's fix this, and make sure bus_map_all_properties() handles booleans as
ints, as the rest of sd-bus, and make all users of it expect the right thing.

6 years agostring-table: make sure DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() handles NULL string...
Lennart Poettering [Wed, 15 Jun 2016 20:25:48 +0000 (22:25 +0200)]
string-table: make sure DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() handles NULL strings nicely

xyz_from_string() functions defined with DEFINE_STRING_TABLE_LOOKUP() properly
handle NULL strings already. make sure the equivalent functions defined with
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() do the same.

6 years agosocket-util: Run the fallback when the kernel complains about the null buffer (#3541)
Kai Ruhnau [Wed, 15 Jun 2016 10:33:24 +0000 (12:33 +0200)]
socket-util: Run the fallback when the kernel complains about the null buffer (#3541)

Calling recv with a NULL buffer returns EFAULT instead of EOPNOTSUPP on
older kernels (3.14).

Fixes #3407

Signed-off-by: Kai Ruhnau <kai.ruhnau@target-sg.com>
6 years agotree-wide: htonl() is weird, let's use htobe32() instead (#3538)
Lennart Poettering [Tue, 14 Jun 2016 23:26:01 +0000 (01:26 +0200)]
tree-wide: htonl() is weird, let's use htobe32() instead (#3538)

Super-important change, yeah!

6 years agoutil-lib: rework get_process_cmdline() (#3529)
Lennart Poettering [Tue, 14 Jun 2016 21:52:29 +0000 (23:52 +0200)]
util-lib: rework get_process_cmdline() (#3529)

This reworks get_process_cmdline() quite substantially, fixing the following:

- Fixes:
  https://github.com/elogind/elogind/pull/3512/commits/a4e3bf4d7ac2de51191ce136ee9361ba319e106c#r66837630

- The passed max_length is also applied to the "comm" name, if comm_fallback is
  set.

- The right thing happens if max_length == 1 is specified

- when the cmdline "foobar" is abbreviated to 6 characters the result is not
  "foobar" instead of "foo...".

- trailing whitespace are removed before the ... suffix is appended. The 7
  character abbreviation of "foo barz" is hence "foo..." instead of "foo ...".

- leading whitespace are suppressed from the cmdline

- a comprehensive test case is added

6 years agocore: set $JOURNAL_STREAM to the dev_t/ino_t of the journal stream of executed services
Lennart Poettering [Tue, 14 Jun 2016 14:50:45 +0000 (16:50 +0200)]
core: set $JOURNAL_STREAM to the dev_t/ino_t of the journal stream of executed services

This permits services to detect whether their stdout/stderr is connected to the
journal, and if so talk to the journal directly, thus permitting carrying of
metadata.

As requested by the gtk folks: #2473

6 years agobuild: fix missing symbol for old kernel headers (#3530)
Andrew Jeddeloh [Tue, 14 Jun 2016 09:09:06 +0000 (02:09 -0700)]
build: fix missing symbol for old kernel headers (#3530)

Fix issue where IN6_ADDR_GEN_MODE_STABLE_PRIVACY is undefined but
IFLA_INET6_ADDR_GEN_MODE is defined and thus the former does not get
fixed in missing.h. This occurs with kernel headers new enough to have
the IFLA_INET6_ADDR_GEN_MODE but old enough to not yet have
IN6_ADDR_GEN_MODE_STABLE_PRIVACY (e.g. 3.18).

6 years agounit-name: remove spurious newline
Lennart Poettering [Mon, 13 Jun 2016 16:47:42 +0000 (18:47 +0200)]
unit-name: remove spurious newline

6 years agocore: parse `rd.rescue` and `rd.emergency` as initrd-specific shorthands (#3488)
Ivan Shapovalov [Mon, 13 Jun 2016 14:28:42 +0000 (18:28 +0400)]
core: parse `rd.rescue` and `rd.emergency` as initrd-specific shorthands (#3488)

Typing `rd.rescue` is easier than `rd.elogind.unit=rescue.target`.

6 years agoutil-lib: drop trailing non-printable characters from cmdline (#3512)
Max Prokhorov [Mon, 13 Jun 2016 01:13:42 +0000 (04:13 +0300)]
util-lib: drop trailing non-printable characters from cmdline (#3512)

If max_length is equal or greater than cmdline length all trailing non-printable
characters are dropped. If max_length is 0 it should do the same.

This should also fix cmdline truncation if the last character is not '\0'.

Fixes #3469.

6 years agoprocess-util: remove broken support for pid==0
Zbigniew Jędrzejewski-Szmek [Mon, 13 Jun 2016 00:57:41 +0000 (20:57 -0400)]
process-util: remove broken support for pid==0

Our functions that query /proc/pid/ support using pid==0 to mean
self. get_process_id also seemed to support that, but it was not implemented
correctly: the result should be in *uid, not returned, and also it gave
completely bogus result when called from get_process_gid(). But afaict,
get_process_{uid,gid} were never called with pid==0, so it's not an actual
bug. Remove the broken code to avoid confusion.

6 years agoFixed a small typo in a comment (#3514)
Alex Gaynor [Sun, 12 Jun 2016 14:42:13 +0000 (10:42 -0400)]
Fixed a small typo in a comment (#3514)

6 years agoEnsure kdbus isn't used (#3501)
Dave Reisner [Fri, 10 Jun 2016 13:50:16 +0000 (09:50 -0400)]
Ensure kdbus isn't used (#3501)

Delete the dbus1 generator and some critical wiring. This prevents
kdbus from being loaded or detected. As such, it will never be used,
even if the user still has a useful kdbus module loaded on their system.

Sort of fixes #3480. Not really, but it's better than the current state.

6 years agonetworkd: added support for vrf interfaces (#3316)
Andreas Rammhold [Thu, 9 Jun 2016 23:57:51 +0000 (01:57 +0200)]
networkd: added support for vrf interfaces (#3316)

6 years agobus_util: add support to map double (#3479)
Susant Sahani [Thu, 9 Jun 2016 15:41:35 +0000 (21:11 +0530)]
bus_util: add support to map double (#3479)

Now we don't support parsing double at map_basic.
when trying to  use bus_message_map_all_properties with a double
this fails. Let's add it.