Re: Re: [COMMITTERS] pgsql/src/bin/initdb initdb.sh - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Re: [COMMITTERS] pgsql/src/bin/initdb initdb.sh
Date
Msg-id 200106251901.f5PJ1Q717376@candle.pha.pa.us
Whole thread Raw
In response to Re: [COMMITTERS] pgsql/src/bin/initdb initdb.sh  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> Bruce Momjian writes:
> 
> > > To securely create a temp file in shell you need to use mktemp(1), or do
> > > something like (umask 077 && mkdir $TMPDIR/$$) to create a subdirectory.
> > > Needless to say, it's tricky.
> >
> > Wow, that symlink is a bad one.  I don't see mktemp(1) on bsd/os, only
> > mktemp(3).  I do see it on FreeBSD.
> >
> > Good thing I don't have other shell users on my system.  I do cat
> > >/tmp/$$ all the time in scripts.
> 
> I see we have temp file vulnerabilities in genbki.sh and Gen_fmgrtab.sh as
> well.  I'll try to fix them.

What is the vulnerability?  I see:
- if [ "$TMPDIR" ]; then-     TEMPFILE="$TMPDIR/initdb.$$"- else-     TEMPFILE="/tmp/initdb.$$"- fi


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Mark Volpe
Date:
Subject: Re: [PATCH] Re: Setuid functions
Next
From: "John Gray"
Date:
Subject: Multi-entry indexes (with a view to XPath queries)