launch/policy: fix crash when exporting <selinux>
launch/policy: fix crash when exporting <selinux>

If a policy contains a <selinux> element, dbus-broker-launch crashes:

[   30.048705] dbus-broker-launch[221]: ERROR policy_export @ ../dbus-broker-21/src/launch/policy.c +1142: Return code 1
[   30.050963] dbus-broker-launch[221]:       launcher_add_listener @ ../dbus-broker-21/src/launch/launcher.c +1130
[   30.079620] dbus-broker[228]: Dispatched 0 messages @ 0(±0)μs / message.
[   30.082613] dbus-broker-launch[221]:       launcher_run @ ../dbus-broker-21/src/launch/launcher.c +1389
[   30.084426] dbus-broker-launch[221]:       run @ ../dbus-broker-21/src/launch/main.c +153
[   30.085797] dbus-broker-launch[221]:       main @ ../dbus-broker-21/src/launch/main.c +181
[   30.087208] dbus-broker-launch[221]: Exiting due to fatal error: -131

Minimal config to reproduce:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
  <selinux>
    <associate own="com.example1" context="system_u:object_r:example1_t" />
    <associate own="com.example2" context="system_u:object_r:example2_t" />
  </selinux>
</busconfig>

As per the libsystemd API, sd_bus_message_append can return an int
greater than 0 on success, which for example happens when processing
vectors.
The export function is treating every non-zero result as an error,
which causes dbus-broker-launch to terminate.

Fixes #212

Signed-off-by: Luca Boccassi <678b97863301219a7659ccb717573825b33ce6a7@microsoft.com>

bus1/dbus-broker