Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Feb 2002 01:28:55 +0900
From:      Takanori Saneto <sanewo@ba2.so-net.ne.jp>
To:        Dag-Erling Smorgrav <des@FreeBSD.org>
Cc:        Takanori Saneto <sanewo@ba2.so-net.ne.jp>
Subject:   Re: cvs commit: src/lib/libpam/modules/pam_ssh pam_ssh.c
Message-ID:  <200202041628.g14GSti07166@muse.sanewo.dyn.to>
In-Reply-To: <200202041620.g14GK5R06184@muse.sanewo.dyn.to> (Takanori Saneto's message of "Tue, 05 Feb 2002 01:20:05 %2B0900")
References:  <200201241726.g0OHQSN97700@freefall.freebsd.org> <200202041620.g14GK5R06184@muse.sanewo.dyn.to>

next in thread | previous in thread | raw e-mail | index | archive | help
Oops, my previous patch was not correct. (the line saving the value of
current environment was missing)

Here's the correct one:

>Instead of using putenv(), how about using temporaly environment
>generated from pam's environment as in the following patch?

Index: pam_ssh.c
===================================================================
RCS file: /export/cvsup/cvs/src/lib/libpam/modules/pam_ssh/pam_ssh.c,v
retrieving revision 1.24
diff -u -r1.24 pam_ssh.c
--- pam_ssh.c	24 Jan 2002 18:37:16 -0000	1.24
+++ pam_ssh.c	4 Feb 2002 16:24:46 -0000
@@ -482,7 +482,16 @@
 	PAM_LOG("Environment saved");
 
 	/* connect to the agent */
+	{
+	    extern char **environ;
+	    char **save, **evp;
+	    save = environ;
+	    environ = pam_getenvlist(pamh);
 	ac = ssh_get_authentication_connection();
+	    for (evp = environ; *evp; evp++) (void)free(*evp);
+	    (void)free(environ);
+	    environ = save;
+	}
 	if (!ac) {
 		syslog(LOG_ERR, "%s: %s: %m", MODULE_NAME, agent_socket);
 		PAM_RETURN(PAM_SESSION_ERR);

-- 
sanewo

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202041628.g14GSti07166>