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;
+
+#ifdef ENABLE_KDBUS
+ if (asprintf(&s, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT,
+ (unsigned long) uid, runtime) < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
+ return PAM_BUF_ERR;
+ }
+#else
+ if (asprintf(&s, UNIX_USER_BUS_FMT, runtime) < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
+ return PAM_BUF_ERR;
+ }
+#endif
+
+ r = pam_misc_setenv(handle, "DBUS_SESSION_BUS_ADDRESS", s, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
+ return r;
+ }
+
+ return PAM_SUCCESS;
+}
+
_public_ PAM_EXTERN int pam_sm_open_session(
pam_handle_t *handle,
int flags,
pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
return r;
}
+
+ r = export_legacy_dbus_address(handle, pw->pw_uid, rt);
+ if (r != PAM_SUCCESS)
+ return r;
}
return PAM_SUCCESS;
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)) {