aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-10-29 21:35:45 +0000
committerRoy Marples <roy@marples.name>2008-10-29 21:35:45 +0000
commit53ddd6ca96a26e08b37b76bc4ec7477c83d8752e (patch)
treea19b1a398bb81809874d9518dc15916e4c481125
parent9ec6ff02bbb47f7ee03dc4b3d3cdf5c91052809c (diff)
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.
-rw-r--r--src/rc/start-stop-daemon.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index 463983e4..de5bd1dc 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -563,6 +563,7 @@ int start_stop_daemon(int argc, char **argv)
#ifdef HAVE_PAM
pam_handle_t *pamh = NULL;
int pamr;
+ const char *const *pamenv = NULL;
#endif
int opt;
@@ -1026,6 +1027,19 @@ int start_stop_daemon(int argc, char **argv)
i = 0;
while(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) {
if ((strncmp(env->value, "RC_", 3) == 0 &&
strncmp(env->value, "RC_SERVICE=", 10) != 0 &&