-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christian Smith wrote:
> On Fri, 14 Jan 2005, John Richard Moser wrote:
>
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>
>>
>>D. Richard Hipp wrote:
>>
>>
>>>I don't *think* this is a problem. But version 3.1 will contain
>>>extra security features just to make sure. In particular, it will
>>>initialize the random number generated used to create temp file
>>>names from /dev/urandom if available.
>>
>>If you want to create temporary file names, use mkstemp(3) to create and
>>open a file, then close it and open it with sqlite3_open().
>
>
> $ man mkstemp
> ...
> BUGS
> ...
> Don't use this function, use tmpfile(3) instead. It's bet�
> ter defined and more portable.
>
Mine doesn't say that.
CONFORMING TO
BSD 4.3, POSIX 1003.1-2001
I use mkstemp because it said to in my mktemp(3) manual page:
BUGS
Never use mktemp(). Some implementations follow BSD 4.3 and
replace XXXXXX by the current
process id and a single letter, so that at most 26
different names can be returned.
Since on the one hand the names are easy to guess, and on the
other hand there is a race
between testing whether the name exists and opening the file,
every use of mktemp() is a
security risk. The race is avoided by mkstemp(3).
I'll check the SUS. . .
http://www.opengroup.org/onlinepubs/009695399/functions/tmpfile.html
tmpfile(void) apparently creates the temporary file "somewhere," without
defining where.
http://www.opengroup.org/onlinepubs/009695399/functions/mkstemp.html
mkstemp(char *template) creates it somewhere based on a specified path.
The Linux manual pages define mkstemp(3) a bit better, which is why I
prefer it:
http://www.die.net/doc/linux/man/man3/mkstemp.3.html
On Linux, tmpfile(3) is defined poorly; but it adds that the macro,
P_tmpdir, will be used as the path to the file:
http://www.die.net/doc/linux/man/man3/tmpfile.3.html
It's up to you. You're more experienced than me :)
>
> So long as the file name is unique, I don't think it really matters how it
> was generated, so long as it is valid and opened securely.
>
>
> For non-temporary files (the sort passed into sqlite3_open()) you don't
> want a temporary file name. sqlite3_open is used internally to open
> temporary files.
>
> If YOU are creating a temporary database, simply use a memory database by
> passing ":memory:" as the file name to sqlite3_open.
>
ooh, nice trick :D
> Christian
>
- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB6CnRhDd4aOud5P8RAg0JAKCM38MmHizb8j9FmMpcvcovMNARBACbBL1c
mo36Uj80ZUm8Ti0PB/bsdK8=
=teFN
-----END PGP SIGNATURE-----