Subject: kern/576: can't remove symlink created on the directory with sticky bit
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Masaru Oki <oki@fs.telcom.oki.co.jp>
List: netbsd-bugs
Date: 11/15/1994 15:50:04
>Number:         576
>Category:       kern
>Synopsis:       can't remove symlink created on the directory with sticky bit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 15 15:50:02 1994
>Originator:     Masaru Oki
>Organization:
cotton
>Release:        unknown-1.0
>Environment:
    	
	NetBSD/x68k 1.0_BETA

>Description:
	
	When symlink is created on the directory with
	sticky bit (ex. /tmp mounted with MFS), owner of
	created symlink is same as owner of directory.
	because, other users (true symlink creaters)
	can't remove the symlink.

>How-To-Repeat:
	
	% whoami
	oki
	% /cd tmp
	% ln -s foo bar
	% rm bar
	rm: bar: Operation not permitted.

>Fix:
	
	for NetBSD 1.0_BETA (10/18 tar balls):

--- src/sys/ufs/ufs/ufs_vnops.c.orig	Wed Jun 29 19:33:48 1994
+++ src/sys/ufs/ufs/ufs_vnops.c	Wed Nov 16 08:27:52 1994
@@ -1916,10 +1916,7 @@
 	}
 	ip = VTOI(tvp);
 	ip->i_gid = pdir->i_gid;
-	if ((mode & IFMT) == IFLNK)
-		ip->i_uid = pdir->i_uid;
-	else
-		ip->i_uid = cnp->cn_cred->cr_uid;
+	ip->i_uid = cnp->cn_cred->cr_uid;
 #ifdef QUOTA
 	if ((error = getinoquota(ip)) ||
 	    (error = chkiq(ip, 1, cnp->cn_cred, 0))) {
>Audit-Trail:
>Unformatted:

Masaru Oki