Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site baylor.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!ut-sally!ut-ngp!shell!neuro1!baylor!peter From: peter@baylor.UUCP (Peter da Silva) Newsgroups: net.lang.c Subject: Re: Re: The same PID? Message-ID: <574@baylor.UUCP> Date: Thu, 29-Aug-85 14:30:26 EDT Article-I.D.: baylor.574 Posted: Thu Aug 29 14:30:26 1985 Date-Received: Tue, 10-Sep-85 03:44:50 EDT References: <867@brl-tgr.ARPA> <1567@utah-gr.UUCP> Organization: The Power Elite, Houston, TX Lines: 25 > >> (what happens when you get the same pid > >> as someone else did earlier?). > > This can happen very easily: Process X does a mktemp (or tmpnam), then > execs another program that also wants to mktemp (or tmpnam). It's still > got the same PID! Yes, but at this point the first program isn't there, and had better have cleaned up its temp files first. Someone mentioned a security problem, using a scenario like this: cracker observes root preparing to edit /etc/passwd cracker creates a bunch of files in /tmp with the same name and so on as the editor, pids increasing fron current pid to some large number. editor creates temp files & cracker has read/write access to same. This is about the only situation I can see where mktemp does anything worthwhile that sprintf("/tmp/foo%dx%d", getpid(), i++) doesn't. Of course in a case like this vipw should really create a nameless file. -- Peter (Made in Australia) da Silva UUCP: ...!shell!neuro1!{hyd-ptd,baylor,datafac}!peter MCI: PDASILVA; CIS: 70216,1076