home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / programm / 5176 < prev    next >
Encoding:
Text File  |  1992-11-06  |  2.4 KB  |  74 lines

  1. Xref: sparky comp.unix.programmer:5176 comp.mail.mh:1262
  2. Newsgroups: comp.unix.programmer,comp.mail.mh
  3. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!rochester!rocksanne!leisner
  4. From: leisner@wrc.xerox.com ( Marty Leisner)
  5. Subject: setuid programs and calls...
  6. Message-ID: <1992Nov5.220832.3217@spectrum.xerox.com>
  7. Sender: news@spectrum.xerox.com
  8. Reply-To: leisner.henr801c@xerox.com
  9. Organization: Xerox
  10. X-Newsreader: TIN [version 1.1 PL6]
  11. Date: Thu, 5 Nov 1992 22:08:32 GMT
  12. Lines: 60
  13.  
  14.  
  15. I have two programs. There both setuid to root...:
  16. I'm on Sparcs on SunOS 4.1.2...
  17.  
  18. This works:
  19. cat readzombi2.c
  20. main()
  21. {
  22.         if(0 != setuid(220)) {
  23.                 perror("setuid failed: ");
  24.                 exit(1);
  25.         }
  26.         system("printenv LD_LIBRARY_PATH");
  27.         system("scan -file /net/zombi/files5/spool/mail/leisner");
  28.         system("id");
  29. }
  30.  
  31. leisner@annapurna$ ls -l readzombi2*
  32. -rwsr-xr-x   1 root     staff       24576 Nov  5 16:23 readzombi2*
  33. -rw-r--r--   1 leisner  staff         192 Nov  5 12:58 readzombi2.c
  34. leisner@annapurna$ readzombi2
  35. /usr/lib/X11:/usr/openwin/lib:/usr/marty/lib
  36.    1  10/22 Ellie Young        I'm away from the USENIX office<<I will be out of the office from October 20-
  37.    2  11/05 Marty Leisner 767  <<hi there >>
  38. uid=220(leisner2) gid=10(staff) groups=10(staff),0(wheel),2(kmem),3(bin),6(news),25(testrcs)
  39.  
  40. This doesn't:
  41. leisner@annapurna$ cat readzombimail.c; ls -l readzombimail*; readzombimail
  42. #include <stdio.h>
  43.  
  44. main()
  45. {
  46.         int i;
  47.  
  48.         if(0 != setruid(220)) {
  49.                 perror("setuid failed: ");
  50.                 exit(1);
  51.         }
  52.         system("printenv LD_LIBRARY_PATH");
  53.         i = system("scan -file /net/zombi/files5/spool/mail/leisner");
  54.         printf("i = %d\n", i);
  55.         system("id");
  56. }
  57.  
  58. -rwsr-xr-x   1 root     staff       24576 Nov  5 16:31 readzombimail*
  59. -rw-r--r--   1 leisner  staff         250 Nov  5 16:31 readzombimail.c
  60. /usr/lib/X11:/usr/openwin/lib:/usr/marty/lib
  61. ld.so: libmh.so.1: not found
  62. i = 32512
  63. uid=220(leisner2) gid=10(staff) euid=0(root) groups=10(staff),0(wheel),2(kmem),3(bin),6(news),25(testrcs),300(siena)
  64.  
  65. I don't understand why it can't find the shared library doing setruid instead of setuid (I see nothing else different
  66. (except for the i). 
  67.  
  68. What am I missing?  This doesn't make sense to me...
  69.  
  70. --
  71. marty
  72. leisner.henr801c@xerox.com  
  73. Member of the League for Programming Freedom
  74.