From owner-freebsd-current Sat Dec 21 9:15:47 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 97A3A37B401; Sat, 21 Dec 2002 09:15:46 -0800 (PST) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF48143EE6; Sat, 21 Dec 2002 09:15:45 -0800 (PST) (envelope-from des@ofug.org) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 72B4F5374; Sat, 21 Dec 2002 18:15:42 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Mikhail Teterin Cc: current@FreeBSD.org, markm@FreeBSD.org Subject: Re: pam_setenv() crashes rshd... References: <200212211441.gBLEfCfU041482@corbulon.video-collage.com> From: Dag-Erling Smorgrav Date: Sat, 21 Dec 2002 18:15:42 +0100 In-Reply-To: <200212211441.gBLEfCfU041482@corbulon.video-collage.com> (Mikhail Teterin's message of "Sat, 21 Dec 2002 09:41:12 -0500 (EST)") Message-ID: Lines: 27 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386--freebsd) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mikhail Teterin writes: > The pam_setenv and pam_putenv are backwards, IMHO. putenv should be > using setenv -- not the other way around. Currently, the setenv takes > NAME and VALUE separately, mallocs a new buffer, sprintfs %s=%s into it, > sends the buffer to putenv, which re-parses it and frees it. > > I think, pam_setenv should be doing the actual "dirty work", with putenv > being a wrapper. This would save some cycles (and, possibly, syscalls > -- from malloc), but, of course, it would not be very significant with > todays hardware, yada, yada... No, the storage format for environment variables is part of the API and is intended for compatibility with libc. Doing it your way would be backward. > Would you have any other comments about my original post -- why is > pam_setenv causing the segfault somewhere, and is there anything wrong > with my patch? Thanks! I don't know why it crashes, and I haven't looked at the patch. I probably won't have time for it until early next year. In the meantime, merry Christmas and a happy New Year :) DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message