temp file name

Artur M. Piwko pipene-news at pu.kielce.pl
Tue Dec 21 22:13:08 CET 2004

In the darkest hour on Fri, 17 Dec 2004 17:21:53 +0530,
km <km at mrna.tn.nic.in> screamed:
> Is there a way to  create  a unique file name; safely
> i have used os.tmpnam() with python2.4, i warns that the usage is a potential security risk.

Security risk comes from posix tmpnam itself.
>From tmpnam manual:

       The precise meaning of `appropriate' is undefined;  it  is  unspecified
       how  accessibility  of a directory is determined.  Never use this func-
       tion. Use mkstemp(3) instead.

Use tempfile.mkstemp() instead.

[ Artur M. Piwko : Pipen : AMP29-RIPE : RLU:100918 : From == Trap! : SIG:214B ]
[ 22:11:02 user up 10467 days, 10:06,  1 user, load average: 0.06, 0.06, 0.06 ]

                          Another megabytes the dust.

More information about the Python-list mailing list