From: Sven Eden Date: Tue, 9 Jan 2018 17:57:22 +0000 (+0100) Subject: Prep 235: Enabled sd_peer_get_session() and sd_peer_get_owner_uid() to try to work... X-Git-Tag: v235.1~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=332300ebba89dac83f96891fc25130e078cc24e4;p=elogind.git Prep 235: Enabled sd_peer_get_session() and sd_peer_get_owner_uid() to try to work with eloginds session id to user mapping. --- diff --git a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c index 1af0792d3..b180fab33 100644 --- a/src/libelogind/sd-bus/sd-bus.c +++ b/src/libelogind/sd-bus/sd-bus.c @@ -1020,7 +1020,7 @@ _public_ int sd_bus_open(sd_bus **ret) { if (e) { if (streq(e, "system")) return sd_bus_open_system(ret); -#if 0 /// elogind does not support systemd units +#if 0 /// elogind does not support systemd user instances else if (STR_IN_SET(e, "session", "user")) return sd_bus_open_user(ret); #endif // 0 @@ -1028,7 +1028,7 @@ _public_ int sd_bus_open(sd_bus **ret) { e = secure_getenv("DBUS_STARTER_ADDRESS"); if (!e) { -#if 0 /// elogind does not support systemd units +#if 0 /// elogind does not support systemd user instances if (cg_pid_get_owner_uid(0, NULL) >= 0) return sd_bus_open_user(ret); else @@ -3283,7 +3283,7 @@ _public_ int sd_bus_default(sd_bus **ret) { /* Finally, if nothing is set use the cached connection for * the right scope */ -#if 0 /// elogind does not support systemd units +#if 0 /// elogind does not support systemd user instances if (cg_pid_get_owner_uid(0, NULL) >= 0) return sd_bus_default_user(ret); else diff --git a/src/libelogind/sd-login/sd-login.c b/src/libelogind/sd-login/sd-login.c index f7692cd82..0b406f41c 100644 --- a/src/libelogind/sd-login/sd-login.c +++ b/src/libelogind/sd-login/sd-login.c @@ -180,11 +180,7 @@ _public_ int sd_peer_get_session(int fd, char **session) { if (r < 0) return r; -#if 0 /// elogind does not support systemd scopes return cg_pid_get_session(ucred.pid, session); -#else - return -ESRCH; -#endif // 0 } _public_ int sd_peer_get_owner_uid(int fd, uid_t *uid) { @@ -198,11 +194,7 @@ _public_ int sd_peer_get_owner_uid(int fd, uid_t *uid) { if (r < 0) return r; -#if 0 /// elogind does not support systemd units return cg_pid_get_owner_uid(ucred.pid, uid); -#else - return -ESRCH; -#endif // 0 } _public_ int sd_peer_get_unit(int fd, char **unit) {