X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Fpam_elogind.c;h=f75b8ac2c91aece4029ae3e0cfee83c22cead8fd;hb=b767c85a403ee56b5f87bc9414638b857dabd18d;hp=1eecbf9d68df05fc742c62f13bfc1d827a3c8eec;hpb=4968287fbe6603ba157ce1c9d9638b0e6befecc5;p=elogind.git diff --git a/src/login/pam_elogind.c b/src/login/pam_elogind.c index 1eecbf9d6..f75b8ac2c 100644 --- a/src/login/pam_elogind.c +++ b/src/login/pam_elogind.c @@ -42,6 +42,7 @@ #include "bus-error.h" #include "formats-util.h" #include "terminal-util.h" +#include "hostname-util.h" static int parse_argv( pam_handle_t *handle, @@ -176,12 +177,11 @@ static int export_legacy_dbus_address( uid_t uid, const char *runtime) { -#ifdef ENABLE_KDBUS _cleanup_free_ char *s = NULL; int r; /* skip export if kdbus is not active */ - if (access("/sys/fs/kdbus", F_OK) < 0) + if (!is_kdbus_available()) return PAM_SUCCESS; if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0) { @@ -194,7 +194,7 @@ static int export_legacy_dbus_address( pam_syslog(handle, LOG_ERR, "Failed to set bus variable."); return r; } -#endif + return PAM_SUCCESS; } @@ -213,7 +213,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( *seat = NULL, *type = NULL, *class = NULL, *class_pam = NULL, *type_pam = NULL, *cvtnr = NULL, *desktop = NULL; - _cleanup_bus_close_unref_ sd_bus *bus = NULL; + _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; int session_fd = -1, existing, r; bool debug = false, remote; struct passwd *pw; @@ -496,7 +496,7 @@ _public_ PAM_EXTERN int pam_sm_close_session( int argc, const char **argv) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - _cleanup_bus_close_unref_ sd_bus *bus = NULL; + _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; const void *existing = NULL; const char *id; int r;