General Unix/C question

T. William Wells bill at proxftl.UUCP
Tue Sep 13 11:22:15 AEST 1988


In article <794 at philmds.UUCP> leo at philmds.UUCP (Leo de Wit) writes:
: In article <641 at jura.tcom.stc.co.uk> john at tcom.stc.co.uk (John Blair) writes:
: |
: |Below is the program I use to run a unix command under the userid of the
: |program owner.
: |However when the command passed is Make with parameters and
: |stdout and stderr file redirection I sometimes get segmentation
: |problems and core dumped.
: |
: |If I "su" as the userid of the program owner
: |and execute the same Make command I do not get segmentation problems.
: |What is wrong with the C program?
: |
: |/* note, this must run with set uid on execution */
: |main(argc,argv)
: | int argc;
: | char * argv[];
: |{
: | setuid(geteuid());
: | setgid(getegid());
: | execvp(argv[1],argv+1);
: |}

:             2) when you start the program the input/output redirection is
: done, perhaps by your shell. This means that these input/output streams
: must be readable/writable by the current uid/gid;

I don't think this is correct.  When a file is opened, you are
given certain access permissions.  These permissions do not
change, even if your uid/gid changes.

---
Bill
novavax!proxftl!bill



More information about the Comp.unix.questions mailing list