- fix check for the existence of dictionaries when the caller specifies a

location (#224347, upstream #1644628)
This commit is contained in:
Nalin Dahyabhai 2007-01-25 17:33:12 +00:00
parent 956f7cc827
commit b64d92cc00
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,45 @@
--- cracklib-2.8.9/python/cracklibmodule.c 2007-01-25 12:16:30.000000000 -0500
+++ cracklib-2.8.9/python/cracklibmodule.c 2007-01-25 12:16:32.000000000 -0500
@@ -19,6 +19,8 @@
#define UNLOCK()
#endif
+#define DICT_SUFFIX ".pwd"
+
static PyObject *
cracklib_FascistCheck(PyObject *self, PyObject *args, PyObject *kwargs)
{
@@ -27,6 +29,7 @@
const char *result;
struct stat st;
char *keywords[] = {"pw", "dictpath", NULL};
+ char *dictfile;
self = NULL;
candidate = NULL;
@@ -52,14 +55,23 @@
"second argument was not an absolute path!");
return NULL;
}
- if (lstat(dict, &st) == -1)
+ dictfile = malloc(strlen(dict) + sizeof(DICT_SUFFIX));
+ if (dictfile == NULL)
+ {
+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, dict);
+ return NULL;
+ }
+ sprintf(dictfile, "%s" DICT_SUFFIX, dict);
+ if (lstat(dictfile, &st) == -1)
{
PyErr_SetFromErrnoWithFilename(PyExc_OSError, dict);
+ free(dictfile);
return NULL;
}
+ free(dictfile);
} else
{
- if (lstat(DEFAULT_CRACKLIB_DICT ".pwd", &st) == -1)
+ if (lstat(DEFAULT_CRACKLIB_DICT DICT_SUFFIX, &st) == -1)
{
PyErr_SetFromErrnoWithFilename(PyExc_OSError,
DEFAULT_CRACKLIB_DICT);

View File

@ -4,7 +4,7 @@
Summary: A password-checking library.
Name: cracklib
Version: 2.8.9
Release: 6
Release: 7
Group: System Environment/Libraries
Source0: http://prdownloads.sourceforge.net/cracklib/cracklib-%{version}.tar.gz
Source1: http://prdownloads.sourceforge.net/cracklib/cracklib-words.gz
@ -36,6 +36,7 @@ Source33: ftp://ftp.cerias.purdue.edu/pub/dict/wordlists/names/names.french.gz
Source34: ftp://ftp.cerias.purdue.edu/pub/dict/wordlists/names/names.hp.gz
Source35: ftp://ftp.cerias.purdue.edu/pub/dict/wordlists/names/other-names.gz
Source36: ftp://ftp.cerias.purdue.edu/pub/dict/wordlists/names/surnames.finnish.gz
Patch0: cracklib-2.8.9-suffix.patch
URL: http://sourceforge.net/projects/cracklib/
License: Artistic
Buildroot: %{_tmppath}/%{name}-%{version}-root
@ -93,6 +94,7 @@ If you are installing CrackLib, you should also install cracklib-dicts.
%prep
%setup -q
%patch0 -p1 -b .suffix
autoreconf
mkdir cracklib-dicts
for dict in %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} \
@ -172,6 +174,10 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libcrack.la
%{_libdir}/python*/site-packages/cracklibmodule.so
%changelog
* Thu Jan 25 2007 Nalin Dahyabhai <nalin@redhat.com> - 2.8.9-7
- fix check for the existence of dictionaries when the caller specifies a
location (#224347, upstream #1644628)
* Thu Dec 7 2006 Jeremy Katz <katzj@redhat.com> - 2.8.9-6
- rebuild against python 2.5