Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 1997 02:34:58 +0100 (CET)
From:      Philippe Charnier <charnier@xp11.frmug.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2442: setusershell()/endusershell() missing
Message-ID:  <199701110134.CAA28437@xp11.frmug.org>
Resent-Message-ID: <199701110210.SAA18899@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2442
>Category:       bin
>Synopsis:       setusershell()/endusershell() missing
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 10 18:10:01 PST 1997
>Last-Modified:
>Originator:     Philippe Charnier
>Organization:
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	

>Description:

	The right way (TM) should be:
		setusershell()
		some getusershell()
		endusershell()

>How-To-Repeat:

	

>Fix:

Index: ftpd.c
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.27
diff -u -r1.27 ftpd.c
--- ftpd.c	1996/11/30 12:00:25	1.27
+++ ftpd.c	1997/01/11 01:14:39
@@ -617,6 +617,7 @@
 	if ((pw = sgetpwnam(name))) {
 		if ((shell = pw->pw_shell) == NULL || *shell == 0)
 			shell = _PATH_BSHELL;
+		setusershell();
 		while ((cp = getusershell()) != NULL)
 			if (strcmp(cp, shell) == 0)
 				break;

Index: user.c
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/release/sysinstall/user.c,v
retrieving revision 1.7
diff -u -r1.7 user.c
--- user.c	1997/01/03 06:41:41	1.7
+++ user.c	1997/01/11 01:15:29
@@ -423,6 +423,7 @@
 	}
     }
     if (strlen(shell) > 0) {
+	setusershell();
 	while((cp = getusershell()) != NULL)
 	    if (strcmp(cp, shell) == 0)
 		break;

Index: util.c
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/usr.bin/chpass/util.c,v
retrieving revision 1.5
diff -u -r1.5 util.c
--- util.c	1996/08/12 14:45:26	1.5
+++ util.c	1997/01/11 01:16:20
@@ -137,10 +137,11 @@
 	setusershell();
 	while (sh = getusershell()) {
 		if (!strcmp(name, sh))
-			return (name);
+			{ endusershell(); return (name); }
 		/* allow just shell name, but use "real" path */
 		if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0)
-			return (sh);
+			{ endusershell(); return (sh); }
 	}
+	endusershell();
 	return (NULL);
 }


Index: su.c
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/usr.bin/su/su.c,v
retrieving revision 1.14
diff -u -r1.14 su.c
--- su.c	1996/10/07 10:00:58	1.14
+++ su.c	1997/01/11 01:18:41
@@ -330,9 +330,14 @@
 {
 	char *cp;
 
+	setusershell();
 	while ((cp = getusershell()) != NULL)
-		if (strcmp(cp, sh) == 0)
+		if (strcmp(cp, sh) == 0) {
+			endusershell();
 			return (1);
+		}
+
+	endusershell();
 	return (0);
 }

 
Index: pw_scan.c
===================================================================
RCS file: /home2h/FreeBSD.cvsroot/src/usr.sbin/pwd_mkdb/pw_scan.c,v
retrieving revision 1.5
diff -u -r1.5 pw_scan.c
--- pw_scan.c	1996/06/20 19:19:29	1.5
+++ pw_scan.c	1997/01/11 01:20:00
@@ -123,7 +123,8 @@
 
 	p = pw->pw_shell;
 	if (root && *p)					/* empty == /bin/sh */
-		for (setusershell();;) {
+		setusershell();
+		for (;;) {
 			if (!(sh = getusershell())) {
 				warnx("warning, unknown root shell");
 				break;
@@ -131,6 +132,7 @@
 			if (!strcmp(p, sh))
 				break;
 		}
+		endusershell();
 	if(p[0]) pw->pw_fields |= _PWF_SHELL;
 
 	if (p = strsep(&bp, ":")) {			/* too many */


>Audit-Trail:
>Unformatted:



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