Properly set PAM enviornment variables after opening session.
Without this change, modules like pam_mktemp or pam_env and similar will be unable to change users' environments, like they are supposed to.
This commit is contained in:
parent
9ec6ff02bb
commit
53ddd6ca96
@ -563,6 +563,7 @@ int start_stop_daemon(int argc, char **argv)
|
|||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
pam_handle_t *pamh = NULL;
|
pam_handle_t *pamh = NULL;
|
||||||
int pamr;
|
int pamr;
|
||||||
|
const char *const *pamenv = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
@ -1026,6 +1027,19 @@ int start_stop_daemon(int argc, char **argv)
|
|||||||
i = 0;
|
i = 0;
|
||||||
while(environ[i])
|
while(environ[i])
|
||||||
rc_stringlist_add(env_list, environ[i++]);
|
rc_stringlist_add(env_list, environ[i++]);
|
||||||
|
|
||||||
|
#ifdef HAVE_PAM
|
||||||
|
pamenv = (const char *const *)pam_getenvlist(pamh);
|
||||||
|
if (pamenv) {
|
||||||
|
while (*pamenv) {
|
||||||
|
/* Don't add strings unless they set a var */
|
||||||
|
if (strchr(*pamenv, '='))
|
||||||
|
putenv(xstrdup(*pamenv));
|
||||||
|
pamenv++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TAILQ_FOREACH(env, env_list, entries) {
|
TAILQ_FOREACH(env, env_list, entries) {
|
||||||
if ((strncmp(env->value, "RC_", 3) == 0 &&
|
if ((strncmp(env->value, "RC_", 3) == 0 &&
|
||||||
strncmp(env->value, "RC_SERVICE=", 10) != 0 &&
|
strncmp(env->value, "RC_SERVICE=", 10) != 0 &&
|
||||||
|
Loading…
Reference in New Issue
Block a user