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

  1. From:  jfh@rpp386.cactus.org (John F. Haugh II)
  2.  
  3. Peter Jeffe has managed to convince me that there is something flawed in
  4. my reading of 4.2.2, and the associated pieces of 1003.1 related to the
  5. feature test macro _POSIX_SAVED_IDS.
  6.  
  7. The rationale, in B.4.2.2, claims that this functionality is derived from
  8. System V 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. The conflict between 4.2.2.2 and System V setuid is that System V states
  12.  
  13.     "If the effective user ID of the calling process is super-user,
  14.      the real user (group) ID and effective user (group) ID are set
  15.      to uid (gid)."
  16.  
  17. and 4.2.2.2 states
  18.  
  19.     "(1) If the process has appropriate privileges, the setuid()
  20.      function sets the real user ID, effective user ID, and the
  21.      saved set-user-ID to uid."
  22.  
  23. The first problem is that a program which is set-user-ID to an ID other
  24. than super-user will behave quite differently when executed by root.  The
  25. first execution of "setuid (real_uid)" will change the effective user ID
  26. to a process which "has appropriate privileges" so that the second
  27. execution of "setuid (effective_uid)" will permanently change the process
  28. back to "effective_uid".  The second problem relates to processes which
  29. are set-user-ID to super-user.  The first execution of "setuid (real_uid)"
  30. is going to permanently change the IDs so that the process can never
  31. switch back to the original saved set-user-ID.
  32.  
  33. Contrary to the rationale, this behavior does not permit the application
  34. to toggle between the real and saved set-user-ID unless both are not the
  35. super-user's ID.  So, how does an application toggle between a non-super
  36. user and a super-user?
  37. -- 
  38. John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
  39. Ma Bell: (512) 832-8832                           Domain: jfh@rpp386.cactus.org
  40.  
  41. Volume-Number: Volume 20, Number 148
  42.  
  43.