Subject: clearing suid/sgid bits upon ownership change
To: None <tech-kern@NetBSD.ORG>
From: Rob Windsor <windsor@warthog.com>
List: tech-kern
Date: 12/09/1997 13:25:03
kleink
Wed Apr 30 12:29:45 PDT 1997
Update of /cvsroot/src/sys/kern
In directory netbsd1:/var/slash-tmp/cvs-serv1383

Modified Files:
        vfs_syscalls.c 
Log Message:
* Make chown()/fchown() use a piece of common code to set ownership.
* Setting the ownership of a file now implies clearing its set-{group,user}-id
  bits.


vfs_syscalls.c - line 1664

        /* Clear (S_ISUID | S_ISGID) bits: alter va_mode only if necessary. */
        if (vattr.va_mode & (S_ISUID | S_ISGID))
                newmode = vattr.va_mode & ~(S_ISUID | S_ISGID);

what it does:

Clears any suid or sgid bits if owner or group changes.  Even something
insane like clearing the suid bit if you change the group ownership.


what I think about it:

This sucks.  Please #ifdef it or change it so that this appears when
securelevel >1. I can't stand this behavior.  No other modern un*x in the
world does this insane crap.  I just love `surprises' like this in NetBSD --
not.

-- Rob
----------------------------------------
Internet: windsor@warthog.com
Life: Rob@Carrollton.Texas.USA.Earth

The weather is here, wish you were beautiful.