Shadow passwd prevents compilation of some programs

Steven M. SchultzY sms at wlv.imsd.contel.com
Thu May 18 02:52:33 AEST 1989


Index:	ucb,usr.bin,bin/finger.c,find.c,ls.c 2.10BSD

Description:
	If the shadow password package is installed, the programs
	'finger', 'ls', and 'find' will not recompile - a ld error
	"__pw_stayopen undefined" is produced.  This is because
	"_pw_stayopen" is now a static in getpwent.c rather than a
	global.

Repeat-By:
	Install the shadow password package, then remake 'ls', 'find'
	or 'finger'.

Fix:
	Use the 'setpassent(1)' call to force the passwd file to stay 
	open.  The following patches should do the trick.

*** ucb/finger.c.old	Tue May 16 20:30:49 1989
--- ucb/finger.c	Tue May 16 20:31:54 1989
***************
*** 195,204 ****
  		exit(2);
  	}
  	if (unquick) {
! 		extern _pw_stayopen;
! 
! 		setpwent();
! 		_pw_stayopen = 1;
  		fwopen();
  	}
  	while (read(uf, (char *)&user, sizeof user) == sizeof user) {
--- 195,201 ----
  		exit(2);
  	}
  	if (unquick) {
! 		setpassent(1);
  		fwopen();
  	}
  	while (read(uf, (char *)&user, sizeof user) == sizeof user) {
***************
*** 273,281 ****
  	if (unquick) {
  		setpwent();
  		if (!match) {
! 			extern _pw_stayopen;
! 
! 			_pw_stayopen = 1;
  			for (p = person1; p != 0; p = p->link)
  				if (pw = getpwnam(p->name))
  					p->pwd = pwdcopy(pw);
--- 270,276 ----
  	if (unquick) {
  		setpwent();
  		if (!match) {
! 			setpassent(1);
  			for (p = person1; p != 0; p = p->link)
  				if (pw = getpwnam(p->name))
  					p->pwd = pwdcopy(pw);
*** usr.bin/find/find.c.old	Tue May 16 21:35:47 1989
--- usr.bin/find/find.c	Tue May 16 21:37:16 1989
***************
*** 972,980 ****
  	register struct passwd *pw;
  	struct passwd *getpwent();
  	register int cp;
- 	extern int _pw_stayopen;
  
! 	_pw_stayopen = 1;
  
  #if	(((NUID) & ((NUID) - 1)) != 0)
  	cp = uid % (NUID);
--- 972,979 ----
  	register struct passwd *pw;
  	struct passwd *getpwent();
  	register int cp;
  
! 	setpassent(1);
  
  #if	(((NUID) & ((NUID) - 1)) != 0)
  	cp = uid % (NUID);
***************
*** 1046,1054 ****
  	register struct passwd *pw;
  	struct passwd *getpwnam();
  #ifndef	NO_PW_STAYOPEN
- 	extern int _pw_stayopen;
  
! 	_pw_stayopen = 1;
  #endif
  
  	pw = getpwnam(username);
--- 1045,1052 ----
  	register struct passwd *pw;
  	struct passwd *getpwnam();
  #ifndef	NO_PW_STAYOPEN
  
! 	setpassent(1);
  #endif
  
  	pw = getpwnam(username);
*** bin/ls.c.old	Tue May 16 20:37:27 1989
--- bin/ls.c	Tue May 16 20:38:42 1989
***************
*** 621,627 ****
  getname(uid)
  	uid_t uid;
  {
- 	extern int _pw_stayopen;
  	static struct ncache {
  		uid_t	uid;
  		char	name[NMAX+1];
--- 621,626 ----
***************
*** 629,635 ****
  	register struct passwd *pw;
  	register struct ncache *cp;
  
! 	_pw_stayopen = 1;
  	cp = c_uid + (uid & CAMASK);
  	if (cp->uid == uid && *cp->name)
  		return(cp->name);
--- 628,634 ----
  	register struct passwd *pw;
  	register struct ncache *cp;
  
! 	setpassent(1);
  	cp = c_uid + (uid & CAMASK);
  	if (cp->uid == uid && *cp->name)
  		return(cp->name);



More information about the Comp.bugs.2bsd mailing list