From bbfb8c878c4909fa3de6c735ab84dd6e6158e61f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 6 May 2021 16:41:05 +0200 Subject: [PATCH] userdbd: reverse which path is a socket and which a symlink userdbd listens on "two" sockets, that are actually the same: one is a real AF_UNIX socket in the fs, and the other is a symlink to it. So far, when userdbd was started from the command line it would make one a symlink and the other a real socket, but when invoked via unit files they'd be swapped, i.e. the other would be a symlink and the one a real socket. Let's bring this in line. Since the "io.systemd.Multiplexer" is our main interface, let's make it the one exposed as socket, and then make "io.systemd.NameServiceSwitch" a symlink to it. Or in other words, let's adjust the C code to match the unit file. --- src/userdb/userdbd-manager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/userdb/userdbd-manager.c b/src/userdb/userdbd-manager.c index f8d315ce2de..3fd82255ac6 100644 --- a/src/userdb/userdbd-manager.c +++ b/src/userdb/userdbd-manager.c @@ -267,7 +267,7 @@ int manager_startup(Manager *m) { else { union sockaddr_union sockaddr = { .un.sun_family = AF_UNIX, - .un.sun_path = "/run/systemd/userdb/io.systemd.NameServiceSwitch", + .un.sun_path = "/run/systemd/userdb/io.systemd.Multiplexer", }; r = mkdir_p("/run/systemd/userdb", 0755); @@ -284,7 +284,8 @@ int manager_startup(Manager *m) { if (bind(m->listen_fd, &sockaddr.sa, SOCKADDR_UN_LEN(sockaddr.un)) < 0) return log_error_errno(errno, "Failed to bind socket: %m"); - r = symlink_idempotent("io.systemd.NameServiceSwitch", "/run/systemd/userdb/io.systemd.Multiplexer", false); + r = symlink_idempotent("io.systemd.Multiplexer", + "/run/systemd/userdb/io.systemd.NameServiceSwitch", false); if (r < 0) return log_error_errno(r, "Failed to bind io.systemd.Multiplexer: %m"); -- 2.47.3