1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-05 09:17:44 +03:00

Merge pull request #11327 from keszybz/revert-dbus-address

Revert "pam_systemd: drop setting DBUS_SESSION_BUS_ADDRESS"
This commit is contained in:
Lennart Poettering 2019-01-07 16:14:07 +01:00 committed by GitHub
commit f2e28b5a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

2
README
View File

@ -170,7 +170,7 @@ REQUIREMENTS:
dependencies:
util-linux >= v2.27.1 required
dbus >= 1.9.14 (strictly speaking optional, but recommended)
dbus >= 1.4.0 (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)

View File

@ -190,6 +190,28 @@ 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;
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;
@ -405,6 +427,10 @@ _public_ PAM_EXTERN int pam_sm_open_session(
}
}
r = export_legacy_dbus_address(handle, pw->pw_uid, rt);
if (r != PAM_SUCCESS)
return r;
return PAM_SUCCESS;
}
@ -613,6 +639,10 @@ _public_ PAM_EXTERN int pam_sm_open_session(
if (r != PAM_SUCCESS)
return r;
}
r = export_legacy_dbus_address(handle, pw->pw_uid, runtime_path);
if (r != PAM_SUCCESS)
return r;
}
/* Most likely we got the session/type/class from environment variables, but might have gotten the data