From owner-freebsd-current Sat Dec 21 6:41:30 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 93F0637B401; Sat, 21 Dec 2002 06:41:29 -0800 (PST) Received: from corbulon.video-collage.com (corbulon.video-collage.com [64.35.99.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBA8B43EDE; Sat, 21 Dec 2002 06:41:28 -0800 (PST) (envelope-from mi@corbulon.video-collage.com) Received: from corbulon.video-collage.com (localhost.video-collage.com [127.0.0.1]) by corbulon.video-collage.com (8.12.6/8.12.6) with ESMTP id gBLEfGjJ041483 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sat, 21 Dec 2002 09:41:17 -0500 (EST) (envelope-from mi@corbulon.video-collage.com) Received: (from mi@localhost) by corbulon.video-collage.com (8.12.6/8.12.6/Submit) id gBLEfCfU041482; Sat, 21 Dec 2002 09:41:12 -0500 (EST) (envelope-from mi) From: Mikhail Teterin Message-Id: <200212211441.gBLEfCfU041482@corbulon.video-collage.com> Subject: Re: pam_setenv() crashes rshd... In-Reply-To: To: Dag-Erling Smorgrav Date: Sat, 21 Dec 2002 09:41:12 -0500 (EST) Cc: current@FreeBSD.org, markm@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL92b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Scanned-By: MIMEDefang 2.21 (www . roaringpenguin . com / mimedefang) 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 following patch fixes (works around?) the problem for me > > (pam_setenv is rather inefficiently implemented by the vendor, BTW), > I am the vendor. What's wrong with pam_setenv()? I only went into the code to see where it may be crashing my rshd and noticed the mild inefficiency. Did not know where the code is from either. Sorry if I offended you. 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... 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! -mi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message