home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / bsd / 10521 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.4 KB  |  71 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!munnari.oz.au!metro!ipso!runxtsa!bde
  3. From: bde@runx.oz.au (Bruce Evans)
  4. Subject: Re: 386BSD - Bug in UFS file system + proposed fix
  5. Message-ID: <1992Dec21.081943.8395@runx.oz.au>
  6. Organization: RUNX Un*x Timeshare.  Sydney, Australia.
  7. References: <1992Dec16.012248.8123@moxie.hou.tx.us> <1992Dec16.211422.3663@fcom.cc.utah.edu>
  8. Date: Mon, 21 Dec 92 08:19:43 GMT
  9. Lines: 60
  10.  
  11. In article <1992Dec16.211422.3663@fcom.cc.utah.edu> terry@cs.weber.edu (A Wizard of Earth C) writes:
  12. >In article <1992Dec16.012248.8123@moxie.hou.tx.us> hackney@moxie.hou.tx.us (Greg Hackney) writes:
  13. >>[ I posted this once, but I'm reasonably sure it didn't make it out ]
  14. >>
  15. >>There is a major bug in the 386BSD UFS code relating to file permissions.
  16. >>The major symptom is:
  17. >>
  18. >>   Can't read most files that you don't own on a remote NFS 386BSD system,
  19. >>   although there is public read permission, i.e.:
  20. >>
  21. >>-r--r--r--   1 root     other          5 Dec 15 19:15 /tmp/hell
  22. >>
  23. >>A very minor symptom is you can't read some LOCAL files, although
  24. >>there is public read permission, i.e. a file that looks like:
  25. >>
  26. >>-------r--   1 root     other          5 Dec 15 19:15 /tmp/hell
  27. >>
  28. >>[ This functionality seems broken on SunOS 4.1 too, but not on USL S5R4. ]
  29. >
  30. >[ ... fix deleted ... ]
  31. >
  32. >This fix seems a bad thing.  In particular, you *don't* want to allow a
  33. >file which is world read or world execute to be read/executed by someone
  34. >who is a member of a group denied access.
  35.  
  36. I think the fix is correct.  It seems to be the same patch that I posted
  37. the other day, but is backwards.
  38.  
  39. Fix undeleted:
  40. ---
  41. *** sys.386bsd/ufs/ufs_vnops.c.orig    Tue Dec 15 19:07:09 1992
  42. --- sys.386bsd/ufs/ufs_vnops.c    Tue Dec 15 19:06:55 1992
  43. ***************
  44. *** 201,207 ****
  45.   found:
  46.           ;
  47.       }
  48. !     if ((ip->i_mode & mode) == mode)
  49.           return (0);
  50.       $eturn (EACCES);
  51.   }
  52. --- 201,207 ----
  53.   found:
  54.           ;
  55.       }
  56. !     if ((ip->i_mode & mode) != 0)
  57.           return (0);
  58.       return (EACCES);
  59.   }
  60. ---
  61. What is going on here?  I think that the version in the ".orig" file is
  62. correct, but the version in the "new" file is what's already in 386BSD-0.1,
  63. and wrong.  The patch is for access().  access() is supposed to check that
  64. all the bits (if any) are accessible (== mode) and not that at least one
  65. of the bits is accessible (!= 0).
  66.  
  67. Checking all the modes should give more security unless access() is misused
  68. (are there any correct uses for access()? :-).
  69. -- 
  70. Bruce Evans  (bde@runx.oz.au)
  71.