chiark / gitweb /
7 years agobus: return 1 on all calls that send messages
Lennart Poettering [Wed, 16 Oct 2013 04:04:20 +0000 (06:04 +0200)]
bus: return 1 on all calls that send messages

This way they are nicer to use from method dispatch callbacks as last
call, since method dispatch callbacks expect > 0 return if the message
got handled.

7 years agobus: make sure sd_bus_get_timeout() returns a 0 timeout of there are already read...
Lennart Poettering [Wed, 16 Oct 2013 04:01:46 +0000 (06:01 +0200)]
bus: make sure sd_bus_get_timeout() returns a 0 timeout of there are already read but not dispatched messages

7 years agobus: fix generate introspection XML
Lennart Poettering [Wed, 16 Oct 2013 03:59:21 +0000 (05:59 +0200)]
bus: fix generate introspection XML

7 years agobus: extend bus protocol definitions a bit
Lennart Poettering [Wed, 16 Oct 2013 03:58:28 +0000 (05:58 +0200)]
bus: extend bus protocol definitions a bit

7 years agoevent: handle arbitrary signals received during epoll gracefully
Lennart Poettering [Wed, 16 Oct 2013 03:57:41 +0000 (05:57 +0200)]
event: handle arbitrary signals received during epoll gracefully

7 years agoevent: properly disarm timers when we don't need them anymore
Lennart Poettering [Wed, 16 Oct 2013 03:57:05 +0000 (05:57 +0200)]
event: properly disarm timers when we don't need them anymore

7 years agoevent: fix sd_event_source_set_io_events()
Lennart Poettering [Wed, 16 Oct 2013 03:56:37 +0000 (05:56 +0200)]
event: fix sd_event_source_set_io_events()

7 years agomacro: clean up usage of gcc attributes
Lennart Poettering [Wed, 16 Oct 2013 01:17:09 +0000 (03:17 +0200)]
macro: clean up usage of gcc attributes

Always use our own macros, and name all our own macros the same style.

7 years agorules: don't limit some of the rules to the "add" action
Lennart Poettering [Wed, 16 Oct 2013 00:51:24 +0000 (02:51 +0200)]
rules: don't limit some of the rules to the "add" action

Devices should show up in systemd regardless whether the user invoked
"udevadm trigger" or not. Before this change some devices might have
suddenly disappeared due issuing that command.

7 years agorules: expose loop block devices to systemd
Lennart Poettering [Wed, 16 Oct 2013 00:49:54 +0000 (02:49 +0200)]
rules: expose loop block devices to systemd

Since the kernel no longer exposes a large number of "dead" loop devices
it is OK to expose them now in systemd, so let's do that. This has the
benefit that mount dependencies on loop devices start to work.

7 years agosaproxy: Fix for systemd's event library not deduping fds.
David Strauss [Wed, 16 Oct 2013 01:55:25 +0000 (18:55 -0700)]
saproxy: Fix for systemd's event library not deduping fds.

7 years agoBump up the saproxy buffer to 16kB.
David Strauss [Wed, 16 Oct 2013 00:29:51 +0000 (17:29 -0700)]
Bump up the saproxy buffer to 16kB.

7 years agoRename sabridge to saproxy to be less cryptic
David Strauss [Wed, 16 Oct 2013 00:00:18 +0000 (17:00 -0700)]
Rename sabridge to saproxy to be less cryptic

7 years agoUpdate TODOs with follow-up sabridge work.
David Strauss [Tue, 15 Oct 2013 23:25:45 +0000 (16:25 -0700)]
Update TODOs with follow-up sabridge work.

7 years agoAdd sabridge for socket activation of traditional daemons
David Strauss [Mon, 14 Oct 2013 23:41:47 +0000 (16:41 -0700)]
Add sabridge for socket activation of traditional daemons

7 years agologind: allow unprivileged session-device access
David Herrmann [Tue, 15 Oct 2013 19:13:39 +0000 (21:13 +0200)]
logind: allow unprivileged session-device access

The session-device/control API was introduced for unprivileged device
access from within a session. Add the required dbus policy to the default
logind policies.

Note: logind validates that only root and the user of a session can
use the API. Furthermore, only a single API user gets access at a time.

7 years agoman: document the -b special boot option
Jan Engelhardt [Tue, 15 Oct 2013 06:58:50 +0000 (08:58 +0200)]
man: document the -b special boot option

7 years agoFix for SIGSEGV in systemd-bootchart on short-living processes
Igor Zhbanov [Tue, 15 Oct 2013 10:35:13 +0000 (14:35 +0400)]
Fix for SIGSEGV in systemd-bootchart on short-living processes

The function svg_ps_bars() dereferencess NULL pointer in the line
endtime = ps->last->sampledata->sampletime;
because of partially initialized ps_struct (ps->last == NULL).

If some process terminates between scaning /proc directory in the log_sample()
function and reading additional information from /proc/PID/... files,
the files couldn't be read, the loop will be continued and partially
initialized structure returned.

7 years agoman: wording and grammar updates
Jan Engelhardt [Tue, 15 Oct 2013 06:58:51 +0000 (08:58 +0200)]
man: wording and grammar updates

This is a recurring submission and includes corrections to various
issue spotted. I guess I can just skip over reporting ubiquitous comma
placement fixes…

7 years agoFix misspellings with codespell tool
Anatol Pomozov [Mon, 14 Oct 2013 23:12:29 +0000 (16:12 -0700)]
Fix misspellings with codespell tool

7 years agobuild-sys: libsystemd-id128 - get rid of the needless selinux linking (again)
Kay Sievers [Tue, 15 Oct 2013 00:26:37 +0000 (02:26 +0200)]
build-sys: libsystemd-id128 - get rid of the needless selinux linking (again)

$ ldd =>  (0x00007fffce377000) => /lib64/ (0x00007f4de1fc1000) => /lib64/ (0x00007f4de1db9000) => /lib64/ (0x00007f4de1bb4000) => /lib64/ (0x00007f4de17f5000)
        /lib64/ (0x00007f4de2406000) => /lib64/ (0x00007f4de158f000) => /lib64/ (0x00007f4de1371000)

$ ldd =>  (0x00007fff25187000) => /lib64/ (0x00007f41a3964000) => /lib64/ (0x00007f41a35a5000)
        /lib64/ (0x00007f41a3d89000)

7 years agobuild-sys: libudev - get rid of the needless selinux linking (again)
Kay Sievers [Tue, 15 Oct 2013 00:11:56 +0000 (02:11 +0200)]
build-sys: libudev - get rid of the needless selinux linking (again)

7 years agoFix bad assert in show_pid_array
Zbigniew Jędrzejewski-Szmek [Mon, 14 Oct 2013 23:15:24 +0000 (19:15 -0400)]
Fix bad assert in show_pid_array

This function should get the same treatment as other qsort uses
did in 7ff7394 "Never call qsort on potentially NULL arrays".

Reported-by: Oleksii Shevchuk <>
7 years agobus: properly handle if new objects are installed in the node tree while we are dispa...
Lennart Poettering [Mon, 14 Oct 2013 19:58:06 +0000 (21:58 +0200)]
bus: properly handle if new objects are installed in the node tree while we are dispatching to one

7 years agobus: make sure that we always keep a ref to the bus when we dispatch callbacks
Lennart Poettering [Mon, 14 Oct 2013 17:53:56 +0000 (19:53 +0200)]
bus: make sure that we always keep a ref to the bus when we dispatch callbacks

Otherwise the callback might unref the bus we are processing and destroy
the object while we are processing it.

7 years agobus: use assert_return() for more API calls
Lennart Poettering [Mon, 14 Oct 2013 17:40:37 +0000 (19:40 +0200)]
bus: use assert_return() for more API calls

7 years agogit: add test-ellipsize to files to ignore by git
Lennart Poettering [Mon, 14 Oct 2013 17:02:11 +0000 (19:02 +0200)]
git: add test-ellipsize to files to ignore by git

7 years agobacklight: include ID_PATH in file names for backlight settings
Lennart Poettering [Mon, 14 Oct 2013 17:01:09 +0000 (19:01 +0200)]
backlight: include ID_PATH in file names for backlight settings

Much like for rfkill devices we should provide some stability regarding
enumeration order, hence include the stable bits of the device path in
the file name we store settings under.

7 years agorfkill: use ID_PATH as identifier for rfkill state files
Lennart Poettering [Mon, 14 Oct 2013 16:52:07 +0000 (18:52 +0200)]
rfkill: use ID_PATH as identifier for rfkill state files

Let's include the stable device path for the rfkill devices in the name
of the file we store the rfkill state in, so that we have some stability
regarding enumeration order.

7 years agoshared/util: Fix glob_extend() argument
Bastien Nocera [Mon, 14 Oct 2013 06:15:51 +0000 (08:15 +0200)]
shared/util: Fix glob_extend() argument

glob_extend() would completely fail to work, or return incorrect
data if it wasn't being passed the current getopt "optarg" variable
as it used the global variable, instead of the passed parameters.

7 years agolist: make our list macros a bit easier to use by not requring type spec on each...
Lennart Poettering [Mon, 14 Oct 2013 04:10:14 +0000 (06:10 +0200)]
list: make our list macros a bit easier to use by not requring type spec on each invocation

We can determine the list entry type via the typeof() gcc construct, and
so we should to make the macros much shorter to use.

7 years agoutil: allow trailing semicolons on define_trivial_cleanup_func lines
Lennart Poettering [Mon, 14 Oct 2013 02:59:26 +0000 (04:59 +0200)]
util: allow trailing semicolons on define_trivial_cleanup_func lines

Emacs C indenting really gets confused by these lines if they carry no
trailing semicolon, hence let's make this nicer for good old emacs. The
other macros which define functions already do this too, so let's copy
the scheme here.

Also, let's use an uppercase name for the macro. So far our rough rule
was that macros that are totally not function-like (like this ones,
which define a function) are uppercase. (Well, admittedly it is a rough
rule only, for example function and variable decorators are all
also they at least got underscore prefixes.) Also, the macros that
define functions that we already have are all uppercase, so let's do the
same here...

7 years agoupdate TODO
Lennart Poettering [Mon, 14 Oct 2013 02:52:51 +0000 (04:52 +0200)]
update TODO

7 years agomanager: connect to private bus even if $DBUS_SESSION_BUS_ADDRESS is not set
Mantas Mikulėnas [Wed, 9 Oct 2013 11:57:12 +0000 (14:57 +0300)]
manager: connect to private bus even if $DBUS_SESSION_BUS_ADDRESS is not set

Because that's exactly the kind of situation where the private bus is

7 years agorfkill: add new rfkill tool to save/restore rfkill state across reboots
Lennart Poettering [Mon, 14 Oct 2013 02:31:49 +0000 (04:31 +0200)]
rfkill: add new rfkill tool to save/restore rfkill state across reboots

This works analogous to the existing backlight and random seed services

7 years agobacklight: always prefer "firmware"/"platform" backlights over "raw" backlights if...
Lennart Poettering [Mon, 14 Oct 2013 00:12:52 +0000 (02:12 +0200)]
backlight: always prefer "firmware"/"platform" backlights over "raw" backlights if we have both for the same device

7 years agoman: add more markup to udevadm(8)
Zbigniew Jędrzejewski-Szmek [Sun, 13 Oct 2013 23:43:19 +0000 (19:43 -0400)]
man: add more markup to udevadm(8)

7 years agoevent: avoid derefencing null pointer
Zbigniew Jędrzejewski-Szmek [Sun, 13 Oct 2013 21:41:24 +0000 (17:41 -0400)]
event: avoid derefencing null pointer

7 years agobus: make sure we don't try to malloc 0 bytes
Zbigniew Jędrzejewski-Szmek [Sun, 13 Oct 2013 21:40:34 +0000 (17:40 -0400)]
bus: make sure we don't try to malloc 0 bytes

7 years agoIntroduce udev object cleanup functions
Zbigniew Jędrzejewski-Szmek [Sun, 13 Oct 2013 00:28:21 +0000 (20:28 -0400)]
Introduce udev object cleanup functions

7 years agogitignore: ignore clang --analyze output
Zbigniew Jędrzejewski-Szmek [Sat, 12 Oct 2013 23:50:54 +0000 (19:50 -0400)]
gitignore: ignore clang --analyze output

7 years agoMake sure that we don't dereference NULL
Zbigniew Jędrzejewski-Szmek [Sat, 12 Oct 2013 17:43:07 +0000 (13:43 -0400)]
Make sure that we don't dereference NULL

The code was actually safe, because b should
never be null, because if rvalue is empty, a different
branch is taken. But we *do* check for NULL in the
loop above, so it's better to also check here for symmetry.

7 years agoudev: use initialization instead of zeroing in one place
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:34:21 +0000 (19:34 -0400)]
udev: use initialization instead of zeroing in one place

7 years agoFix write-only use of a few variables
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:34:17 +0000 (19:34 -0400)]
Fix write-only use of a few variables

Since the invention of read-only memory, write-only memory has been
considered deprecated. Where appropriate, either make use of the
value, or avoid writing it, to make it clear that it is not used.

7 years agoIntroduce _cleanup_fdset_free_
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:33:48 +0000 (19:33 -0400)]
Introduce _cleanup_fdset_free_

7 years agobus: fix access to unitialized variable in error path
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:33:43 +0000 (19:33 -0400)]
bus: fix access to unitialized variable in error path

src/machine/machined-dbus.c:237:13: warning: Branch condition evaluates to a garbage value
        if (m)

7 years agodrop-ins: check return value
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:33:36 +0000 (19:33 -0400)]
drop-ins: check return value

If the function failed, nothing serious would happen
because unlink would probably return EFAULT, but this
would obscure the real error and is a bit sloppy.

7 years agojournald: use greedy_realloc in one place
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:33:30 +0000 (19:33 -0400)]
journald: use greedy_realloc in one place

7 years agodbus-common: avoid leak in error path
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:33:20 +0000 (19:33 -0400)]
dbus-common: avoid leak in error path

src/shared/dbus-common.c:968:33: warning: Potential leak of memory pointed to by 'l'
                        return -EINVAL;

7 years agoModernization
Zbigniew Jędrzejewski-Szmek [Sat, 12 Oct 2013 16:15:49 +0000 (12:15 -0400)]

Fixes minor leak in error path in device.c.

7 years agoNever call qsort on potentially NULL arrays
Zbigniew Jędrzejewski-Szmek [Fri, 11 Oct 2013 23:33:13 +0000 (19:33 -0400)]
Never call qsort on potentially NULL arrays

This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.

7 years agounicode: treat cute symbol block as fullwidth
Zbigniew Jędrzejewski-Szmek [Sun, 6 Oct 2013 01:44:31 +0000 (21:44 -0400)]
unicode: treat cute symbol block as fullwidth

UNICODE standards only talk about fullwidth characters for East
Asian scripts. But it seems that all those symbols are fullwidth

7 years agotest: test for ellipsize
Shawn Landden [Sat, 21 Sep 2013 01:37:34 +0000 (18:37 -0700)]
test: test for ellipsize

7 years agoutil, utf8: make ellipsize take multi-byte characters into account
Shawn Landden [Sat, 21 Sep 2013 01:37:33 +0000 (18:37 -0700)]
util, utf8: make ellipsize take multi-byte characters into account

rename old versions to ascii_*

Do not take into account zerowidth characters, but do consider double-wide characters.
Import needed utf8 helper code from glib.

v3: rebase ontop of utf8 restructuring work

[zj: tweak the algorithm a bit, move new code to separate file]

7 years agoudevadm.xml: document --resolve-names option for test
Dave Reisner [Sun, 13 Oct 2013 21:42:51 +0000 (17:42 -0400)]
udevadm.xml: document --resolve-names option for test

And remove documentation of the --subsystem flag which doesn't actually

7 years agobus: properly implement logic for generating InterfacesAdded/InterfacesRemoved signal...
Lennart Poettering [Fri, 11 Oct 2013 21:22:29 +0000 (23:22 +0200)]
bus: properly implement logic for generating InterfacesAdded/InterfacesRemoved signals of ObjectManager

7 years agobus: in GetManagedObjects() only return each object once.
Lennart Poettering [Fri, 11 Oct 2013 21:21:22 +0000 (23:21 +0200)]
bus: in GetManagedObjects() only return each object once.

7 years agobus: unify code to find parents of an object path with
Lennart Poettering [Fri, 11 Oct 2013 21:20:54 +0000 (23:20 +0200)]
bus: unify code to find parents of an object path with

7 years agobus: properly generate GetAll reply
Lennart Poettering [Fri, 11 Oct 2013 21:19:40 +0000 (23:19 +0200)]
bus: properly generate GetAll reply

7 years agobus: add sd_bus_message_append_strv() to easily add a NULL terminated string array...
Lennart Poettering [Fri, 11 Oct 2013 21:02:47 +0000 (23:02 +0200)]
bus: add sd_bus_message_append_strv() to easily add a NULL terminated string array to a message

7 years agobus: make sure introspection can be generated correctly with NULL method signatures
Lennart Poettering [Fri, 11 Oct 2013 21:01:35 +0000 (23:01 +0200)]
bus: make sure introspection can be generated correctly with NULL method signatures

7 years agobus: beef up parameter checking in vtable handling
Lennart Poettering [Fri, 11 Oct 2013 19:27:59 +0000 (21:27 +0200)]
bus: beef up parameter checking in vtable handling

7 years agobus: beef up parameter checking of convenience calls
Lennart Poettering [Fri, 11 Oct 2013 18:49:19 +0000 (20:49 +0200)]
bus: beef up parameter checking of convenience calls

7 years agobus: don't rely on gccisms/c11 in public header files.
Lennart Poettering [Fri, 11 Oct 2013 18:32:16 +0000 (20:32 +0200)]
bus: don't rely on gccisms/c11 in public header files.

One day sd-bus.h should become a public header file. We generally try to
be conservative in language features we use in public headers (much
unlike in private code), hence don't make use of anonymous unions in
structs for the vtable definitions.

7 years agobus: split up overly long sd-bus.c into three files
Lennart Poettering [Fri, 11 Oct 2013 18:18:10 +0000 (20:18 +0200)]
bus: split up overly long sd-bus.c into three files

7 years agobus: if a a Set() vtable callback of a writable is left NULL, try to do the right...
Lennart Poettering [Fri, 11 Oct 2013 18:02:16 +0000 (20:02 +0200)]
bus: if a a Set() vtable callback of a writable is left NULL, try to do the right thing automatically

7 years agobus: automatically do a NOP reply when a NULL callback is specified for a method...
Lennart Poettering [Fri, 11 Oct 2013 17:33:39 +0000 (19:33 +0200)]
bus: automatically do a NOP reply when a NULL callback is specified for a method in a vtable

Also, allow specifiying NULL as signature in vtables equivalent to ""
for empty parameter lists.

7 years agoAdd support for saving/restoring keyboard backlights
Bastien Nocera [Fri, 11 Oct 2013 07:45:32 +0000 (09:45 +0200)]
Add support for saving/restoring keyboard backlights

Piggy-backing on the display backlight code, this saves and restores
keyboard backlights on supported devices.

The detection code matches that of UPower:

[tomegun: also work for devices named "{smc,samsung,asus}::kbd_backlight"]

7 years agoudev: usb_id - remove obsoleted bInterfaceSubClass == 5 match
Kay Sievers [Fri, 11 Oct 2013 09:23:34 +0000 (11:23 +0200)]
udev: usb_id - remove obsoleted bInterfaceSubClass == 5 match

bInterfaceSubClass == 5 is not a "floppy"; just identify the obsolete
QIC-157 interface as "generic".

7 years agosmack: minimize ifdef use, and move all labeling to smack-util.c
Kay Sievers [Fri, 11 Oct 2013 07:47:31 +0000 (09:47 +0200)]
smack: minimize ifdef use, and move all labeling to smack-util.c

7 years agobus: when NULL is specified as property callback, automatically handle serialization...
Lennart Poettering [Fri, 11 Oct 2013 04:10:15 +0000 (06:10 +0200)]
bus: when NULL is specified as property callback, automatically handle serialization on Get()

7 years agobus: make PropertiesChanged emission work
Lennart Poettering [Fri, 11 Oct 2013 03:22:00 +0000 (05:22 +0200)]
bus: make PropertiesChanged emission work

7 years agobus: decorate API calls with gcc attributes where appropriate
Lennart Poettering [Fri, 11 Oct 2013 03:21:08 +0000 (05:21 +0200)]
bus: decorate API calls with gcc attributes where appropriate

7 years agobus: allow specifying NULL as type string when we want to construct messages with...
Lennart Poettering [Fri, 11 Oct 2013 03:20:24 +0000 (05:20 +0200)]
bus: allow specifying NULL as type string when we want to construct messages with no payload

7 years agobus: make GetManagedObjects() work
Lennart Poettering [Fri, 11 Oct 2013 02:52:38 +0000 (04:52 +0200)]
bus: make GetManagedObjects() work

7 years agoevent: add apis to query the timestamp of the event currently processed
Lennart Poettering [Fri, 11 Oct 2013 02:36:02 +0000 (04:36 +0200)]
event: add apis to query the timestamp of the event currently processed

7 years agoevent: move all library calls over to new assert_return() macro
Lennart Poettering [Fri, 11 Oct 2013 00:11:30 +0000 (02:11 +0200)]
event: move all library calls over to new assert_return() macro

7 years agoevent: add sd_event_source_get_child_pid() call to query the PID of a child event...
Lennart Poettering [Thu, 10 Oct 2013 23:33:25 +0000 (01:33 +0200)]
event: add sd_event_source_get_child_pid() call to query the PID of a child event source

7 years agoevent: rename the "mute" field of event sources to "enabled"
Lennart Poettering [Thu, 10 Oct 2013 23:08:15 +0000 (01:08 +0200)]
event: rename the "mute" field of event sources to "enabled"

In addition, the states "UNMUTED" and "MUTED" become "ON" and "OFF".

This has the benefit that a possible value of this field is not
identical to its name, thus minimizing confusion.

7 years agoevent: implement quit handlers
Lennart Poettering [Thu, 10 Oct 2013 22:49:11 +0000 (00:49 +0200)]
event: implement quit handlers

Quit handlers are executed when an event loop is terminated via
sd_event_request_quit(). They are in a way atexit() handlers that are
executed in a well-defined environment, time and thread: from the event
loop thread when the event loop finishes.

7 years agomacro: add new assert_return() macro for early parameter checking in functions
Lennart Poettering [Thu, 10 Oct 2013 22:45:47 +0000 (00:45 +0200)]
macro: add new assert_return() macro for early parameter checking in functions

For the library functions we expose we currently repeatedly use checks
like the following:

if (!value_is_ok(parameter1))
        return -EINVAL;
if (!value_is_ok(parameter2))
        return -EINVAL;

And so on. Let's turn this into a macro:

assert_return(value_is_ok(parameter1), -EINVAL);
assert_return(value_is_ok(paramater2), -EINVAL);

This makes our code a bit shorter and simpler, and also allows us to add
a _unlikely_() around the check.

7 years agoevent: refuse operation if the caller tries to reuse an event loop after a fork()
Lennart Poettering [Thu, 10 Oct 2013 19:37:50 +0000 (21:37 +0200)]
event: refuse operation if the caller tries to reuse an event loop after a fork()

7 years agoevent: add timer accuracy/coalescing logic
Lennart Poettering [Thu, 10 Oct 2013 19:16:21 +0000 (21:16 +0200)]
event: add timer accuracy/coalescing logic

In order to improve energy consumption we should minimize our wake-ups
when handling timers.  Hence, for each timer take an accuracy value and
schedule the actual wake-up time somewhere between the specified time
and the specified timer plus the accuracy.

The specified time of timer event sources hence becomes the time the
handler is called the *earliest*, and the specified time plus the accuracy
the time by which it is called the *latest*, leaving the library the
freedom to schedule the wake-up somewhere inbetween.

If the accuracy is specified as 0 the default of 250ms will be used.

When scheduling timeouts we will now try to elapse them at the same
point within each second, across the entire system. We do this by using
a fixed perturbation value keyed off the boot id. If this point within a
second is not in the acceptable range, we try again with a fixed time
within each 250ms time step. If that doesn't work either, we wake up at
the last possible time.

7 years agosecurity: missing header inclusions
Lennart Poettering [Thu, 10 Oct 2013 19:13:31 +0000 (21:13 +0200)]
security: missing header inclusions

7 years agobus: fix duplicate comparisons
Tero Roponen [Thu, 10 Oct 2013 05:14:24 +0000 (08:14 +0300)]
bus: fix duplicate comparisons

Testing for y > x is the same as testing for x < y.

7 years agosecurity: rework selinux, smack, ima, apparmor detection logic
Lennart Poettering [Thu, 10 Oct 2013 14:35:44 +0000 (16:35 +0200)]
security: rework selinux, smack, ima, apparmor detection logic

Always cache the results, and bypass low-level security calls when the
respective subsystem is not enabled.

7 years agologin: make sd_session_get_vt() actually work
David Herrmann [Thu, 10 Oct 2013 11:11:27 +0000 (13:11 +0200)]
login: make sd_session_get_vt() actually work

We use VTNR, not VTNr as key. Until now sd_session_get_vt() just returns
an error.

7 years agologin: fix invalid free() in sd_session_get_vt()
David Herrmann [Thu, 10 Oct 2013 11:09:37 +0000 (13:09 +0200)]
login: fix invalid free() in sd_session_get_vt()

We need to clear variables markes as _cleanup_free_. Otherwise, our
error-paths might corrupt random memory.

7 years agobus: add minimal event loop API
Lennart Poettering [Thu, 10 Oct 2013 02:40:28 +0000 (04:40 +0200)]
bus: add minimal event loop API

So far we tried to use epoll directly wherever we needed an event loop.
However, that has various shortcomings, such as the inability to handle
larger amounts of timers (since each timerfd costs one fd, which is a
very limited resource, usually bounded to 1024), and inability to do
priorisation between multiple queued events.

Let's add a minimal event loop API around epoll that is suitable for
implementation of our own daemons and maybe one day can become public
API for those who desire it.

This loop is part of libsystemd-bus, but may be used independently of

7 years agojournald: remove rotated file from hashmap when rotation fails
Zbigniew Jędrzejewski-Szmek [Thu, 10 Oct 2013 02:13:13 +0000 (22:13 -0400)]
journald: remove rotated file from hashmap when rotation fails

Before, when the user journal file was rotated, journal_file_rotate
could close the old file and fail to open the new file. In that
case, we would leave the old (deallocated) file in the hashmap.
On subsequent accesses, we could retrieve this stale entry, leading
to a segfault.

When journal_file_rotate fails with the file pointer set to 0,
old file is certainly gone, and cannot be used anymore.

7 years agojournald: replace new+snprintf with asprintf
Zbigniew Jędrzejewski-Szmek [Thu, 10 Oct 2013 02:13:04 +0000 (22:13 -0400)]
journald: replace new+snprintf with asprintf

7 years agodo not accept "garbage" from acpi firmware performance data (FPDT)
Kay Sievers [Wed, 9 Oct 2013 23:38:11 +0000 (01:38 +0200)]
do not accept "garbage" from acpi firmware performance data (FPDT)

00000000  46 42 50 54 38 00 00 00  02 00 30 02 00 00 00 00  |FBPT8.....0.....|
00000010  23 45 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |#E..............|
00000020  f5 6a 51 00 00 00 00 00  00 00 00 00 00 00 00 00  |.jQ.............|
00000030  00 00 00 00 00 00 00 00  70 74 61 6c 58 00 00 00  |........ptalX...|

7 years agoSmack: Test if smack is enabled before mounting
Auke Kok [Wed, 9 Oct 2013 17:52:15 +0000 (10:52 -0700)]
Smack: Test if smack is enabled before mounting

Since on most systems with xattr systemd will compile with Smack
support enabled, we still attempt to mount various fs's with
Smack-only options.

Before mounting any of these Smack-related filesystems with
Smack specific mount options, check if Smack is functionally
active on the running kernel.

If Smack is really enabled in the kernel, all these Smack mounts
are now *fatal*, as they should be.

We no longer mount smackfs if systemd was compiled without
Smack support. This makes it easier to make smackfs mount
failures a critical error when Smack is enabled.

We no longer mount these filesystems with their Smack specific
options inside containers. There these filesystems will be
mounted with there non-mount smack options for now.

7 years agoudev: add SECLABEL{selinux}= support
Kay Sievers [Wed, 9 Oct 2013 15:31:00 +0000 (17:31 +0200)]
udev: add SECLABEL{selinux}= support

7 years agokeymap: Fix Samsung 900X[34]C
Martin Pitt [Wed, 9 Oct 2013 14:05:15 +0000 (16:05 +0200)]
keymap: Fix Samsung 900X[34]C

It appears that it's not really the 900 vs. 940 or the X3 vs X4, but the
A/B/C/D suffix after that which makes the difference between the keymaps. On a
NP900X3C-A04RU you get


So change the matches to use AB vs. CDG as the differentiator.

Thanks to Anatoly Markov for reporting and testing!

7 years agoudev: reset Linux Security Module labels if no custom rules are given
Kay Sievers [Wed, 9 Oct 2013 02:17:39 +0000 (04:17 +0200)]
udev: reset Linux Security Module labels if no custom rules are given

7 years agobus: fix missing initialization
Lennart Poettering [Wed, 9 Oct 2013 02:04:10 +0000 (04:04 +0200)]
bus: fix missing initialization

7 years agotests: fix some memory leaks in tests
Lennart Poettering [Wed, 9 Oct 2013 02:04:04 +0000 (04:04 +0200)]
tests: fix some memory leaks in tests

7 years agojournald: fix minor memory leak
Lennart Poettering [Wed, 9 Oct 2013 02:03:45 +0000 (04:03 +0200)]
journald: fix minor memory leak

7 years agobuild-sys: add a makefile target to run all tests through valgrind
Lennart Poettering [Wed, 9 Oct 2013 02:02:54 +0000 (04:02 +0200)]
build-sys: add a makefile target to run all tests through valgrind