Xref: utzoo comp.unix.questions:9196 comp.lang.c:12572 Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!mailrus!tut.cis.ohio-state.edu!ukma!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: General Unix/C question Keywords: userid Make su segmentation core Message-ID: <744@proxftl.UUCP> Date: 13 Sep 88 01:22:15 GMT References: <641@jura.tcom.stc.co.uk> <794@philmds.UUCP> Reply-To: bill@proxftl.UUCP (T. William Wells) Organization: Proximity Technology, Ft. Lauderdale Lines: 34 Summary: Expires: Sender: Followup-To: Distribution: In article <794@philmds.UUCP> leo@philmds.UUCP (Leo de Wit) writes: : In article <641@jura.tcom.stc.co.uk> john@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