chiark / gitweb /
loginctl: make session/user arguments optional for a number commands, and imply calli...
[elogind.git] / src / login / pam_systemd.c
index 0c71177deb96c48354e495d13d3f2f4559edf6db..d5b29c8af466b5a873ad6917c9efec64c770356e 100644 (file)
@@ -24,7 +24,6 @@
 #include <sys/file.h>
 #include <pwd.h>
 #include <endian.h>
-#include <sys/capability.h>
 
 #include <security/pam_modules.h>
 #include <security/_pam_macros.h>
@@ -114,7 +113,7 @@ static int get_user_data(
         }
 
         *ret_pw = pw;
-        *ret_username = username ? username : pw->pw_name;
+        *ret_username = username;
 
         return PAM_SUCCESS;
 }
@@ -180,11 +179,10 @@ static int export_legacy_dbus_address(
         int r;
 
         /* skip export if kdbus is not active */
-        if (access("/dev/kdbus", F_OK) < 0)
+        if (access("/sys/fs/kdbus", F_OK) < 0)
                 return PAM_SUCCESS;
 
-        if (asprintf(&s, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT,
-                     uid, runtime) < 0) {
+        if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0) {
                 pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
                 return PAM_BUF_ERR;
         }