From owner-freebsd-current Fri Dec 20 11:58:41 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 7FF3137B401; Fri, 20 Dec 2002 11:58:39 -0800 (PST) Received: from corbulon.video-collage.com (corbulon.video-collage.com [64.35.99.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id C82DD43EE5; Fri, 20 Dec 2002 11:58:38 -0800 (PST) (envelope-from mi+mx@aldan.algebra.com) Received: from mi.us.murex.com (250-217.customer.cloud9.net [168.100.250.217]) by corbulon.video-collage.com (8.12.6/8.12.6) with ESMTP id gBKJwPjJ036094 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=FAIL); Fri, 20 Dec 2002 14:58:27 -0500 (EST) (envelope-from mi+mx@aldan.algebra.com) Content-Type: text/plain; charset="us-ascii" From: Mikhail Teterin Organization: Virtual Estates, Inc. To: current@FreeBSD.org Subject: pam_setenv() crashes rshd... Date: Fri, 20 Dec 2002 15:02:00 -0500 User-Agent: KMail/1.4.3 Cc: des@FreeBSD.org, markm@FreeBSD.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200212201502.00080.mi+mx@aldan.algebra.com> 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 The rshd started to crash on my system after the recent -current upgrade. It does not dump core (why?), but with a lot of syslog() I narrowed the trouble spot down to the pam_setenv() calls -- the very first one of them, in rshd.c never returned... The libpam is: /usr/lib/libpam.so.2: $FreeBSD: src/lib/csu/i386-elf/crti.S,v 1.6 2002/05/15 04:19:49 obrien Exp $ $FreeBSD: src/lib/csu/i386-elf/crtn.S,v 1.5 2002/05/15 04:19:49 obrien Exp $ $FreeBSD: src/lib/libpam/libpam/pam_std_option.c,v 1.10 2002/04/14 18:30:03 des Exp $ $FreeBSD: src/lib/libpam/libpam/pam_debug_log.c,v 1.8 2002/04/14 16:44:04 des Exp $ The following patch fixes (works around?) the problem for me (pam_setenv is rather inefficiently implemented by the vendor, BTW), but is probably wrong in some other aspect. If it is not, it will probably make rshd a bit cleaner and faster... Please, review... Thanks! -mi Index: rshd.c =================================================================== RCS file: /home/ncvs/src/libexec/rshd/rshd.c,v retrieving revision 1.46 diff -U2 -r1.46 rshd.c --- rshd.c 2002/06/26 17:09:08 1.46 +++ rshd.c 2002/12/20 19:44:33 @@ -182,6 +182,4 @@ } -extern char **environ; - void doit(struct sockaddr *fromp) @@ -476,10 +474,9 @@ if (*pwd->pw_shell == '\0') pwd->pw_shell = bshell; - (void) pam_setenv(pamh, "HOME", pwd->pw_dir, 1); - (void) pam_setenv(pamh, "SHELL", pwd->pw_shell, 1); - (void) pam_setenv(pamh, "USER", pwd->pw_name, 1); - (void) pam_setenv(pamh, "PATH", _PATH_DEFPATH, 1); - environ = pam_getenvlist(pamh); (void) pam_end(pamh, pam_err); + (void) setenv("HOME", pwd->pw_dir, 1); + (void) setenv("SHELL", pwd->pw_shell, 1); + (void) setenv("USER", pwd->pw_name, 1); + (void) setenv("PATH", _PATH_DEFPATH, 1); cp = strrchr(pwd->pw_shell, '/'); if (cp) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message