From: Lennart Poettering Date: Fri, 20 Jul 2018 08:07:26 +0000 (+0200) Subject: pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS X-Git-Tag: v240~895^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b2b7228bffef626fe8e9f131095995f3d50ee3b;p=platform%2Fupstream%2Fsystemd.git pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS Since D-Bus 1.9.14 (2015-03-02) dbus looks in $XDG_RUNTIME_DIR/bus for the system bus on its own, hence we can finally drop setting this environment variable. gdbus since glib 2.45.3 (June 2015) also supports it. --- diff --git a/README b/README index 6801d0d..c0b264a 100644 --- a/README +++ b/README @@ -169,7 +169,7 @@ REQUIREMENTS: dependencies: util-linux >= v2.27.1 required - dbus >= 1.4.0 (strictly speaking optional, but recommended) + dbus >= 1.9.14 (strictly speaking optional, but recommended) NOTE: If using dbus < 1.9.18, you should override the default policy directory (--with-dbuspolicydir=/etc/dbus-1/system.d). dracut (optional) diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index 7037c13..f148b1b 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -160,40 +160,6 @@ static int get_seat_from_display(const char *display, const char **seat, uint32_ return 0; } -static int export_legacy_dbus_address( - pam_handle_t *handle, - uid_t uid, - const char *runtime) { - - _cleanup_free_ char *s = NULL; - int r = PAM_BUF_ERR; - - /* FIXME: We *really* should move the access() check into the - * daemons that spawn dbus-daemon, instead of forcing - * DBUS_SESSION_BUS_ADDRESS= here. */ - - s = strjoin(runtime, "/bus"); - if (!s) - goto error; - - if (access(s, F_OK) < 0) - return PAM_SUCCESS; - - s = mfree(s); - if (asprintf(&s, DEFAULT_USER_BUS_ADDRESS_FMT, runtime) < 0) - goto error; - - r = pam_misc_setenv(handle, "DBUS_SESSION_BUS_ADDRESS", s, 0); - if (r != PAM_SUCCESS) - goto error; - - return PAM_SUCCESS; - -error: - pam_syslog(handle, LOG_ERR, "Failed to set bus variable."); - return r; -} - static int append_session_memory_max(pam_handle_t *handle, sd_bus_message *m, const char *limit) { uint64_t val; int r; @@ -338,10 +304,6 @@ _public_ PAM_EXTERN int pam_sm_open_session( return r; } - r = export_legacy_dbus_address(handle, pw->pw_uid, rt); - if (r != PAM_SUCCESS) - return r; - return PAM_SUCCESS; } @@ -568,10 +530,6 @@ _public_ PAM_EXTERN int pam_sm_open_session( pam_syslog(handle, LOG_ERR, "Failed to set runtime dir."); return r; } - - r = export_legacy_dbus_address(handle, pw->pw_uid, runtime_path); - if (r != PAM_SUCCESS) - return r; } if (!isempty(seat)) {