[comp.bugs.4bsd] bug in vfs_lookup.c

ray@gibbs.physics.purdue.edu (Ray Moody) (07/08/89)

Index:	sys/vfs_lookup.c 4.3BSD + ISI4.0D

Version:
	    This bug is in Integrated Solutions Incorporated file system.
	It does not appear in standard 4.3 BSD.

Description:
	    Remote symbolic links not always followed properly.  Even when
	lookuppn is called with followlink == NO_FOLLOW, it is necessary to
	follow all symbolic links except the last one.  In reality, lookuppn
	stops translating paths when it encounters its first remote symbolic
	link if followlink is NO_FOLLOW.

Repeat-By:
	    Try your equivalent of running "ls -F /maxwell/gibbs" on
	Gibbs.  Gibbs and Maxwell are machines on our network.  /maxwell and
	/gibbs are the obvious symbolic links.

Fix:
	RCS file: RCS/vfs_lookup.c,v
	retrieving revision 1.1
	retrieving revision 1.1.1.1
	diff -c -r1.1 -r1.1.1.1
	*** /tmp/,RCSt1025851	Fri Jul  7 14:21:04 1989
	--- /tmp/,RCSt2025851	Fri Jul  7 14:21:05 1989
	***************
	*** 437,443
	  		if (error = SdGetlink(u.u_tcurrpid, pnp->pn_path, lpnp->pn_path,
	  			    &len, &follow, &cindex, &clen))
	  			break;
	! 		if ((len == 0) || (follow != FOLLOW_LINK)) {
	  			error = -1;
	  			break;
	  		}
	
	--- 437,443 -----
	  		if (error = SdGetlink(u.u_tcurrpid, pnp->pn_path, lpnp->pn_path,
	  			    &len, &follow, &cindex, &clen))
	  			break;
	! 		if (len == 0 || follow != FOLLOW_LINK && cindex + clen == pnp->pn_pathlen) {
	  			error = -1;
	  			break;
	  		}