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