[systemd-commits] 7 commits - src/bus-proxyd src/libsystemd src/systemd

Lennart Poettering lennart at kemper.freedesktop.org
Fri Feb 13 06:50:03 PST 2015


 src/bus-proxyd/driver.c                 |    6 -
 src/bus-proxyd/proxy.c                  |  169 ++++++++++++++++----------------
 src/bus-proxyd/proxy.h                  |    2 
 src/bus-proxyd/stdio-bridge.c           |    2 
 src/bus-proxyd/synthesize.c             |   19 +++
 src/bus-proxyd/synthesize.h             |    7 -
 src/libsystemd/libsystemd.sym.m4        |    1 
 src/libsystemd/sd-bus/bus-convenience.c |    2 
 src/libsystemd/sd-bus/bus-error.c       |    4 
 src/libsystemd/sd-bus/bus-message.c     |    2 
 src/systemd/sd-bus.h                    |    2 
 11 files changed, 122 insertions(+), 94 deletions(-)

New commits:
commit 5f6cb091278906423f8b7e70c40131db7269916a
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:38:38 2015 +0100

    bus-proxy: whenever we cannot forward a message, report this back to caller, but don't exit
    
    Errors like EPERM from the kernel should certainly not be reason to
    exit. Let's try to be defensive here, and try to continue on most send
    errors, but possibly tell the sender about it.

diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index e3042d8..a07c403 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -704,23 +704,29 @@ static int proxy_process_destination_to_local(Proxy *p) {
 
         r = sd_bus_send(p->local_bus, m, NULL);
         if (r < 0) {
-                if (r == -EPERM && m->reply_cookie > 0) {
-                        /* If the peer tries to send a reply and it is rejected with EPERM
-                         * by the kernel, we ignore the error. This catches cases where the
-                         * original method-call didn't had EXPECT_REPLY set, but the proxy-peer
-                         * still sends a reply. This is allowed in dbus1, but not in kdbus. We
-                         * don't want to track reply-windows in the proxy, so we simply ignore
-                         * EPERM for all replies. The only downside is, that callers are no
-                         * longer notified if their replies are dropped. However, this is
-                         * equivalent to the caller's timeout to expire, so this should be
-                         * acceptable. Nobody sane sends replies without a matching method-call,
-                         * so nobody should care. */
-                        return 1;
-                } else {
-                        if (r != -ECONNRESET)
-                                log_error_errno(r, "Failed to send message to client: %m");
+                if (r == -ECONNRESET)
                         return r;
-                }
+
+                /* If the peer tries to send a reply and it is
+                 * rejected with EPERM by the kernel, we ignore the
+                 * error. This catches cases where the original
+                 * method-call didn't had EXPECT_REPLY set, but the
+                 * proxy-peer still sends a reply. This is allowed in
+                 * dbus1, but not in kdbus. We don't want to track
+                 * reply-windows in the proxy, so we simply ignore
+                 * EPERM for all replies. The only downside is, that
+                 * callers are no longer notified if their replies are
+                 * dropped. However, this is equivalent to the
+                 * caller's timeout to expire, so this should be
+                 * acceptable. Nobody sane sends replies without a
+                 * matching method-call, so nobody should care. */
+                if (r == -EPERM && m->reply_cookie > 0)
+                        return 1;
+
+                /* Return the error to the client, if we can */
+                synthetic_reply_method_errnof(m, r, "Failed to forward message we got from destination: %m");
+                log_error_errno(r, "Failed to send message to client, ignoring: %m");
+                return 1;
         }
 
         return 1;
@@ -771,17 +777,20 @@ static int proxy_process_local_to_destination(Proxy *p) {
 
                 r = sd_bus_send(p->destination_bus, m, NULL);
                 if (r < 0) {
-                        if (r == -EREMCHG) {
-                                /* The name database changed since the policy check, hence let's check again */
+                        if (r == -ECONNRESET)
+                                return r;
+
+                        /* The name database changed since the policy check, hence let's check again */
+                        if (r == -EREMCHG)
                                 continue;
-                        } else if (r == -EPERM && m->reply_cookie > 0) {
-                                /* see above why EPERM is ignored for replies */
+
+                        /* see above why EPERM is ignored for replies */
+                        if (r == -EPERM && m->reply_cookie > 0)
                                 return 1;
-                        } else {
-                                if (r != -ECONNRESET)
-                                        log_error_errno(r, "Failed to send message to bus: %m");
-                                return r;
-                        }
+
+                        synthetic_reply_method_errnof(m, r, "Failed to forward message we got from local: %m");
+                        log_error_errno(r, "Failed to send message to bus: %m");
+                        return 1;
                 }
 
                 break;
diff --git a/src/bus-proxyd/synthesize.c b/src/bus-proxyd/synthesize.c
index 36ffe29..e1b0fd3 100644
--- a/src/bus-proxyd/synthesize.c
+++ b/src/bus-proxyd/synthesize.c
@@ -83,7 +83,6 @@ int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const
 }
 
 int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *p) {
-
         _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL;
 
         assert(call);
@@ -99,6 +98,22 @@ int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_e
         return synthetic_reply_method_error(call, &berror);
 }
 
+int synthetic_reply_method_errnof(sd_bus_message *call, int error, const char *format, ...) {
+        _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL;
+        va_list ap;
+
+        assert(call);
+
+        if (call->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
+                return 0;
+
+        va_start(ap, format);
+        sd_bus_error_set_errnofv(&berror, error, format, ap);
+        va_end(ap);
+
+        return synthetic_reply_method_error(call, &berror);
+}
+
 int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r;
diff --git a/src/bus-proxyd/synthesize.h b/src/bus-proxyd/synthesize.h
index e93e0d3..a55f171 100644
--- a/src/bus-proxyd/synthesize.h
+++ b/src/bus-proxyd/synthesize.h
@@ -23,10 +23,12 @@
 
 #include "sd-bus.h"
 
-int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const char *format, ...);
 int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...);
 int synthetic_reply_method_return_strv(sd_bus_message *call, char **l);
 
 int synthetic_reply_method_error(sd_bus_message *call, const sd_bus_error *e);
+int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const char *format, ...) _sd_printf_(3, 4);
 int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *p);
+int synthetic_reply_method_errnof(sd_bus_message *call, int error, const char *format, ...) _sd_printf_(3, 4);
+
 int synthesize_name_acquired(sd_bus *a, sd_bus *b, sd_bus_message *m);

commit 1433efd219a6df414a1821b3d3d70d86201ed3e4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:37:34 2015 +0100

    bus-proxy: rename synthetic_reply_return_strv() to synthetic_reply_method_return_strv()
    
    That way it matches more closely the nomenclature of our other
    success reply calls.

diff --git a/src/bus-proxyd/driver.c b/src/bus-proxyd/driver.c
index e47c667..bc2c0c8 100644
--- a/src/bus-proxyd/driver.c
+++ b/src/bus-proxyd/driver.c
@@ -305,7 +305,7 @@ int bus_proxy_process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m, SharedPoli
                 /* Let's sort the names list to make it stable */
                 strv_sort(names);
 
-                return synthetic_reply_return_strv(m, names);
+                return synthetic_reply_method_return_strv(m, names);
 
         } else if (sd_bus_message_is_method_call(m, "org.freedesktop.DBus", "ListNames")) {
                 _cleanup_strv_free_ char **names = NULL;
@@ -324,7 +324,7 @@ int bus_proxy_process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m, SharedPoli
                 /* Let's sort the names list to make it stable */
                 strv_sort(names);
 
-                return synthetic_reply_return_strv(m, names);
+                return synthetic_reply_method_return_strv(m, names);
 
         } else if (sd_bus_message_is_method_call(m, "org.freedesktop.DBus", "ListQueuedOwners")) {
                 struct kdbus_cmd_list cmd = {
@@ -389,7 +389,7 @@ int bus_proxy_process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m, SharedPoli
                 if (err < 0)
                         return synthetic_reply_method_errno(m, err, NULL);
 
-                return synthetic_reply_return_strv(m, owners);
+                return synthetic_reply_method_return_strv(m, owners);
 
         } else if (sd_bus_message_is_method_call(m, "org.freedesktop.DBus", "NameHasOwner")) {
                 const char *name;
diff --git a/src/bus-proxyd/synthesize.c b/src/bus-proxyd/synthesize.c
index ab73d6e..36ffe29 100644
--- a/src/bus-proxyd/synthesize.c
+++ b/src/bus-proxyd/synthesize.c
@@ -125,7 +125,7 @@ int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...)
         return synthetic_driver_send(call->bus, m);
 }
 
-int synthetic_reply_return_strv(sd_bus_message *call, char **l) {
+int synthetic_reply_method_return_strv(sd_bus_message *call, char **l) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r;
 
diff --git a/src/bus-proxyd/synthesize.h b/src/bus-proxyd/synthesize.h
index c24a8c8..e93e0d3 100644
--- a/src/bus-proxyd/synthesize.h
+++ b/src/bus-proxyd/synthesize.h
@@ -25,7 +25,8 @@
 
 int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const char *format, ...);
 int synthetic_reply_method_return(sd_bus_message *call, const char *types, ...);
-int synthetic_reply_return_strv(sd_bus_message *call, char **l);
+int synthetic_reply_method_return_strv(sd_bus_message *call, char **l);
+
 int synthetic_reply_method_error(sd_bus_message *call, const sd_bus_error *e);
 int synthetic_reply_method_errno(sd_bus_message *call, int error, const sd_bus_error *p);
 int synthesize_name_acquired(sd_bus *a, sd_bus *b, sd_bus_message *m);

commit 418e4cb07d56e365b9b77b24d3c851e85940d68b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:36:15 2015 +0100

    bus-proxy: minor simplifications

diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index 1c72eac..e3042d8 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -673,13 +673,12 @@ static int proxy_process_destination_to_local(Proxy *p) {
         assert(p);
 
         r = sd_bus_process(p->destination_bus, &m);
+        if (r == -ECONNRESET) /* Treat 'connection reset by peer' as clean exit condition */
+                return r;
         if (r < 0) {
-                /* treat 'connection reset by peer' as clean exit condition */
-                if (r != -ECONNRESET)
-                        log_error_errno(r, "Failed to process destination bus: %m");
+                log_error_errno(r, "Failed to process destination bus: %m");
                 return r;
         }
-
         if (r == 0)
                 return 0;
         if (!m)
@@ -699,7 +698,7 @@ static int proxy_process_destination_to_local(Proxy *p) {
                 r = process_policy(p->destination_bus, p->local_bus, m, p->policy, &p->local_creds, p->owned_names);
                 if (r < 0)
                         return log_error_errno(r, "Failed to process policy: %m");
-                else if (r > 0)
+                if (r > 0)
                         return 1;
         }
 
@@ -734,13 +733,12 @@ static int proxy_process_local_to_destination(Proxy *p) {
         assert(p);
 
         r = sd_bus_process(p->local_bus, &m);
+        if (r == -ECONNRESET) /* Treat 'connection reset by peer' as clean exit condition */
+                return r;
         if (r < 0) {
-                /* treat 'connection reset by peer' as clean exit condition */
-                if (r != -ECONNRESET)
-                        log_error_errno(r, "Failed to process local bus: %m");
+                log_error_errno(r, "Failed to process local bus: %m");
                 return r;
         }
-
         if (r == 0)
                 return 0;
         if (!m)
@@ -753,13 +751,13 @@ static int proxy_process_local_to_destination(Proxy *p) {
         r = process_hello(p, m);
         if (r < 0)
                 return log_error_errno(r, "Failed to process HELLO: %m");
-        else if (r > 0)
+        if (r > 0)
                 return 1;
 
         r = bus_proxy_process_driver(p->destination_bus, p->local_bus, m, p->policy, &p->local_creds, p->owned_names);
         if (r < 0)
                 return log_error_errno(r, "Failed to process driver calls: %m");
-        else if (r > 0)
+        if (r > 0)
                 return 1;
 
         for (;;) {
@@ -805,9 +803,9 @@ int proxy_run(Proxy *p) {
                         r = proxy_process_destination_to_local(p);
                         if (r == -ECONNRESET)
                                 return 0;
-                        else if (r < 0)
+                        if (r < 0)
                                 return r;
-                        else if (r > 0)
+                        if (r > 0)
                                 busy = true;
                 }
 
@@ -815,9 +813,9 @@ int proxy_run(Proxy *p) {
                 r = proxy_process_local_to_destination(p);
                 if (r == -ECONNRESET)
                         return 0;
-                else if (r < 0)
+                if (r < 0)
                         return r;
-                else if (r > 0)
+                if (r > 0)
                         busy = true;
 
                 if (!busy) {

commit 07a0d22f9ec5a0cac2385b73dc08b12a811cead8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:34:54 2015 +0100

    sd-bus: export sd_bus_error_set_errnofv()

diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym.m4
index 41418b9..76a8c92 100644
--- a/src/libsystemd/libsystemd.sym.m4
+++ b/src/libsystemd/libsystemd.sym.m4
@@ -350,6 +350,7 @@ global:
         sd_bus_error_set_const;
         sd_bus_error_set_errno;
         sd_bus_error_set_errnof;
+        sd_bus_error_set_errnofv;
         sd_bus_error_get_errno;
         sd_bus_error_copy;
         sd_bus_error_is_set;
diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
index ae0f4fa..a6317e9 100644
--- a/src/libsystemd/sd-bus/bus-convenience.c
+++ b/src/libsystemd/sd-bus/bus-convenience.c
@@ -234,7 +234,7 @@ _public_ int sd_bus_reply_method_errnof(
                 return 0;
 
         va_start(ap, format);
-        bus_error_set_errnofv(&berror, error, format, ap);
+        sd_bus_error_set_errnofv(&berror, error, format, ap);
         va_end(ap);
 
         return sd_bus_reply_method_error(call, &berror);
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
index 09800ec..3bf0c5d 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
@@ -468,7 +468,7 @@ _public_ int sd_bus_error_set_errno(sd_bus_error *e, int error) {
         return -error;
 }
 
-int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_list ap) {
+_public_ int sd_bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_list ap) {
         PROTECT_ERRNO;
         int r;
 
@@ -551,7 +551,7 @@ _public_ int sd_bus_error_set_errnof(sd_bus_error *e, int error, const char *for
                 va_list ap;
 
                 va_start(ap, format);
-                r = bus_error_set_errnofv(e, error, format, ap);
+                r = sd_bus_error_set_errnofv(e, error, format, ap);
                 va_end(ap);
 
                 return r;
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 3f2d6e7..da14a28 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -742,7 +742,7 @@ _public_ int sd_bus_message_new_method_errnof(
         va_list ap;
 
         va_start(ap, format);
-        bus_error_set_errnofv(&berror, error, format, ap);
+        sd_bus_error_set_errnofv(&berror, error, format, ap);
         va_end(ap);
 
         return sd_bus_message_new_method_error(call, m, &berror);
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 4f253a1..2420d0c 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -23,6 +23,7 @@
 ***/
 
 #include <inttypes.h>
+#include <stdarg.h>
 #include <sys/types.h>
 #include <sys/uio.h>
 
@@ -370,6 +371,7 @@ int sd_bus_error_setf(sd_bus_error *e, const char *name, const char *format, ...
 int sd_bus_error_set_const(sd_bus_error *e, const char *name, const char *message);
 int sd_bus_error_set_errno(sd_bus_error *e, int error);
 int sd_bus_error_set_errnof(sd_bus_error *e, int error, const char *format, ...) _sd_printf_(3, 4);
+int sd_bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_list ap);
 int sd_bus_error_get_errno(const sd_bus_error *e);
 int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e);
 int sd_bus_error_is_set(const sd_bus_error *e);

commit 61adca52f6f0b119e501c523008a454887cdf2b9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:34:11 2015 +0100

    bus-proxy: no need to negate error codes, log_error_errno() already does it

diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index fb24092..1c72eac 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -576,11 +576,11 @@ static int process_hello(Proxy *p, sd_bus_message *m) {
                 if (p->got_hello)
                         return 0;
 
-                return log_error_errno(-EIO, "First packet isn't hello (it's %s.%s), aborting.", m->interface, m->member);
+                return log_error_errno(EIO, "First packet isn't hello (it's %s.%s), aborting.", m->interface, m->member);
         }
 
         if (p->got_hello)
-                return log_error_errno(-EIO, "Got duplicate hello, aborting.");
+                return log_error_errno(EIO, "Got duplicate hello, aborting.");
 
         p->got_hello = true;
 

commit 1140e154100f7224fb8bab55ba7fc087409f9d76
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:33:42 2015 +0100

    bus-proxy: tell Coverity we don't care about these return values

diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index 0b8c448..fb24092 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -431,7 +431,7 @@ static int process_policy_unlocked(sd_bus *from, sd_bus *to, sd_bus_message *m,
                         return 0;
 
                 /* The message came from the kernel, and is sent to our legacy client. */
-                sd_bus_creds_get_well_known_names(&m->creds, &sender_names);
+                (void) sd_bus_creds_get_well_known_names(&m->creds, &sender_names);
 
                 (void) sd_bus_creds_get_euid(&m->creds, &sender_uid);
                 (void) sd_bus_creds_get_egid(&m->creds, &sender_gid);
@@ -492,7 +492,7 @@ static int process_policy_unlocked(sd_bus *from, sd_bus *to, sd_bus_message *m,
                         if (r < 0)
                                 return handle_policy_error(m, r);
 
-                        sd_bus_creds_get_well_known_names(destination_creds, &destination_names);
+                        (void) sd_bus_creds_get_well_known_names(destination_creds, &destination_names);
 
                         (void) sd_bus_creds_get_euid(destination_creds, &destination_uid);
                         (void) sd_bus_creds_get_egid(destination_creds, &destination_gid);

commit d27efd93841a2ac2127fd53321368cc3f975c564
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 13 15:05:34 2015 +0100

    bus-proxy: we don't pointlessly abbreviate function names
    
    It's fine to abbreviate local variables, but it's not OK to abbreviate
    function names needlessly. This is not an excercise in writing
    unreadable code.

diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index 2a3de70..0b8c448 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -53,7 +53,7 @@
 #include "proxy.h"
 #include "synthesize.h"
 
-static int proxy_create_dest(Proxy *p, const char *dest, const char *local_sec, bool negotiate_fds) {
+static int proxy_create_destination(Proxy *p, const char *destination, const char *local_sec, bool negotiate_fds) {
         _cleanup_bus_close_unref_ sd_bus *b = NULL;
         int r;
 
@@ -65,7 +65,7 @@ static int proxy_create_dest(Proxy *p, const char *dest, const char *local_sec,
         if (r < 0)
                 return log_error_errno(r, "Failed to set bus name: %m");
 
-        r = sd_bus_set_address(b, dest);
+        r = sd_bus_set_address(b, destination);
         if (r < 0)
                 return log_error_errno(r, "Failed to set address to connect to: %m");
 
@@ -104,7 +104,7 @@ static int proxy_create_dest(Proxy *p, const char *dest, const char *local_sec,
         if (r < 0)
                 return log_error_errno(r, "Failed to start bus client: %m");
 
-        p->dest_bus = b;
+        p->destination_bus = b;
         b = NULL;
         return 0;
 }
@@ -122,7 +122,7 @@ static int proxy_create_local(Proxy *p, int in_fd, int out_fd, bool negotiate_fd
         if (r < 0)
                 return log_error_errno(r, "Failed to set fds: %m");
 
-        r = sd_bus_get_bus_id(p->dest_bus, &server_id);
+        r = sd_bus_get_bus_id(p->destination_bus, &server_id);
         if (r < 0)
                 return log_error_errno(r, "Failed to get server ID: %m");
 
@@ -158,10 +158,10 @@ static int proxy_prepare_matches(Proxy *p) {
         const char *unique;
         int r;
 
-        if (!p->dest_bus->is_kernel)
+        if (!p->destination_bus->is_kernel)
                 return 0;
 
-        r = sd_bus_get_unique_name(p->dest_bus, &unique);
+        r = sd_bus_get_unique_name(p->destination_bus, &unique);
         if (r < 0)
                 return log_error_errno(r, "Failed to get unique name: %m");
 
@@ -177,7 +177,7 @@ static int proxy_prepare_matches(Proxy *p) {
         if (!match)
                 return log_oom();
 
-        r = sd_bus_add_match(p->dest_bus, NULL, match, NULL, NULL);
+        r = sd_bus_add_match(p->destination_bus, NULL, match, NULL, NULL);
         if (r < 0)
                 return log_error_errno(r, "Failed to add match for NameLost: %m");
 
@@ -194,14 +194,14 @@ static int proxy_prepare_matches(Proxy *p) {
         if (!match)
                 return log_oom();
 
-        r = sd_bus_add_match(p->dest_bus, NULL, match, NULL, NULL);
+        r = sd_bus_add_match(p->destination_bus, NULL, match, NULL, NULL);
         if (r < 0)
                 return log_error_errno(r, "Failed to add match for NameAcquired: %m");
 
         return 0;
 }
 
-int proxy_new(Proxy **out, int in_fd, int out_fd, const char *dest) {
+int proxy_new(Proxy **out, int in_fd, int out_fd, const char *destination) {
         _cleanup_(proxy_freep) Proxy *p = NULL;
         _cleanup_free_ char *local_sec = NULL;
         bool is_unix;
@@ -226,7 +226,7 @@ int proxy_new(Proxy **out, int in_fd, int out_fd, const char *dest) {
                 (void) getpeersec(in_fd, &local_sec);
         }
 
-        r = proxy_create_dest(p, dest, local_sec, is_unix);
+        r = proxy_create_destination(p, destination, local_sec, is_unix);
         if (r < 0)
                 return r;
 
@@ -248,7 +248,7 @@ Proxy *proxy_free(Proxy *p) {
                 return NULL;
 
         sd_bus_close_unrefp(&p->local_bus);
-        sd_bus_close_unrefp(&p->dest_bus);
+        sd_bus_close_unrefp(&p->destination_bus);
         set_free_free(p->owned_names);
         free(p);
 
@@ -264,7 +264,7 @@ int proxy_set_policy(Proxy *p, SharedPolicy *sp, char **configuration) {
         assert(sp);
 
         /* no need to load legacy policy if destination is not kdbus */
-        if (!p->dest_bus->is_kernel)
+        if (!p->destination_bus->is_kernel)
                 return 0;
 
         p->policy = sp;
@@ -279,7 +279,7 @@ int proxy_set_policy(Proxy *p, SharedPolicy *sp, char **configuration) {
         if (!configuration) {
                 const char *scope;
 
-                r = sd_bus_get_scope(p->dest_bus, &scope);
+                r = sd_bus_get_scope(p->destination_bus, &scope);
                 if (r < 0)
                         return log_error_errno(r, "Couldn't determine bus scope: %m");
 
@@ -329,23 +329,23 @@ int proxy_hello_policy(Proxy *p, uid_t original_uid) {
 }
 
 static int proxy_wait(Proxy *p) {
-        uint64_t timeout_dest, timeout_local, t;
-        int events_dest, events_local, fd;
+        uint64_t timeout_destination, timeout_local, t;
+        int events_destination, events_local, fd;
         struct timespec _ts, *ts;
         struct pollfd *pollfd;
         int r;
 
         assert(p);
 
-        fd = sd_bus_get_fd(p->dest_bus);
+        fd = sd_bus_get_fd(p->destination_bus);
         if (fd < 0)
                 return log_error_errno(fd, "Failed to get fd: %m");
 
-        events_dest = sd_bus_get_events(p->dest_bus);
-        if (events_dest < 0)
-                return log_error_errno(events_dest, "Failed to get events mask: %m");
+        events_destination = sd_bus_get_events(p->destination_bus);
+        if (events_destination < 0)
+                return log_error_errno(events_destination, "Failed to get events mask: %m");
 
-        r = sd_bus_get_timeout(p->dest_bus, &timeout_dest);
+        r = sd_bus_get_timeout(p->destination_bus, &timeout_destination);
         if (r < 0)
                 return log_error_errno(r, "Failed to get timeout: %m");
 
@@ -357,8 +357,8 @@ static int proxy_wait(Proxy *p) {
         if (r < 0)
                 return log_error_errno(r, "Failed to get timeout: %m");
 
-        t = timeout_dest;
-        if (t == (uint64_t) -1 || (timeout_local != (uint64_t) -1 && timeout_local < timeout_dest))
+        t = timeout_destination;
+        if (t == (uint64_t) -1 || (timeout_local != (uint64_t) -1 && timeout_local < timeout_destination))
                 t = timeout_local;
 
         if (t == (uint64_t) -1)
@@ -376,7 +376,7 @@ static int proxy_wait(Proxy *p) {
         }
 
         pollfd = (struct pollfd[3]) {
-                { .fd = fd,           .events = events_dest,            },
+                { .fd = fd,           .events = events_destination,            },
                 { .fd = p->local_in,  .events = events_local & POLLIN,  },
                 { .fd = p->local_out, .events = events_local & POLLOUT, },
         };
@@ -584,14 +584,14 @@ static int process_hello(Proxy *p, sd_bus_message *m) {
 
         p->got_hello = true;
 
-        if (!p->dest_bus->is_kernel)
+        if (!p->destination_bus->is_kernel)
                 return 0;
 
         r = sd_bus_message_new_method_return(m, &n);
         if (r < 0)
                 return log_error_errno(r, "Failed to generate HELLO reply: %m");
 
-        r = sd_bus_message_append(n, "s", p->dest_bus->unique_name);
+        r = sd_bus_message_append(n, "s", p->destination_bus->unique_name);
         if (r < 0)
                 return log_error_errno(r, "Failed to append unique name to HELLO reply: %m");
 
@@ -617,7 +617,7 @@ static int process_hello(Proxy *p, sd_bus_message *m) {
         if (r < 0)
                 return log_error_errno(r, "Failed to allocate initial NameAcquired message: %m");
 
-        r = sd_bus_message_append(n, "s", p->dest_bus->unique_name);
+        r = sd_bus_message_append(n, "s", p->destination_bus->unique_name);
         if (r < 0)
                 return log_error_errno(r, "Failed to append unique name to NameAcquired message: %m");
 
@@ -666,13 +666,13 @@ static int patch_sender(sd_bus *a, sd_bus_message *m) {
         return 0;
 }
 
-static int proxy_process_dest_to_local(Proxy *p) {
+static int proxy_process_destination_to_local(Proxy *p) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r;
 
         assert(p);
 
-        r = sd_bus_process(p->dest_bus, &m);
+        r = sd_bus_process(p->destination_bus, &m);
         if (r < 0) {
                 /* treat 'connection reset by peer' as clean exit condition */
                 if (r != -ECONNRESET)
@@ -689,14 +689,14 @@ static int proxy_process_dest_to_local(Proxy *p) {
         if (sd_bus_message_is_signal(m, "org.freedesktop.DBus.Local", "Disconnected"))
                 return -ECONNRESET;
 
-        r = synthesize_name_acquired(p->dest_bus, p->local_bus, m);
+        r = synthesize_name_acquired(p->destination_bus, p->local_bus, m);
         if (r < 0)
                 return log_error_errno(r, "Failed to synthesize message: %m");
 
-        patch_sender(p->dest_bus, m);
+        patch_sender(p->destination_bus, m);
 
         if (p->policy) {
-                r = process_policy(p->dest_bus, p->local_bus, m, p->policy, &p->local_creds, p->owned_names);
+                r = process_policy(p->destination_bus, p->local_bus, m, p->policy, &p->local_creds, p->owned_names);
                 if (r < 0)
                         return log_error_errno(r, "Failed to process policy: %m");
                 else if (r > 0)
@@ -727,7 +727,7 @@ static int proxy_process_dest_to_local(Proxy *p) {
         return 1;
 }
 
-static int proxy_process_local_to_dest(Proxy *p) {
+static int proxy_process_local_to_destination(Proxy *p) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
         int r;
 
@@ -756,7 +756,7 @@ static int proxy_process_local_to_dest(Proxy *p) {
         else if (r > 0)
                 return 1;
 
-        r = bus_proxy_process_driver(p->dest_bus, p->local_bus, m, p->policy, &p->local_creds, p->owned_names);
+        r = bus_proxy_process_driver(p->destination_bus, p->local_bus, m, p->policy, &p->local_creds, p->owned_names);
         if (r < 0)
                 return log_error_errno(r, "Failed to process driver calls: %m");
         else if (r > 0)
@@ -764,14 +764,14 @@ static int proxy_process_local_to_dest(Proxy *p) {
 
         for (;;) {
                 if (p->policy) {
-                        r = process_policy(p->local_bus, p->dest_bus, m, p->policy, &p->local_creds, p->owned_names);
+                        r = process_policy(p->local_bus, p->destination_bus, m, p->policy, &p->local_creds, p->owned_names);
                         if (r < 0)
                                 return log_error_errno(r, "Failed to process policy: %m");
                         else if (r > 0)
                                 return 1;
                 }
 
-                r = sd_bus_send(p->dest_bus, m, NULL);
+                r = sd_bus_send(p->destination_bus, m, NULL);
                 if (r < 0) {
                         if (r == -EREMCHG) {
                                 /* The name database changed since the policy check, hence let's check again */
@@ -802,7 +802,7 @@ int proxy_run(Proxy *p) {
 
                 if (p->got_hello) {
                         /* Read messages from bus, to pass them on to our client */
-                        r = proxy_process_dest_to_local(p);
+                        r = proxy_process_destination_to_local(p);
                         if (r == -ECONNRESET)
                                 return 0;
                         else if (r < 0)
@@ -812,7 +812,7 @@ int proxy_run(Proxy *p) {
                 }
 
                 /* Read messages from our client, to pass them on to the bus */
-                r = proxy_process_local_to_dest(p);
+                r = proxy_process_local_to_destination(p);
                 if (r == -ECONNRESET)
                         return 0;
                 else if (r < 0)
diff --git a/src/bus-proxyd/proxy.h b/src/bus-proxyd/proxy.h
index 21c34f1..913d470 100644
--- a/src/bus-proxyd/proxy.h
+++ b/src/bus-proxyd/proxy.h
@@ -34,7 +34,7 @@ struct Proxy {
         int local_in;
         int local_out;
 
-        sd_bus *dest_bus;
+        sd_bus *destination_bus;
 
         Set *owned_names;
         SharedPolicy *policy;
diff --git a/src/bus-proxyd/stdio-bridge.c b/src/bus-proxyd/stdio-bridge.c
index 434a989..9fb3e9f 100644
--- a/src/bus-proxyd/stdio-bridge.c
+++ b/src/bus-proxyd/stdio-bridge.c
@@ -246,7 +246,7 @@ int main(int argc, char *argv[]) {
         if (r < 0)
                 goto finish;
 
-        r = rename_service(p->dest_bus, p->local_bus);
+        r = rename_service(p->destination_bus, p->local_bus);
         if (r < 0)
                 log_debug_errno(r, "Failed to rename process: %m");
 



More information about the systemd-commits mailing list