File netkit-rsh-0.17-pam-env.diff of Package rsh

---
 rshd/rshd.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/rshd/rshd.c
+++ b/rshd/rshd.c
@@ -504,6 +504,18 @@
 		exit(1);
 	}
 	environ = envinit;
+	/* duplicate environ from pam_environment */
+	{
+	  const char *const *penv=
+	    (const char *const *)pam_getenvlist(pamh);
+
+	  if(penv!=NULL) {
+	    const char *const *p;
+	    for (p = penv; *p; p++)
+	      putenv(*p);
+	    pam_misc_drop_env(penv);
+	  }
+	}
 
 	strncat(homedir, pwd->pw_dir, sizeof(homedir)-6);
 	homedir[sizeof(homedir)-1] = 0;