Merge pull request #4119 from keszybz/drop-more-kdbus

Drop more kdbus functionality
This commit is contained in:
Evgeny Vereshchagin 2016-09-10 09:26:43 +03:00 committed by GitHub
commit 47af450af0
5 changed files with 21 additions and 66 deletions

View file

@ -1656,7 +1656,6 @@ AC_MSG_RESULT([
nss-myhostname: ${have_myhostname}
hwdb: ${enable_hwdb}
tpm: ${have_tpm}
kdbus: ${have_kdbus}
Python: ${have_python}
man pages: ${have_manpages}
test coverage: ${have_coverage}

View file

@ -99,41 +99,27 @@
setting as negotiated by the program ultimately activated. By
default, file descriptor passing is enabled for both.</para>
<para><function>sd_bus_negotiate_timestamps()</function> controls
whether implicit sender timestamps shall be attached automatically
to all incoming messages. Takes a bus object and a boolean, which,
when true, enables timestamping, and, when false, disables it.
Use
<para><function>sd_bus_negotiate_timestamp()</function> controls whether implicit sender
timestamps shall be attached automatically to all incoming messages. Takes a bus object and a
boolean, which, when true, enables timestamping, and, when false, disables it. Use
<citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry>
to query the timestamps of incoming messages. If negotiation is
disabled or not supported, these calls will fail with
<constant>-ENODATA</constant>. Note that not all transports
support timestamping of messages. Specifically, timestamping is
only available on the kdbus transport, but not on dbus1. The
timestamping is applied by the kernel and cannot be manipulated by
userspace. By default, message timestamping is not negotiated for
to query the timestamps of incoming messages. If negotiation is disabled or not supported, these
calls will fail with <constant>-ENODATA</constant>. Note that currently no transports support
timestamping of messages. By default, message timestamping is not negotiated for
connections.</para>
<para><function>sd_bus_negotiate_creds()</function> controls
whether and which implicit sender credentials shall be attached
automatically to all incoming messages. Takes a bus object and a
boolean indicating whether to enable or disable the credential
parts encoded in the bit mask value argument. Note that not all
transports support attaching sender credentials to messages, or do
not support all types of sender credential parameters, or might
suppress them under certain circumstances for individual
messages. Specifically, implicit sender credentials on messages
are only fully supported on kdbus transports, and dbus1 only
supports <constant>SD_BUS_CREDS_UNIQUE_NAME</constant>. The sender
credentials are attached by the kernel and cannot be manipulated
by userspace, and are thus suitable for authorization
decisions. By default, only
<constant>SD_BUS_CREDS_WELL_KNOWN_NAMES</constant> and
<constant>SD_BUS_CREDS_UNIQUE_NAME</constant> are enabled. In
fact, these two credential fields are always sent along and cannot
be turned off.</para>
<para><function>sd_bus_negotiate_creds()</function> controls whether and which implicit sender
credentials shall be attached automatically to all incoming messages. Takes a bus object and a
boolean indicating whether to enable or disable the credential parts encoded in the bit mask
value argument. Note that not all transports support attaching sender credentials to messages,
or do not support all types of sender credential parameters, or might suppress them under
certain circumstances for individual messages. Specifically, dbus1 only supports
<constant>SD_BUS_CREDS_UNIQUE_NAME</constant>. The sender credentials are suitable for
authorization decisions. By default, only <constant>SD_BUS_CREDS_WELL_KNOWN_NAMES</constant> and
<constant>SD_BUS_CREDS_UNIQUE_NAME</constant> are enabled. In fact, these two credential fields
are always sent along and cannot be turned off.</para>
<para>The <function>sd_bus_negotiate_fds()</function> function may
be called only before the connection has been started with

View file

@ -964,10 +964,6 @@ static int bus_init_private(Manager *m) {
if (m->private_listen_fd >= 0)
return 0;
/* We don't need the private socket if we have kdbus */
if (m->kdbus_fd >= 0)
return 0;
if (MANAGER_IS_SYSTEM(m)) {
/* We want the private bus only when running as init */

View file

@ -590,7 +590,7 @@ int manager_new(UnitFileScope scope, bool test_run, Manager **_m) {
m->idle_pipe[0] = m->idle_pipe[1] = m->idle_pipe[2] = m->idle_pipe[3] = -1;
m->pin_cgroupfs_fd = m->notify_fd = m->cgroups_agent_fd = m->signal_fd = m->time_change_fd =
m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = m->cgroup_inotify_fd =
m->dev_autofs_fd = m->private_listen_fd = m->cgroup_inotify_fd =
m->ask_password_inotify_fd = -1;
m->user_lookup_fds[0] = m->user_lookup_fds[1] = -1;
@ -661,9 +661,8 @@ int manager_new(UnitFileScope scope, bool test_run, Manager **_m) {
goto fail;
}
/* Note that we set up neither kdbus, nor the notify fd
* here. We do that after deserialization, since they might
* have gotten serialized across the reexec. */
/* Note that we do not set up the notify fd here. We do that after deserialization,
* since they might have gotten serialized across the reexec. */
m->taint_usr = dir_is_empty("/usr") > 0;
@ -879,7 +878,6 @@ static int manager_connect_bus(Manager *m, bool reexecuting) {
return 0;
try_bus_connect =
m->kdbus_fd >= 0 ||
reexecuting ||
(MANAGER_IS_USER(m) && getenv("DBUS_SESSION_BUS_ADDRESS"));
@ -1084,7 +1082,6 @@ Manager* manager_free(Manager *m) {
safe_close(m->notify_fd);
safe_close(m->cgroups_agent_fd);
safe_close(m->time_change_fd);
safe_close(m->kdbus_fd);
safe_close_pair(m->user_lookup_fds);
manager_close_ask_password(m);
@ -1287,7 +1284,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
if (q < 0 && r == 0)
r = q;
/* We might have deserialized the kdbus control fd, but if we didn't, then let's create the bus now. */
/* Let's connect to the bus now. */
(void) manager_connect_bus(m, !!serialization);
(void) bus_track_coldplug(m, &m->subscribed, false, m->deserialized_subscribed);
@ -2481,16 +2478,6 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
fprintf(f, "user-lookup=%i %i\n", copy0, copy1);
}
if (m->kdbus_fd >= 0) {
int copy;
copy = fdset_put_dup(fds, m->kdbus_fd);
if (copy < 0)
return copy;
fprintf(f, "kdbus-fd=%i\n", copy);
}
bus_track_serialize(m->subscribed, f, "subscribed");
r = dynamic_user_serialize(m, f, fds);
@ -2678,16 +2665,6 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
m->user_lookup_fds[1] = fdset_remove(fds, fd1);
}
} else if (startswith(l, "kdbus-fd=")) {
int fd;
if (safe_atoi(l + 9, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
log_debug("Failed to parse kdbus fd: %s", l + 9);
else {
safe_close(m->kdbus_fd);
m->kdbus_fd = fdset_remove(fds, fd);
}
} else if (startswith(l, "dynamic-user="))
dynamic_user_deserialize_one(m, l + 13, fds);
else if (startswith(l, "destroy-ipc-uid="))
@ -2699,7 +2676,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
if (strv_extend(&m->deserialized_subscribed, l+11) < 0)
log_oom();
} else
} else if (!startswith(l, "kdbus-fd=")) /* ignore this one */
log_debug("Unknown serialization item '%s'", l);
}

View file

@ -294,9 +294,6 @@ struct Manager {
* value where Unit objects are contained. */
Hashmap *units_requiring_mounts_for;
/* Reference to the kdbus bus control fd */
int kdbus_fd;
/* Used for processing polkit authorization responses */
Hashmap *polkit_registry;