Re: pg_dump -Ft failed on Windows XP - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: pg_dump -Ft failed on Windows XP
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA352D0@algol.sollentuna.se
Whole thread Raw
In response to pg_dump -Ft failed on Windows XP  (Yoshiyuki Asaba <y-asaba@sraoss.co.jp>)
Responses Re: pg_dump -Ft failed on Windows XP  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> > Indeed, that's definitly a bug. Quick patch attached. It
> does appear
> > to work, but there may be a better way?
>
> This patch introduces a security hole because an attacker
> could create, say, a suitable symlink between the time the
> name is generated and the file is opened.

Good point. I guess what I need to do is use open() specifying O_CREATE,
and then fdopen() that file.

Question: Is the use of O_TEMPORARY to open() portable? (my win32 docs
say it will make the file automatically deleted when the last descriptor
is closed, which I didn't know before. That would make the patch much
simpler, but might require #ifdefs?)

//Magnus


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Unresolved Win32 bug reports
Next
From: Martijn van Oosterhout
Date:
Subject: Checking assumptions