chiark / gitweb /
elogind.git
7 years agonetworkd: tap add support for vnet_hdr
Susant Sahani [Tue, 14 Jul 2015 08:25:52 +0000 (13:55 +0530)]
networkd: tap add support for vnet_hdr

 This patch adds support to configure IFF_VNET_HDR flag
for a tap device. It allows whether sending and receiving
large pass larger (GSO) packets. This greatly increases the
achievable throughput.

7 years agodoc: configure docbook stylesheet to generate reproducible IDs
Johan Ouwerkerk [Mon, 13 Jul 2015 08:39:09 +0000 (10:39 +0200)]
doc: configure docbook stylesheet to generate reproducible IDs

This makes auto generated anchor tags in HTML output reproducible.

7 years agoUse a top-to-bottom numbering scheme for generating ids of subheadings and terms...
Johan Ouwerkerk [Sun, 12 Jul 2015 01:07:24 +0000 (03:07 +0200)]
Use a top-to-bottom numbering scheme for generating ids of subheadings and terms. This scheme fixes permalinks to distinguish between items that would previously have the same ID attribute.

Where possible the generated ID values are the same as those generated with the previous versions of the stylesheet
to retain backwards compatibility with published links.

As a side effect of the changes xsltproc should no longer complain about duplicate IDs during build.

7 years agologind: bring bus policy up-to-date
Lennart Poettering [Sat, 11 Jul 2015 20:00:26 +0000 (17:00 -0300)]
logind: bring bus policy up-to-date

A while back we opened up all of logind's bus calls to unprivileged
users, via PK. However, the dbus1 policy wasn't updated accordingly.

With this change, the dbus1 policy is opened up for all bus calls that
should be available to unprivileged clients.

(also rearranges some calls in the vtable, to make more sense, and be in
line with the order in the bus policy file)

Fixes #471.

7 years agoresolved: use a #define for LLMNR port
Daniel Mack [Fri, 10 Jul 2015 19:28:09 +0000 (15:28 -0400)]
resolved: use a #define for LLMNR port

De-duplicate some magic numbers.

7 years agoresolved: move LLMNR related functions into separate file
Daniel Mack [Fri, 10 Jul 2015 19:02:38 +0000 (15:02 -0400)]
resolved: move LLMNR related functions into separate file

7 years agologind: rename 'pos' to 'position'
David Herrmann [Fri, 10 Jul 2015 13:08:24 +0000 (15:08 +0200)]
logind: rename 'pos' to 'position'

Spell out the proper name. Use 'pos' over 'position', and also update the
logind state file to do the same. Note that this breaks live updates.
However, we only save 'POSITION' on non-seat0, so this shouldn't bother
anyone for real. If you run multi-seat setups, you better restart a
machine on updates, anyway.

7 years agologind: allow greeters to take over VTs
David Herrmann [Fri, 10 Jul 2015 12:53:08 +0000 (14:53 +0200)]
logind: allow greeters to take over VTs

Make sure a greeter can forcefully spawn a session on a VT that is
in-use. A recent patch prevented this (this used to be possible for all
session types) as it is highly fragile. However, as it turns out,
greeters seem to rely on that feature. Therefore, make sure we allow it
explicitly for greeters.

7 years agonss-mymachines: map userns users of containers to real user names
Lennart Poettering [Thu, 9 Jul 2015 17:46:20 +0000 (14:46 -0300)]
nss-mymachines: map userns users of containers to real user names

Given a container "foo", that maps user id $UID to container user, using
user namespaces, this NSS module extenstion will now map the $UID to a
name "vu-foo-$TUID" for the translated UID $UID.

Similar, userns groups are mapped to "vg-foo-$TGID" for translated GIDs
of $GID.

This simple change should make userns users more discoverable. Also,
given that many tools like "adduser" check NSS before allocating a UID,
should lower the chance of UID range conflicts between tools.

7 years agosd-bus: include queried path in GetManagedObjects
David Herrmann [Thu, 9 Jul 2015 11:27:57 +0000 (13:27 +0200)]
sd-bus: include queried path in GetManagedObjects

If GetManagedObjects is called on /foo/bar, then it should also include
the object /foo/bar, if it exists. Right now, we only include objects
underneath /foo/bar/.

This follows the behavior of existing dbus implementations.

Obsoletes #527 and fixes #525. Reported by: Nathaniel McCallum

7 years agosd-bus: sd_bus_slot_get_description() should return const strings
David Herrmann [Thu, 9 Jul 2015 08:40:41 +0000 (10:40 +0200)]
sd-bus: sd_bus_slot_get_description() should return const strings

All other *_get_description() functions use 'const char**', so make sure
sd_bus_slot_get_description() does the same.

This changes API, but ABI stays stable. I think this is fine, but I
wouldn't mind bumping SONAME.

Reported in #528.

7 years agoproperty callback returns are consistent
Umut Tezduyar Lindskog [Wed, 8 Jul 2015 12:35:32 +0000 (14:35 +0200)]
property callback returns are consistent

It is no different to return 0 over 1 in the property
callback. It is confusing to return 1 which made me think
1 has a special purpose. This way code is consistent with
the rest of the tree.

7 years agologind: fail on CreateSession if already in session
David Herrmann [Tue, 7 Jul 2015 17:38:41 +0000 (19:38 +0200)]
logind: fail on CreateSession if already in session

Right now, if you're already in a session and call CreateSession, we
return information about the current session of yours. This is highy
confusing and a nasty hack. Avoid that, and instead return a commonly
known error, so the caller can detect that.

This has the side-effect, that we no longer override XDG_VTNR and XDG_SEAT
in pam_systemd, if you're already in a session. But this sounds like the
right thing to do, anyway.

7 years agologind: allow sessions to share a VT if it's a greeter
David Herrmann [Tue, 7 Jul 2015 17:13:52 +0000 (19:13 +0200)]
logind: allow sessions to share a VT if it's a greeter

Old gdm and lightdm start the user-session during login before they
destroy the greeter-session. Therefore, the user-session will take over
the VT from the greeter. We recently prevented this by never allowing
multiple sessions on the same VT. Fix this now, by explicitly allowing
this if the owning session is a GREETER.

Note that gdm no longer behaves like this. Instead, due to wayland, they
always use a different VT for each session. All other login-managers are
highly encouraged to destroy the greeter-session _before_ starting the
user-session. We now work around this, but this will probably not last
forever (and will already have nasty side-effects on the greeter-session).

7 years agoRemove repeated 'the's
Zbigniew Jędrzejewski-Szmek [Tue, 7 Jul 2015 11:40:53 +0000 (07:40 -0400)]
Remove repeated 'the's

7 years agologin: use normal comparison to zero for integers
Zbigniew Jędrzejewski-Szmek [Tue, 7 Jul 2015 00:04:13 +0000 (20:04 -0400)]
login: use normal comparison to zero for integers

! is supposed to be used for booleans and pointers.

7 years agotree-wide: fix write_string_file() user that should not create files
Daniel Mack [Mon, 6 Jul 2015 23:27:20 +0000 (19:27 -0400)]
tree-wide: fix write_string_file() user that should not create files

The latest consolidation cleanup of write_string_file() revealed some users
of that helper which should have used write_string_file_no_create() in the
past but didn't. Basically, all existing users that write to files in /sys
and /proc should not expect to write to a file which is not yet existant.

7 years agofileio: consolidate write_string_file*()
Daniel Mack [Mon, 6 Jul 2015 23:19:25 +0000 (19:19 -0400)]
fileio: consolidate write_string_file*()

Merge write_string_file(), write_string_file_no_create() and
write_string_file_atomic() into write_string_file() and provide a flags mask
that allows combinations of atomic writing, newline appending and automatic
file creation. Change all users accordingly.

7 years agofileio: add 'enforce_newline' argument to write_string_stream()
Daniel Mack [Mon, 6 Jul 2015 21:31:44 +0000 (17:31 -0400)]
fileio: add 'enforce_newline' argument to write_string_stream()

Add a flag to control whether write_string_stream() should always enforce a
trailing newline character in the file.

7 years agodocs: add .gitignore
Kay Sievers [Mon, 6 Jul 2015 15:46:43 +0000 (17:46 +0200)]
docs: add .gitignore

7 years agosd-bus: support matching on destination names
David Herrmann [Mon, 6 Jul 2015 15:43:36 +0000 (17:43 +0200)]
sd-bus: support matching on destination names

Right now, we never install destination matches on kdbus as the kernel did
not support MATCH rules on those. With the introduction of
KDBUS_ITEM_DST_ID we can now match on destination IDs, so add explicit
support for those.

This requires a recent kdbus module to work. However, there seems to be no
user-space that uses "Destination=''" matches, yet, so old kdbus modules
still work fine (we couldn't find any real user).

This is needed to match on unicast signals in bus-proxy. A followup will
add support for this.

7 years agonetworkd: be more defensive when writing to ipv4/ipv6 forwarding settings
Lennart Poettering [Mon, 6 Jul 2015 11:38:47 +0000 (13:38 +0200)]
networkd: be more defensive when writing to ipv4/ipv6 forwarding settings

1) never bother with setting the flag for loopback devices

2) if we fail to write the flag due to EROFS (which is likely to happen
   in containers where /proc/sys is read-only) or any other error, check
   if the flag already has the right value. If so, don't complain.

Closes #469

7 years agologin: simplify assignment
Zbigniew Jędrzejewski-Szmek [Sun, 5 Jul 2015 16:02:20 +0000 (12:02 -0400)]
login: simplify assignment

7 years agobusctl: flush stdout after dumping data
David Herrmann [Sat, 4 Jul 2015 10:11:22 +0000 (12:11 +0200)]
busctl: flush stdout after dumping data

Running `busctl monitor` currently buffers data for several seconds /
kilobytes before writing stdout. This is highly confusing if you dump in a
file, ^C busctl and then end up with a file with data of the last few
_seconds_ missing.

Fix this by explicitly flushing after each signal.

7 years agosd-bus: introduce new sd_bus_flush_close_unref() call
Lennart Poettering [Fri, 3 Jul 2015 17:49:03 +0000 (19:49 +0200)]
sd-bus: introduce new sd_bus_flush_close_unref() call

sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
(which writes all unwritten messages out) + sd_bus_close() (which
terminates the connection, releasing all unread messages) +
sd_bus_unref() (which frees the connection).

The combination of this call is used pretty frequently in systemd tools
right before exiting, and should also be relevant for most external
clients, and is hence useful to cover in a call of its own.

Previously the combination of the three calls was already done in the
_cleanup_bus_close_unref_ macro, but this was only available internally.

Also see #327

7 years agotreewide: fix typos
Torstein Husebø [Thu, 2 Jul 2015 13:18:29 +0000 (15:18 +0200)]
treewide: fix typos

7 years agosd-bus: don't leak kdbus notifications
David Herrmann [Thu, 2 Jul 2015 10:14:27 +0000 (12:14 +0200)]
sd-bus: don't leak kdbus notifications

When we get notifications from the kernel, we always turn them into
synthetic dbus1 messages. This means, we do *not* consume the kdbus
message, and as such have to free the offset.

Right now, the translation-helpers told the caller that they consumed the
message, which is wrong. Fix this by explicitly releasing all kernel
messages that are translated.

7 years agologin: re-use VT-sessions if they already exist
David Herrmann [Wed, 1 Jul 2015 13:05:01 +0000 (15:05 +0200)]
login: re-use VT-sessions if they already exist

Right now, if you start a session via 'su' or 'sudo' from within a
session, we make sure to re-use the existing session instead of creating a
new one. We detect this by reading the session of the requesting PID.

However, with gnome-terminal running as a busname-unit, and as such
running outside the session of the user, this will no longer work.
Therefore, this patch makes sure to return the existing session of a VT if
you start a new one.

This has the side-effect, that you will re-use a session which your PID is
not part of. This works fine, but will break assumptions if the parent
session dies (and as such close your session even though you think you're
part of it). However, this should be perfectly fine. If you run multiple
logins on the same session, you should really know what you're doing. The
current way of silently accepting it but choosing the last registered
session is just weird.

7 years agosocket: Set SO_REUSEPORT before bind()
Christos Trochalakis [Wed, 1 Jul 2015 11:39:53 +0000 (14:39 +0300)]
socket: Set SO_REUSEPORT before bind()

bind() fails if it is called before setting SO_REUSEPORT and another
process is already binded to the same addess.

A new reuse_port option has been introduced to socket_address_listen()
to set the option as part of socket initialization.

7 years agobuild-sys: use wildcard glob in update-man-list again
Zbigniew Jędrzejewski-Szmek [Tue, 30 Jun 2015 13:56:44 +0000 (09:56 -0400)]
build-sys: use wildcard glob in update-man-list again

The idea is that after adding a new man page, make update-man-list
will be used to regenerate part of the makefile. So the data already
present in the makefile cannot be used to do that.

Also, renames filter out generated xml files in make-man-rules.py
itself in order to make Makefile.am a bit simpler, and rename files
to dist_files to better reflect new meaning.

7 years agologin: add rule for qemu's pci-bridge-seat
Gerd Hoffmann [Mon, 29 Jun 2015 07:42:11 +0000 (09:42 +0200)]
login: add rule for qemu's pci-bridge-seat

Qemu provides a separate pci-bridge exclusively for multi-seat setups.
The normal pci-pci bridge ("-device pci-bridge") has 1b36:0001. The new
pci-bridge-seat was specifically added to simplify guest-side
multiseat configuration.  It is identical to the normal pci-pci bridge,
except that it has a different id (1b36:000a) so we can match it and
configure multiseating automatically.

Make sure we always treat this as separate seat if we detect this, just
like other "Pluggable" devices.

(David: write commit-message)

7 years agosd-netlink: message - remove unused next_rta_offset field
Tom Gundersen [Fri, 26 Jun 2015 10:02:53 +0000 (12:02 +0200)]
sd-netlink: message - remove unused next_rta_offset field

This was a left-over from before we supported containers.

7 years agosd-netlink: make a couple of helper functions static
Tom Gundersen [Thu, 25 Jun 2015 22:07:25 +0000 (00:07 +0200)]
sd-netlink: make a couple of helper functions static

Also rename from rtnl_* to netlink_*.

7 years agonetlink: rework containers
Tom Gundersen [Thu, 25 Jun 2015 22:02:55 +0000 (00:02 +0200)]
netlink: rework containers

Instead of representing containers as several arrays, make a new
netlink_container struct and keep one array of these structs. We
also introduce netlink_attribute structs that in the future will
hold meta-information about each atribute.

7 years agoinstall: make unit_file_get_list aware of UNIT_FILE_INDIRECT
Michal Sekletar [Thu, 25 Jun 2015 14:44:22 +0000 (16:44 +0200)]
install: make unit_file_get_list aware of UNIT_FILE_INDIRECT

Commit aedd401 introduced new unit file state, UNIT_FILE_INDIRECT. Unit file is
said to have indirect state if it contains [Install] section which has only
Also= directive. Thus, if enable of such unit file is requested then some other
unit file gets enabled.

Whether or not unit file is in indirect state can be determined by calling
unit_file_can_install. Function unit_file_get_list populates list of unit files
present in given lookup location. So far it did call unit_file_can_install in a
way that would prevent finding out about unit files in indirect state. Such unit
file would be incorrectly marked as static.

Fixes following assertion in test-install,

Assertion 'p->state == s' failed at src/test/test-install.c:59, function main(). Aborting.
[1]    26868 abort (core dumped)  ./test-install

7 years agoinstall: explicitly return 0 on success
Michal Sekletar [Thu, 25 Jun 2015 14:06:40 +0000 (16:06 +0200)]
install: explicitly return 0 on success

Maybe there is some left-over value stored in r from previous function
call. Let's make sure we always return consistent error code when we reach end of
the function body.

Fixes following crash of test-install,

Assertion 'r == 0' failed at src/test/test-install.c:52, function main(). Aborting.
[1]    11703 abort (core dumped)  ./test-install

7 years agoresolved: reference count the dns servers
Tom Gundersen [Wed, 24 Jun 2015 16:41:46 +0000 (18:41 +0200)]
resolved: reference count the dns servers

We want to reference the servers from their active transactions, so make sure
they stay around as long as the transaction does.

7 years agosd-netlink: don't export internal type-system details
David Herrmann [Wed, 24 Jun 2015 11:27:34 +0000 (13:27 +0200)]
sd-netlink: don't export internal type-system details

The kernel bonding layer allows passing an array of ARP IP targets as
bond-configuration. Due to the weird implementation of arrays in netlink
(which we haven't figure out a generic way to support, yet), we usually
hard-code the supported array-sizes. However, this should not be exported
from sd-netlink.

Instead, make sure the caller just uses it's current hack of enumerating
the types, and the sd-netlink core will have it's own list of supported
array-sizes (to be removed in future extensions, btw!). If either does not
match, we will just return a normal error.

Note that we provide 2 constants for ARP_IP_TARGETS_MAX now. However, both
have very different reasons:
 - the constant in netdev-bond.c is used to warn the user that the given
   number of targets might not be supported by the kernel (even though the
   kernel might increase that number at _any_ time)
 - the constant in sd-netlink is solely used due to us missing a proper
   array implementation. Once that's supported in the type-system, it can
   be removed without notice

Last but not least, this patch turns the log_error() into a log_warning().
Given that the previous condition was off-by-one, anyway, it never hit at
the right time. Thus, it was probably of no real use.

7 years agoinstall: fix bad memory access
Lennart Poettering [Tue, 23 Jun 2015 23:16:18 +0000 (19:16 -0400)]
install: fix bad memory access

7 years agoman: fully document sd-bus' error APIs
Lennart Poettering [Tue, 23 Jun 2015 17:37:28 +0000 (19:37 +0200)]
man: fully document sd-bus' error APIs

[@zonque: Some minor nits fixed as pointed out by @ronnychevalier,
 dropped class='sd-bus-errors' to fix python logic]

7 years agosd-netlink: respect attribute type flags
Tom Gundersen [Tue, 23 Jun 2015 11:13:20 +0000 (13:13 +0200)]
sd-netlink: respect attribute type flags

Though currently unused by us, netlink attribute types support embedding flags to indicate
if the type is encoded in network byte-order and if it is a nested attribute. Read out
these flags when parsing the message.

We will now swap the byteorder in case it is non-native when reading out integers (though
this is not needed by any of the types we currently support). We do not enforce the NESTED
flag, as the kernel gets this wrong in many cases.

7 years agosd-netlink: don't treat NULL as root type-system
David Herrmann [Tue, 23 Jun 2015 10:10:38 +0000 (12:10 +0200)]
sd-netlink: don't treat NULL as root type-system

Explicitly export the root type-system to the type-system callers. This
avoids treating NULL as root, which for one really looks backwards (NULL
is usually a leaf, not root), and secondly prevents us from properly
debugging calling into non-nested types.

Also rename the root to "type_system_root". Once we support more than
rtnl, well will have to revisit that, anyway.

7 years agosd-netlink: don't treat type_system->count==0 as invalid
David Herrmann [Tue, 23 Jun 2015 10:03:10 +0000 (12:03 +0200)]
sd-netlink: don't treat type_system->count==0 as invalid

Empty type-systems are just fine. Avoid the nasty hack in
union-type-systems that treat empty type-systems as invalid. Instead check
for the actual types-array and make sure it's non-NULL (which is even true
for empty type-systems, due to "empty_types" array).

7 years agosd-netlink: drop NETLINK_TYPE_META
David Herrmann [Tue, 23 Jun 2015 09:54:43 +0000 (11:54 +0200)]
sd-netlink: drop NETLINK_TYPE_META

The NETLINK_TYPE_META pseudo-type is actually equivalent to an empty
nested type. Drop it and define an empty type-system instead.

This also has the nice side-effect that m->container_type_system[0] is
never NULL (which has really nasty side-effects if you try to read
attributes).

7 years agosd-netlink: turn 'max' into 'count' to support empty type-systems
David Herrmann [Tue, 23 Jun 2015 09:46:48 +0000 (11:46 +0200)]
sd-netlink: turn 'max' into 'count' to support empty type-systems

Right now we store the maximum type-ID of a type-system. This prevents us
from creating empty type-systems. Store the "count" instead, which should
be treated as max+1.

Note that type_system_union_protocol_get_type_system() currently has a
nasty hack to treat empty type-systems as invalid. This might need some
modification later on as well.

7 years agosd-netlink: avoid casting size_t into int
David Herrmann [Tue, 23 Jun 2015 09:18:53 +0000 (11:18 +0200)]
sd-netlink: avoid casting size_t into int

size_t is usually 64bit and int 32bit on a 64bit machine. This probably
does not matter for netlink message sizes, but nevertheless, avoid
hard-coding it anywhere.

7 years agosd-netlink: make NLTypeSystem internal
David Herrmann [Tue, 23 Jun 2015 09:07:59 +0000 (11:07 +0200)]
sd-netlink: make NLTypeSystem internal

Same as NLType, move NLTypeSystem into netlink-types.c and hide it from
the outside. Provide an accessor function for the 'max' field that is used
to allocate suitable array sizes.

Note that this will probably be removed later on, anyway. Once we support
bigger type-systems, it just seems impractical to allocate such big arrays
for each container entry. An RBTree would probably do just fine.

7 years agosd-netlink: make NLType internal
David Herrmann [Tue, 23 Jun 2015 09:03:10 +0000 (11:03 +0200)]
sd-netlink: make NLType internal

If we extend NLType to support arrays and further extended types, we
really want to avoid hard-coding the type-layout outside of
netlink-types.c. We already avoid accessing nl_type->type_system outside
of netlink-types.c, extend this to also avoid accessing any other fields.

Provide accessor functions for nl_type->type and nl_type->size and then
move NLType away from the type-system header.

With this in place, follow-up patches can safely turn "type_system" and
"type_system_union" into a real "union { }", and then add another type for
arrays.

7 years agosd-netlink: don't access type->type_system[_union] directly
David Herrmann [Tue, 23 Jun 2015 08:51:25 +0000 (10:51 +0200)]
sd-netlink: don't access type->type_system[_union] directly

Make sure we never access type->type_system or type->type_system_union
directly. This is an implementation detail of the type-system and we
should always use the accessors. Right now, they only exist for 2-level
accesses (type-system to type-system). This patch introduces the 1-level
accessors (type to type-system) and makes use of it.

This patch makes sure the proper assertions are in place, so we never
accidentally access sub-type-systems for non-nested/union types.

Note that this places hard-asserts on the accessors. This should be fine,
as we expect callers to only access sub type-systems if they *know*
they're dealing with nested types.

7 years agosd-netlink: make sure the root-level type is nested
David Herrmann [Tue, 23 Jun 2015 08:47:44 +0000 (10:47 +0200)]
sd-netlink: make sure the root-level type is nested

In sd-netlink-message, we always guarantee that the currently selected
type-system is non-NULL. Otherwise, we would be unable to parse any types
in the current container level. Hence, this assertion must be true:
    message->container_type_system[m->n_containers] != NULL

During message_new() we currently do not verify that this assertion is
true. Instead, we blindly access nl_type->type_system and use it (which
might be NULL for basic types and unions). Fix this, by explicitly
checking that the root-level type is nested.

Note that this is *not* a strict requirement of netlink, but it's a strict
requirement for all message types we currently support. Furthermore, all
the callers of message_new() already verify that only supported types are
passed, therefore, this is a pure cosmetic check. However, it might be
needed on the future, so make sure we don't trap into this once we change
the type-system.

7 years agosd-netlink: rename NLA_ to NETLINK_TYPE_
David Herrmann [Tue, 23 Jun 2015 07:56:59 +0000 (09:56 +0200)]
sd-netlink: rename NLA_ to NETLINK_TYPE_

The NLA_ names are used to name real datatypes we extract out of netlink
messages. The kernel has an internal enum with the same names
(NLA_foobar), which is *NOT* binary compatible to our types. Furthermore,
we support a different set of types than the kernel (as we try to treat
some kernel peculiarities as our own types to simplify the API).

Rename NLA_ to NETLINK_TYPE_ to make clear that this is our own set of
types.

7 years agozsh-completion: _loginctl/_systemd/_systemd-inhibit improvements
Eric Cook [Mon, 22 Jun 2015 22:07:32 +0000 (18:07 -0400)]
zsh-completion: _loginctl/_systemd/_systemd-inhibit improvements

_loginctl: respects the verbose style. which allows a user to get
the pre d5df0d950f8bc behavior of not showing a description for sessions
and users, by default they aren't shown.

zstyle ':completion:*' verbose true
or
zstyle ':completion:*:loginctl*:*' verbose true # or similar
Will show the descriptions.

zstyle ':completion:*' verbose true
and
zstyle ':completion:*:loginctl*:*' verbose false # or similar
Won't show descriptions for loginctl only

_systemd: complete pids for systemd-notify's --pid option.
display a message of the expected argument for other options.

_systemd-inhibit: complete block & delay for --mode
display a message of the expected argument for --who/--why

7 years agoexport sd_bus_object_added() / _removed()
Geert Jansen [Sun, 21 Jun 2015 11:44:35 +0000 (07:44 -0400)]
export sd_bus_object_added() / _removed()

Fixes #306.

7 years agopam_systemd: Properly check kdbus availability
Jan Alexander Steffens (heftig) [Sun, 21 Jun 2015 03:59:34 +0000 (05:59 +0200)]
pam_systemd: Properly check kdbus availability

This properly avoids setting DBUS_SESSION_BUS_ADDRESS if kdbus
is loaded (or built into the kernel) but not wanted.

7 years agopo: run make update-po
Lennart Poettering [Fri, 19 Jun 2015 00:13:03 +0000 (02:13 +0200)]
po: run make update-po

7 years agoman: revert dynamic paths for split-usr setups
Tom Gundersen [Thu, 18 Jun 2015 17:47:44 +0000 (19:47 +0200)]
man: revert dynamic paths for split-usr setups

This did not really work out as we had hoped. Trying to do this upstream
introduced several problems that probably makes it better suited as a
downstream patch after all. At any rate, it is not releaseable in the
current state, so we at least need to revert this before the release.

 * by adjusting the path to binaries, but not do the same thing to the
   search path we end up with inconsistent man-pages. Adjusting the search
   path too would be quite messy, and it is not at all obvious that this is
   worth the effort, but at any rate it would have to be done before we
   could ship this.

 * this means that distributed man-pages does not make sense as they depend
   on config options, and for better or worse we are still distributing
   man pages, so that is something that definitely needs sorting out before
   we could ship with this patch.

 * we have long held that split-usr is only minimally supported in order
   to boot, and something we hope will eventually go away. So before we start
   adding even more magic/effort in order to make this work nicely, we should
   probably question if it makes sense at all.

7 years agoacl-util: various smaller fixes to parse_acl()
Lennart Poettering [Wed, 17 Jun 2015 20:08:21 +0000 (22:08 +0200)]
acl-util: various smaller fixes to parse_acl()

- Make string parameter const

- Don't log some OOM errors, but not others

- Don't eat up errors generated by acl_from_text()

- Make sure check for success of every single strv_push() call

7 years agologs-show: print a debug message when we skip entries without MESSAGE= fields
Lennart Poettering [Wed, 17 Jun 2015 18:28:20 +0000 (20:28 +0200)]
logs-show: print a debug message when we skip entries without MESSAGE= fields

7 years agobus: fix installing DRIVER matches on kdbus
David Herrmann [Wed, 17 Jun 2015 17:15:58 +0000 (19:15 +0200)]
bus: fix installing DRIVER matches on kdbus

In kdbus we still have to support org.freedesktop.DBus matches even though
there is no real bus driver. The reason is that bus-control.c turns
NameOwnerChanged matches into proper kdbus matches. If we drop DRIVER
matches early, we will never match on name-changes for kdbus.

Two ways to fix this:

 1) Install DRIVER matches on kdbus (which is the simple way our and which
    is what this patch does).

 2) Properly fix the scope-detection to let NameOwnerChanged matches
    through (or better: block anything with Member!=NameOwnerChanged).

7 years agowatchdog: Don't require WDIOC_SETOPTIONS/WDIOS_ENABLECARD
Jean Delvare [Wed, 17 Jun 2015 16:57:39 +0000 (18:57 +0200)]
watchdog: Don't require WDIOC_SETOPTIONS/WDIOS_ENABLECARD

Not all watchdog drivers implement WDIOC_SETOPTIONS. Drivers which do
not implement it have their device always enabled. So it's fine to
report an error if WDIOS_DISABLECARD is passed and the ioctl is not
implemented, however failing when WDIOS_ENABLECARD is passed and the
ioctl is not implemented is not good: if the device was already
enabled then WDIOS_ENABLECARD was a no-op and wasn't needed in the
first place. So we can just ignore the error and continue.

7 years agologind: save /run/systemd/users/UID before starting user@.service
Simon McVittie [Wed, 17 Jun 2015 15:45:49 +0000 (16:45 +0100)]
logind: save /run/systemd/users/UID before starting user@.service

Previously, this had a race condition during a user's first login.
Some component calls CreateSession (most likely by a PAM service
other than 'systemd-user' running pam_systemd), with the following
results:

- logind:
  * create the user's XDG_RUNTIME_DIR
  * tell pid 1 to create user-UID.slice
  * tell pid 1 to start user@UID.service

Then these two processes race:

- logind:
  * save information including XDG_RUNTIME_DIR to /run/systemd/users/UID

- the subprocess of pid 1 responsible for user@service:
  * start a 'systemd-user' PAM session, which reads XDG_RUNTIME_DIR
    and puts it in the environment
  * run systemd --user, which requires XDG_RUNTIME_DIR in the
    environment

If logind wins the race, which usually happens, everything is fine;
but if the subprocesses of pid 1 win the race, which can happen
under load, then systemd --user exits unsuccessfully.

To avoid this race, we have to write out /run/systemd/users/UID
even though the service has not "officially" started yet;
previously this did an early-return without saving anything.
Record its state as OPENING in this case.

Bug: https://github.com/systemd/systemd/issues/232
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
7 years agoturn kdbus support into a runtime option
Kay Sievers [Wed, 17 Jun 2015 14:37:55 +0000 (16:37 +0200)]
turn kdbus support into a runtime option

./configure --enable/disable-kdbus can be used to set the default
behavior regarding kdbus.

If no kdbus kernel support is available, dbus-dameon will be used.

With --enable-kdbus, the kernel command line option "kdbus=0" can
be used to disable kdbus.

With --disable-kdbus, the kernel command line option "kdbus=1" is
required to enable kdbus support.

7 years agologind: apply selinux label to XDG_RUNTIME_DIR
Lennart Poettering [Wed, 17 Jun 2015 14:29:03 +0000 (16:29 +0200)]
logind: apply selinux label to XDG_RUNTIME_DIR

As discussed in #257: we should ensure the selinux label is correctly
applied to each user's XDG_RUNTIME_DIR.

7 years agolibsystemd: remove list of symbols to export only in the future
Kay Sievers [Wed, 17 Jun 2015 13:53:56 +0000 (15:53 +0200)]
libsystemd: remove list of symbols to export only in the future

7 years agozsh-completion: _loginctl - general bug fixes
Eric Cook [Wed, 17 Jun 2015 11:41:24 +0000 (07:41 -0400)]
zsh-completion: _loginctl - general bug fixes

1) the iterator `fun' has an local scope. after running the completer,
it will no longer be defined.

2) use _describe instead of calling compadd. Using compadd without
calling _description or something similar before, restricts the
user's ability to customize what is presented to them.
zstyle ':completion:*' format 'Completing %d'
  - now displays an header showing what is being completed.
zstyle ':completion::complete:loginctl-*::users' users user1 user2
  - allows the user to manually specify which users is offered
zstyle :completion::complete:loginctl-kill-user:\* \
ignored-patterns '(100<0-4>|user1)'
  - selectively ignore some users when completing loginctl kill-user
    <tab>
Sessions, UIDs now have descriptions when selecting them.

3) removed the call to _loginctl_all_seats in _loginctl_attach(), since
_loginctl_seats calls it a second time, right before adding matches.
There isn't a noticeable difference doing this.

7 years agoStop talking about the "XDG" version of basename()
Simon McVittie [Wed, 17 Jun 2015 10:23:46 +0000 (11:23 +0100)]
Stop talking about the "XDG" version of basename()

XDG refers to X Desktop Group, a former name for freedesktop.org.
This group is responsible for specifications like basedirs,
.desktop files and icon naming, but as far as I know, it has never
tried to redefine basename().

I think these references were meant to say XPG (X/Open Portability
Guide), a precursor of POSIX. POSIX is better-known and less easily
confused with XDG, and is how the basename(3) man page describes
the libgen.h version of basename().

The other version of basename() is glibc-specific and is described
in basename(3) as "the GNU version"; specifically mention that
version, to disambiguate.

7 years agosd-bus: suppress installing local bus matches server side
Lennart Poettering [Wed, 17 Jun 2015 09:42:39 +0000 (11:42 +0200)]
sd-bus: suppress installing local bus matches server side

Matches that can only match against messages from the
org.freedesktop.DBus.Local service (or the local interfaces or path)
should never be installed server side, suppress them hence.

Similar, on kdbus matches that can only match driver messages shouldn't
be passed to the kernel.

7 years agobuild-sys: hide magic section variables from exported symbols
Kay Sievers [Wed, 17 Jun 2015 05:23:31 +0000 (07:23 +0200)]
build-sys: hide magic section variables from exported symbols

https://github.com/systemd/systemd/issues/234

7 years agosd-event: make errors on EPOLL_CTL_DEL pseudo-fatal
David Herrmann [Tue, 16 Jun 2015 23:15:09 +0000 (01:15 +0200)]
sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal

If we call EPOLL_CTL_DEL, we *REALLY* expect the file-descriptor to be
present in that given epoll-set. We actually track such state via our
s->io.registered flag, so it better be true.

Make sure if that's not true, we treat it similar to assert_return() (ie.,
print a loud warning).

7 years agologind: rework display counting when detecting whether the system is docked
Lennart Poettering [Tue, 16 Jun 2015 22:24:05 +0000 (00:24 +0200)]
logind: rework display counting when detecting whether the system is docked

Previously, we'd just count connected displays, and if there was 2 or
more we assumed a "docked" state.

With this change we now:

- Only count external displays, ignore internal ones (which we detect by
  checking the connector name against a whitelist of known external plug
  types)

- We ignore connectors which are explicitly disabled

- We then compare the count with >= 1 rather than >= 2 as before

This new logic has the benefit that systems that disconnect the internal
display when the lid is closed are better supported. Also, explicitly
disabled ports do not confuse the algorithm anymore.

This new algorithm has been suggested here:

http://lists.freedesktop.org/archives/intel-gfx/2015-June/068821.html

This also makes two functions static, that are not used outside of their
.c files.

7 years agohashmap: allow NULL key in ordered_hashmap_next()
Michal Schmidt [Tue, 16 Jun 2015 13:46:40 +0000 (15:46 +0200)]
hashmap: allow NULL key in ordered_hashmap_next()

There is no reason to require key to be non-NULL.
Change test_ordered_hashmap_next() to use trivial_hash_ops in order to
test NULL key too.

7 years agosd-bus: use proper cleanup macro
Umut Tezduyar Lindskog [Tue, 16 Jun 2015 09:20:10 +0000 (11:20 +0200)]
sd-bus: use proper cleanup macro

7 years agologind: cast close() call to (void)
Lennart Poettering [Mon, 15 Jun 2015 23:55:20 +0000 (01:55 +0200)]
logind: cast close() call to (void)

7 years agoeverywhere: actually make use of DUAL_TIMESTAMP_NULL macro
Lennart Poettering [Mon, 15 Jun 2015 23:08:12 +0000 (01:08 +0200)]
everywhere: actually make use of DUAL_TIMESTAMP_NULL macro

Let's use it as initializer where appropriate.

7 years agologind: expose "Docked" bool as property on the bus
Lennart Poettering [Mon, 15 Jun 2015 23:02:02 +0000 (01:02 +0200)]
logind: expose "Docked" bool as property on the bus

We know the state anyway, let's expose it in the bus. It's useful for
debugging at least, but it might be useful for DEs too.

7 years agoeverywhere: port everything to sigprocmask_many() and friends
Lennart Poettering [Mon, 15 Jun 2015 18:13:23 +0000 (20:13 +0200)]
everywhere: port everything to sigprocmask_many() and friends

This ports a lot of manual code over to sigprocmask_many() and friends.

Also, we now consistly check for sigprocmask() failures with
assert_se(), since the call cannot realistically fail unless there's a
programming error.

Also encloses a few sd_event_add_signal() calls with (void) when we
ignore the return values for it knowingly.

7 years agotmpfiles: automatically remove old machine snapshots at boot
Lennart Poettering [Mon, 15 Jun 2015 17:24:43 +0000 (19:24 +0200)]
tmpfiles: automatically remove old machine snapshots at boot

Remove old temporary snapshots, but only at boot. Ideally we'd have
"self-destroying" btrfs snapshots that go away if the last last
reference to it does. To mimic a scheme like this at least remove the
old snapshots on fresh boots, where we know they cannot be referenced
anymore. Note that we actually remove all temporary files in
/var/lib/machines/ at boot, which should be safe since the directory has
defined semantics. In the root directory (where systemd-nspawn
--ephemeral places snapshots) we are more strict, to avoid removing
unrelated temporary files.

This also splits out nspawn/container related tmpfiles bits into a new
tmpfiles snippet to systemd-nspawn.conf

7 years agoutil: when creating temporary file names, allow including extra id string in it
Lennart Poettering [Mon, 15 Jun 2015 17:09:02 +0000 (19:09 +0200)]
util: when creating temporary file names, allow including extra id string in it

This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(),
tempfn_ranomd_child(). If non-NULL this string is included in the middle
of the newly created file name. This is useful for being able to
distuingish the kind of temporary file when we see one.

This also adds tests for the three call.

For now, we don't make use of this at all, but port all users over.

7 years agofirewall: rename fw-util.[ch] → firewall-util.[ch]
Daniel Mack [Mon, 15 Jun 2015 11:50:43 +0000 (13:50 +0200)]
firewall: rename fw-util.[ch] → firewall-util.[ch]

The names fw-util.[ch] are too ambiguous, better rename the files to
firewall-util.[ch]. Also rename the test accordingly.

7 years agol10n: Add Belarusian translation
Viktar Vauchkevich [Sun, 14 Jun 2015 21:13:43 +0000 (00:13 +0300)]
l10n: Add Belarusian translation

7 years agohashmap: fix iterators to not skip entries
David Herrmann [Sun, 14 Jun 2015 14:51:35 +0000 (16:51 +0200)]
hashmap: fix iterators to not skip entries

Currently, the HASHMAP iterators stop at the first NULL entry in a
hashmap. This is non-obvious and breaks users like sd-device, which
legitimately store NULL values in a hashmap.

Fix all the iterators by taking a pointer to the value storage, instead of
returning it. The iterators now return a boolean that tells whether the
end of the list was reached.

Current users of HASHMAP_FOREACH() are *NOT* changed to explicitly check
for NULL. If it turns out, there were users that inserted NULL into
hashmaps, but didn't properly check for it during iteration, then we
really want to find those and fix them.

7 years agotree-wide: fix memory leaks in users of bus_map_all_properties()
David Herrmann [Sun, 14 Jun 2015 13:08:52 +0000 (15:08 +0200)]
tree-wide: fix memory leaks in users of bus_map_all_properties()

If you use bus_map_all_properties(), you must be aware that it might
touch output variables even though it may fail. This is, because we parse
many different bus-properties and cannot tell how to clean them up, in
case we fail deep down in the parser.

Fix all callers of bus_map_all_properties() to correctly cleanup any
context structures at all times.

7 years agosd-netlink: rename from sd-rtnl
Tom Gundersen [Fri, 12 Jun 2015 14:31:33 +0000 (16:31 +0200)]
sd-netlink: rename from sd-rtnl

7 years agologin: fix potential null pointer dereference
Ronny Chevalier [Fri, 12 Jun 2015 09:37:11 +0000 (11:37 +0200)]
login: fix potential null pointer dereference

Fix CID 1304686: Dereference after null check (FORWARD_NULL)

However, this commit does not fix any bug in logind. It helps to keep
the elect_display_compare() function generic.

7 years agosd-rtnl: make joining broadcast groups implicit
Tom Gundersen [Thu, 11 Jun 2015 13:55:37 +0000 (15:55 +0200)]
sd-rtnl: make joining broadcast groups implicit

7 years agosd-network: fix CID 1306198
Susant Sahani [Thu, 11 Jun 2015 08:37:15 +0000 (14:07 +0530)]
sd-network: fix CID 1306198

7 years agoAll languages .po files - general update
Daniele Medri [Wed, 10 Jun 2015 21:27:59 +0000 (23:27 +0200)]
All languages .po files - general update

7 years agoItalian .po updates
Daniele Medri [Wed, 10 Jun 2015 21:19:26 +0000 (23:19 +0200)]
Italian .po updates

7 years agobus: we now support path_namespace=/
David Herrmann [Wed, 10 Jun 2015 18:14:56 +0000 (20:14 +0200)]
bus: we now support path_namespace=/

Our bloom-filters support root-path matching. Make sure we properly add
the path_namespace= tag.

7 years agobus: fix arg0path= two-way matching
David Herrmann [Wed, 10 Jun 2015 18:04:53 +0000 (20:04 +0200)]
bus: fix arg0path= two-way matching

DBus spec clearly defines arg0path= to be a two-way matching. That is,
either the matcher or the matchee can be a prefix of the other to match.
This is not possible to implement with bloom-filters. Instead, we'd have
to add a separate filter for each prefix. This is non-trivial, though.
Hence, just skip the match for now and match locally.

7 years agobus: fix pattern matching
David Herrmann [Wed, 10 Jun 2015 17:34:05 +0000 (19:34 +0200)]
bus: fix pattern matching

DBus-spec defines two different pattern matchings:

  1) Path and namespace prefix matching. In this case, A matches B either
     if both are equal, or if B is fully included in the namespace of A.
     In other words, A has to be a prefix of B, but end with a separator
     character (or the following character in B must be one).

     This is used for path_namespace= and arg0namespace=

  2) The other pattern matching is used for arg0path= which does a two-way
     matching. That is, A must be a prefix of B, or B a prefix of A.
     Furthermore, the prefix must end with a separator.

Fix the sd-bus helpers to reflect that. The 'simple_' and 'complex_'
prefixes don't make any sense now, but.. eh..

7 years agoutil: introduce CMSG_FOREACH() macro and make use of it everywhere
Lennart Poettering [Wed, 10 Jun 2015 17:10:47 +0000 (19:10 +0200)]
util: introduce CMSG_FOREACH() macro and make use of it everywhere

It's only marginally shorter then the usual for() loop, but certainly
more readable.

7 years agosd-network: allow the state dir to be created after the monitor
Tom Gundersen [Wed, 10 Jun 2015 17:00:39 +0000 (19:00 +0200)]
sd-network: allow the state dir to be created after the monitor

We now listen for new subdirs of /run/systemd, and /run/systemd/netif in case
/run/systemd/netif/links does not exist.

7 years agobus: fix test-bus-kerne-bloom.c to match properly
David Herrmann [Wed, 10 Jun 2015 16:47:31 +0000 (18:47 +0200)]
bus: fix test-bus-kerne-bloom.c to match properly

Make sure we actually verify our match-rules are executed properly. Right
now all we test is the bloom-matches, which are non-reliable as they leave
through false-positives.

7 years agobus: fix bloom_add_prefixes() to add all required data
David Herrmann [Wed, 10 Jun 2015 16:26:16 +0000 (18:26 +0200)]
bus: fix bloom_add_prefixes() to add all required data

Lets look at an example where we add arg0="/foo/bar/waldo" to a
bloom-filter. The following strings are added:
  "arg0:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar"
  "arg0-slash-prefix:/foo"

Two problems arise:

1) If we match on "arg0path=/foo/bar/waldo", the dbus-spec explicitly
states that equal strings are also considered prefixes. However, in the
bloom-match, we can only provide a single match-filter. Therefore, we have
to add "arg0-slash-prefix:/foo/bar/waldo" there, but this never occured in
the bloom-mask of the message.
Hence, this patch makes sure bloom_add_prefixes() adds the full path as
prefix, too.

2) If we match on "arg0path=/foo/", the dbus-spec states that arg0path
does prefix-matching with the trailing slash _included_, unlike
path_namespace= matches, which does *not* include them. This is
inconsistent, but we have to support the specs. Therefore, we must add
prefixes with _and_ without trailing separators.
Hence, this patch makes sure bloom_add_prefixes() adds all prefixes with
the trailing slash included.

The final set of strings added therefore is:
  "arg0:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar/waldo"
  "arg0-slash-prefix:/foo/bar/"
  "arg0-slash-prefix:/foo/bar"
  "arg0-slash-prefix:/foo/"
  "arg0-slash-prefix:/foo"
  "arg0-slash-prefix:/"

7 years agopo,catalog: add zh_TW translation.
Jeff Huang [Wed, 10 Jun 2015 14:39:44 +0000 (22:39 +0800)]
po,catalog: add zh_TW translation.

7 years agosd-network: allow NULL in sd_network_monitor_unref
Tom Gundersen [Wed, 10 Jun 2015 13:55:09 +0000 (15:55 +0200)]
sd-network: allow NULL in sd_network_monitor_unref

Match rest of codebase, we always allow unref'ing NULL.

7 years agosd-bus: remove ucred parameter from bus_message_from_header() since we don't use...
Lennart Poettering [Wed, 10 Jun 2015 13:52:14 +0000 (15:52 +0200)]
sd-bus: remove ucred parameter from bus_message_from_header() since we don't use it anymore

7 years agobus-message: remove shadow warning with log_debug_bus_message()
Lennart Poettering [Wed, 10 Jun 2015 13:51:14 +0000 (15:51 +0200)]
bus-message: remove shadow warning with log_debug_bus_message()

7 years agosd-bus: Correct typo
Torstein Husebø [Wed, 10 Jun 2015 11:08:31 +0000 (13:08 +0200)]
sd-bus: Correct typo