home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8118 < prev    next >
Encoding:
Text File  |  1992-07-23  |  939 b   |  41 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!utcsri!torn!watserv1!watmath!gamiddle
  3. From: gamiddle@math.waterloo.edu (Guy Middleton)
  4. Subject: setreuid() broken?
  5. Message-ID: <1992Jul23.224104.19277@math.waterloo.edu>
  6. Organization: University of Waterloo
  7. Date: Thu, 23 Jul 1992 22:41:04 GMT
  8. Lines: 31
  9.  
  10. Sorry if this has been mentioned here before, but I just started reading this
  11. newsgroup.  setreuid() doesn't seen to work right:
  12.  
  13. # cat foo.c
  14. #include <errno.h>
  15.  
  16. main() {
  17.     setuid(0);
  18.     seteuid(0);
  19.  
  20.     printf("%d, %d\n", getuid(), geteuid());
  21.  
  22.     if (setreuid(-1, 200))
  23.         printf("errno = %d\n", errno);
  24.  
  25.     printf("%d, %d\n", getuid(), geteuid());
  26. }
  27. #
  28. # ./a.out
  29. 0, 0
  30. errno = 1
  31. 0, 0
  32. #
  33.  
  34. This is crazy.  If my uid and euid are 0, how could I possibly get an
  35. EPERM error?
  36.  
  37. Is there any way to get this to do what I expect?
  38.  
  39.  -Guy Middleton, University of Waterloo        gamiddleton@math.waterloo.edu
  40.         (+1 519 885 1211 x3472)        gamiddleton@math.uwaterloo.ca
  41.