]> granicus.if.org Git - python/commitdiff
added warnings about security risk of using tmpnam and tempnam
authorSkip Montanaro <skip@pobox.com>
Sat, 18 Aug 2001 18:52:10 +0000 (18:52 +0000)
committerSkip Montanaro <skip@pobox.com>
Sat, 18 Aug 2001 18:52:10 +0000 (18:52 +0000)
Modules/posixmodule.c

index 0f4148b04105a64641416a0b10c688021d426e08..403bae14862de20143de533eced415d7fc1c5a5d 100644 (file)
@@ -4211,6 +4211,11 @@ posix_tempnam(PyObject *self, PyObject *args)
 
     if (!PyArg_ParseTuple(args, "|zz:tempnam", &dir, &pfx))
         return NULL;
+
+    if (PyErr_Warn(PyExc_RuntimeWarning,
+                 "tempnam is a potential security risk to your program") < 0)
+           return NULL;
+
 #ifdef MS_WIN32
     name = _tempnam(dir, pfx);
 #else
@@ -4258,6 +4263,11 @@ posix_tmpnam(PyObject *self, PyObject *args)
 
     if (!PyArg_ParseTuple(args, ":tmpnam"))
         return NULL;
+
+    if (PyErr_Warn(PyExc_RuntimeWarning,
+                 "tmpnam is a potential security risk to your program") < 0)
+           return NULL;
+
 #ifdef USE_TMPNAM_R
     name = tmpnam_r(buffer);
 #else