[comp.os.minix] unlink

pa1285@sdcc13.ucsd.edu (David L. Brown) (01/04/90)

First of all:  I have compiled all of the 1.5.0 commands and are testing
them.  As stated before, changes need to be made for anything
using opendir work (gather, tar, ls, and maybe others).  If you
need these patches, ask me.

Signals are not working properly.  If I press the INT key while in
make, my entire system crashes (no CTRL-ALT-DEL).  Exiting from term
also crashes the system with a floating point exception.

For the main point of my posting:  I think that I might have a fix
for the unlink system call.  The problem was that if a file did not
have write permission, it could not be removed, even if the user had
write permission in the directory.  Please tell me if this fix
causes any other problems, or security holes.

David L. Brown
dbrown@ucsd.edu

--- cut here ---
*** old/path.c	Wed Jan  3 15:38:13 1990
--- path.c	Wed Jan  3 15:42:30 1990
***************
*** 265,271 ****
  			r = OK;
  			if (flag == DELETE) {
  				rip = get_inode(ldir_ptr->i_dev, dp->d_inum);
! 				if ((r = forbidden(rip, W_BIT, 0)) == OK) {
  					/* Save d_inum for recovery. */
  					t = NAME_MAX - sizeof(ino_t);
  					*((ino_t *) &dp->d_name[t])=dp->d_inum;
--- 265,272 ----
  			r = OK;
  			if (flag == DELETE) {
  				rip = get_inode(ldir_ptr->i_dev, dp->d_inum);
! 				if ((r = forbidden(rip, W_BIT, 0)) == OK ||
! 			          (r = forbidden(ldir_ptr, W_BIT, 0)) == OK) {
  					/* Save d_inum for recovery. */
  					t = NAME_MAX - sizeof(ino_t);
  					*((ino_t *) &dp->d_name[t])=dp->d_inum;