home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8284 < prev    next >
Encoding:
Text File  |  1992-07-28  |  2.3 KB  |  70 lines

  1. Path: sparky!uunet!cs.utexas.edu!ut-emx!ibmchs!auschs!awdprime.austin.ibm.com!levell.austin.ibm.com!julie
  2. From: julie@levell.austin.ibm.com (Julie L. Craft)
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: setreuid() broken?
  5. Message-ID: <1992Jul28.154814.28686@awdprime.austin.ibm.com>
  6. Date: 28 Jul 92 15:48:14 GMT
  7. References: <1992Jul23.224104.19277@math.waterloo.edu>
  8. Sender: news@awdprime.austin.ibm.com (USENET News)
  9. Organization: IBM, Austin
  10. Lines: 58
  11.  
  12. In article <1992Jul23.224104.19277@math.waterloo.edu> gamiddle@math.waterloo.edu (Guy Middleton) writes:
  13. >Sorry if this has been mentioned here before, but I just started reading this
  14. >newsgroup.  setreuid() doesn't seen to work right:
  15. >
  16. ># cat foo.c
  17. >#include <errno.h>
  18. >main() {
  19. >    setuid(0);
  20. >    seteuid(0);
  21. >    printf("%d, %d\n", getuid(), geteuid());
  22. >    if (setreuid(-1, 200))
  23. >        printf("errno = %d\n", errno);
  24. >    printf("%d, %d\n", getuid(), geteuid());
  25. >}
  26. ># ./a.out
  27. >0, 0
  28. >errno = 1
  29. >0, 0
  30. >#
  31. >This is crazy.  If my uid and euid are 0, how could I possibly get an
  32. >EPERM error?
  33. >Is there any way to get this to do what I expect?
  34. > -Guy Middleton, University of Waterloo    gamiddleton@math.waterloo.edu
  35. >        (+1 519 885 1211 x3472)        gamiddleton@math.uwaterloo.ca
  36.  
  37. AIX doesn't allow you to change the EFFECTIVE unless it is equal
  38. to the REAL or SAVED.
  39.  
  40.   setreuid      There are two cases:
  41.  
  42.   RUID != EUID  If EUID specifies either the process' real or saved
  43.   user IDs, the process' effective user ID is set to EUID.  Other-
  44.   wise, EPERM is returned.
  45.     ^^^^^
  46.  
  47.   RUID= = EUID  If the invoker is the root user, the process' real,
  48.   effective, and saved user IDs are set to EUID.  Otherwise, EPERM
  49.   is returned.
  50.  
  51.   The real and effective user ID parameters can have a value of -1.
  52.   If the value is -1, the actual value for that UID is set to the
  53.   corresponding current UID of the process.
  54.  
  55. If you want to toggle your EFFECTIVE between your REAL and SAVED 
  56. you can use a suid program and then use seteuid().
  57.  
  58. Of course, this might not be what you want.  Let me know if
  59. if you had something specific in mind.  This has been a sticky
  60. issue lately.
  61.  
  62. later,
  63. Julie
  64.  
  65. -- 
  66. *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
  67. Julie Levell Craft IBM AUSTIN,TX  Internet: julie@aixwiz.austin.ibm.com
  68. IBMNET: JULIEL at AUSVM6 2F-007/903  (512) 838-2677 (Tie 678-2677)
  69. "I'm not getting defensive!"
  70.