home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.20 / text0156.txt < prev    next >
Encoding:
Internet Message Format  |  1990-08-02  |  2.5 KB

  1. From:  guy@auspex.uucp (Guy Harris)
  2.  
  3. >The rationale, in B.4.2.2, claims that this functionality is derived from
  4. >System V
  5.  
  6. It is.
  7.  
  8. >and is designed to permit the application to toggle between the
  9. >effective ID of the process and the real ID of the process creator.
  10.  
  11. It, like the S5 functionality it is derived from, does so as long as the
  12. process isn't set-UID "root".  POSIX just inherits S5's deficiencies
  13. here.
  14.  
  15. >The conflict between 4.2.2.2 and System V setuid is that System V states
  16. >
  17. >    "If the effective user ID of the calling process is super-user,
  18. >     the real user (group) ID and effective user (group) ID are set
  19. >     to uid (gid)."
  20.  
  21. That may be what the SVID *states* (or Issue 2 states, anyway; our copy
  22. of volume 1 has disappeared), and is what the S5R3 documentation states,
  23. but it ain't what System V *does*.  What System V *does* is:
  24.  
  25. >and 4.2.2.2 states
  26. >
  27. >    "(1) If the process has appropriate privileges, the setuid()
  28. >     function sets the real user ID, effective user ID, and the
  29. >     saved set-user-ID to uid."
  30.  
  31. ...precisely that.  If you do "setuid(uid)" when the effective user ID
  32. is super-user, the saved set-user ID, as well as the real and effective
  33. UIDs, are set to "uid".
  34.  
  35. There's no conflict between what AT&T's S5 implementation does, and what
  36. POSIX specifies.  There may be a conflict between what the SVID, Issue
  37. 2, specifies, and what POSIX specifies, but that means there's a
  38. conflict between what the SVID, Issue 2, specifies and what System V
  39. does, too.  (Remember, this is UNIX; the documentation isn't the
  40. up-to-date spec for what the system does, the code is.)
  41.  
  42. In fact, the Third Edition of the SVID finally admits that; the wording
  43. is the same as POSIX.  The S5R4 documentation also admits the way S5 has
  44. worked since saved set-user IDs were first introduced.
  45.  
  46. >Contrary to the rationale, this behavior does not permit the application
  47. >to toggle between the real and saved set-user-ID unless both are not the
  48. >super-user's ID.  So, how does an application toggle between a non-super
  49. >user and a super-user?
  50.  
  51. The author of the application lobbies one or more of POSIX and AT&T/UI
  52. to specify or implement "seteuid()", a call that takes one argument and
  53. sets the effective user ID, and *ONLY* the effective user ID, to the
  54. value of that argument, even if the process has appropriate privileges. 
  55. Without a call like that - which some systems with saved set-user IDs,
  56. such as SunOS 4.x, have, and which System V Release 4 may even have, but
  57. without documentation - you're screwed. 
  58.  
  59.  
  60. Volume-Number: Volume 20, Number 154
  61.  
  62.