home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:5214 comp.mail.mh:1267
- Path: sparky!uunet!gatech!rutgers!rochester!rocksanne!leisner
- From: leisner@wrc.xerox.com ( Marty Leisner)
- Newsgroups: comp.unix.programmer,comp.mail.mh
- Subject: Re: setuid programs and calls...
- Message-ID: <1992Nov9.031112.21835@spectrum.xerox.com>
- Date: 9 Nov 92 03:11:12 GMT
- References: <1992Nov5.220832.3217@spectrum.xerox.com>
- Sender: news@spectrum.xerox.com
- Reply-To: leisner.henr801c@xerox.com
- Organization: Xerox
- Lines: 30
- X-Newsreader: TIN [version 1.1 PL6]
-
- Well, I think what I'm doing now works...
-
- #include <stdio.h>
-
- main()
- {
- int i;
-
- if(0 != setruid(220)) {
- perror("Can't set real uid");
- exit(2);
- }
-
- /* this runs setuid on the destination mailfile account UID */
- i = system("inc +zombi -file /net/zombi/files5/spool/mail/leisner -truncate");
- system("id");
- exit(i);
- }
-
- I found I have to be setuid to root and change the real ID -- just changing
- the effective UID will let me read the remote mail file, but not truncate it.
-
- I also moved libmh* into /usr/lib. After a reboot (I forgot to run ldconfig...),
- it worked fine...
-
- It seems I should cron ldconfig...
- --
- marty
- leisner.henr801c@xerox.com
- Member of the League for Programming Freedom
-