Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2002 15:02:00 -0500
From:      Mikhail Teterin <mi+mx@aldan.algebra.com>
To:        current@FreeBSD.org
Cc:        des@FreeBSD.org, markm@FreeBSD.org
Subject:   pam_setenv() crashes rshd...
Message-ID:  <200212201502.00080.mi%2Bmx@aldan.algebra.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212201502.00080.mi%2Bmx>