Nalin Dahyabhai c814b8
Tiny problems in errors reported: when we're out of memory, report out of
Nalin Dahyabhai c814b8
memory unrelated to the filename.  When we notice that the dictionary isn't
Nalin Dahyabhai c814b8
there, give the name of the file which wasn't there.
Nalin Dahyabhai 5e736e
  python -c 'import cracklib;cracklib.FascistCheck("canihas","/tmp/notthere")'
Nalin Dahyabhai c814b8
diff -up cracklib-2.8.10/python/cracklibmodule.c cracklib-2.8.10/python/cracklibmodule.c
Nalin Dahyabhai c814b8
--- cracklib-2.8.10/python/cracklibmodule.c	2007-01-26 11:55:07.000000000 -0500
Nalin Dahyabhai c814b8
+++ cracklib-2.8.10/python/cracklibmodule.c	2007-07-19 09:55:22.000000000 -0400
Nalin Dahyabhai c814b8
@@ -58,13 +58,13 @@ cracklib_FascistCheck(PyObject *self, Py
Nalin Dahyabhai c814b8
         dictfile = malloc(strlen(dict) + sizeof(DICT_SUFFIX));
Nalin Dahyabhai c814b8
         if (dictfile == NULL)
Nalin Dahyabhai c814b8
         {
Nalin Dahyabhai c814b8
-            PyErr_SetFromErrnoWithFilename(PyExc_OSError, dict);
Nalin Dahyabhai c814b8
+            PyErr_SetFromErrno(PyExc_MemoryError);
Nalin Dahyabhai c814b8
             return NULL;
Nalin Dahyabhai c814b8
         }
Nalin Dahyabhai c814b8
         sprintf(dictfile, "%s" DICT_SUFFIX, dict);
Nalin Dahyabhai c814b8
         if (lstat(dictfile, &st) == -1)
Nalin Dahyabhai c814b8
         {
Nalin Dahyabhai c814b8
-            PyErr_SetFromErrnoWithFilename(PyExc_OSError, dict);
Nalin Dahyabhai c814b8
+            PyErr_SetFromErrnoWithFilename(PyExc_OSError, dictfile);
Nalin Dahyabhai c814b8
             free(dictfile);
Nalin Dahyabhai c814b8
             return NULL;
Nalin Dahyabhai c814b8
         }
Nalin Dahyabhai c814b8
@@ -74,7 +74,7 @@ cracklib_FascistCheck(PyObject *self, Py
Nalin Dahyabhai c814b8
         if (lstat(DEFAULT_CRACKLIB_DICT DICT_SUFFIX, &st) == -1)
Nalin Dahyabhai c814b8
         {
Nalin Dahyabhai c814b8
             PyErr_SetFromErrnoWithFilename(PyExc_OSError,
Nalin Dahyabhai c814b8
-                                           DEFAULT_CRACKLIB_DICT);
Nalin Dahyabhai c814b8
+                                           DEFAULT_CRACKLIB_DICT DICT_SUFFIX);
Nalin Dahyabhai c814b8
             return NULL;
Nalin Dahyabhai c814b8
         }
Nalin Dahyabhai c814b8
     }