--- session.c.orig Fri Feb 2 10:00:51 2007 +++ session.c Tue May 22 03:04:22 2007 @@ -578,6 +578,18 @@ /* Do system-dependent login setup here */ +#ifdef USE_PAM + /* pass in environment variables set by libpam and modules it called */ + if (pamh) { + long i; + char **pam_env = pam_getenvlist(pamh); + for(i = 0; pam_env && pam_env[i]; i++) { + verify->userEnviron = putEnv(pam_env[i], verify->userEnviron); + } + + } +#endif + #ifdef USESECUREWARE Debug ("set_identity: uid=%d\n", userp->pw.pw_uid); ret = smp_set_identity (userp, &reason, &smpenv, &smpshell); @@ -628,24 +640,14 @@ } #endif /* QNX4 doesn't support multi-groups, no initgroups() */ #ifdef USE_PAM - if (pamh) { - long i; - char **pam_env; - - pam_error = pam_setcred (pamh, PAM_ESTABLISH_CRED); - if (pam_error != PAM_SUCCESS) { - LogError ("pam_setcred for \"%s\" failed: %s\n", - name, pam_strerror(pamh, pam_error)); - return(0); - } - - /* pass in environment variables set by libpam and modules it called */ - pam_env = pam_getenvlist(pamh); - for(i = 0; pam_env && pam_env[i]; i++) { - verify->userEnviron = putEnv(pam_env[i], verify->userEnviron); - } - - } + if (pamh) { + pam_error = pam_setcred (pamh, PAM_ESTABLISH_CRED); + if (pam_error != PAM_SUCCESS) { + LogError ("pam_setcred for \"%s\" failed: %s\n", + name, pam_strerror(pamh, pam_error)); + return(0); + } + } #endif if (setuid(verify->uid) < 0) { LogError ("setuid %d (user \"%s\") failed, errno=%d\n",