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

  1. Xref: sparky comp.unix.programmer:5214 comp.mail.mh:1267
  2. Path: sparky!uunet!gatech!rutgers!rochester!rocksanne!leisner
  3. From: leisner@wrc.xerox.com ( Marty Leisner)
  4. Newsgroups: comp.unix.programmer,comp.mail.mh
  5. Subject: Re: setuid programs and calls...
  6. Message-ID: <1992Nov9.031112.21835@spectrum.xerox.com>
  7. Date: 9 Nov 92 03:11:12 GMT
  8. References: <1992Nov5.220832.3217@spectrum.xerox.com>
  9. Sender: news@spectrum.xerox.com
  10. Reply-To: leisner.henr801c@xerox.com
  11. Organization: Xerox
  12. Lines: 30
  13. X-Newsreader: TIN [version 1.1 PL6]
  14.  
  15. Well, I think what I'm doing now works...
  16.  
  17.     #include <stdio.h>
  18.  
  19.     main()
  20.     {
  21.         int i;
  22.  
  23.         if(0 != setruid(220)) {
  24.             perror("Can't set real uid");
  25.             exit(2);
  26.         }
  27.  
  28.         /* this runs setuid on the destination mailfile account UID */
  29.         i = system("inc +zombi -file /net/zombi/files5/spool/mail/leisner -truncate");
  30.         system("id");
  31.         exit(i);
  32.     }
  33.  
  34. I found I have to be setuid to root and change the real ID -- just changing
  35. the effective UID will let me read the remote mail file, but not truncate it.
  36.  
  37. I also moved libmh* into /usr/lib.  After a reboot (I forgot to run ldconfig...),
  38. it worked fine...
  39.  
  40. It seems I should cron ldconfig...
  41.     --
  42.     marty
  43.     leisner.henr801c@xerox.com  
  44.     Member of the League for Programming Freedom
  45.