Updated Panjabi translation (A S Alam)
optimize order of commands in util/cracklib-format (Jan Dittberner, Debian)
fix several CC warnings (Jan Dittberner, Debian)
+ add a function GetDefaultCracklibDict() to libcrack
+ bump library revision
+ add python/setup.py.in to allow building eggs
v2.8.13 Compressed dictionary support and better python module
v2.8.11 Better create-cracklib-dict helper script (Mike Frysinger)
v2.8.10 Patch for better hanlding of cracklist dictionary paths in python binding. (Nalin Dahyabhai)
AC_SUBST(CROSS_COMPILING, $cross_compiling)
AC_OUTPUT(util/Makefile lib/Makefile doc/Makefile python/Makefile Makefile \
+ python/setup.py \
po/Makefile.in m4/Makefile dicts/Makefile cracklib.spec)
# For next ABI changing release, use 3:0:0
# After that, follow the libtool recommended incrementing procedure
#
-libcrack_la_LDFLAGS = -version-info 10:0:8
+libcrack_la_LDFLAGS = -version-info 10:1:8
# Link in NLS libs. Needed by FreeBSD build
libcrack_la_LIBADD = $(LTLIBINTL)
extern const char *FascistCheck(const char *pw, const char *dictpath);
+/* This function returns the compiled in value for DEFAULT_CRACKLIB_DICT.
+ */
+extern const char *GetDefaultCracklibDict(void);
+
#ifdef __cplusplus
};
#endif
return res;
}
+
+const char *
+GetDefaultCracklibDict()
+{
+ return DEFAULT_CRACKLIB_DICT;
+}
if BUILD_PYTHON
python_PYTHON = cracklib.py
pyexec_LTLIBRARIES = _cracklibmodule.la
+AM_CFLAGS = -I$(top_builddir)/lib
_cracklibmodule_la_LDFLAGS = -module -avoid-version $(top_builddir)/lib/libcrack.la
DEFS += '-DDEFAULT_CRACKLIB_DICT="$(DEFAULT_CRACKLIB_DICT)"'
DEFS += '-DPYTHON_H="python@PYTHON_VERSION@/Python.h"'
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <sys/types.h>
-#include <sys/stat.h>
+#ifdef PYTHON_H
#include PYTHON_H
+#else
+#include <Python.h>
+#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
-#include "../lib/crack.h"
+#include <crack.h>
#ifdef HAVE_PTHREAD_H
static pthread_mutex_t cracklib_mutex = PTHREAD_MUTEX_INITIALIZER;
static PyObject *
_cracklib_FascistCheck(PyObject *self, PyObject *args, PyObject *kwargs)
{
- int i;
- char *candidate, *dict;
+ char *candidate, *dict, *defaultdict;
const char *result;
struct stat st;
char *keywords[] = {"pw", "dictpath", NULL};
free(dictfile);
} else
{
- if (lstat(DEFAULT_CRACKLIB_DICT DICT_SUFFIX, &st) == -1)
+ defaultdict = strdup(GetDefaultCracklibDict());
+ if (errno == ENOMEM) {
+ PyErr_SetFromErrno(PyExc_OSError);
+ return NULL;
+ }
+ dictfile = malloc(strlen(defaultdict) + sizeof(DICT_SUFFIX));
+ if (dictfile == NULL)
+ {
+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, defaultdict);
+ free(defaultdict);
+ return NULL;
+ }
+ sprintf(dictfile, "%s" DICT_SUFFIX, defaultdict);
+ if (lstat(dictfile, &st) == -1)
{
- PyErr_SetFromErrnoWithFilename(PyExc_OSError,
- DEFAULT_CRACKLIB_DICT);
+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, defaultdict);
+ free(defaultdict);
+ free(dictfile);
return NULL;
}
+ free(dictfile);
}
LOCK();
- result = FascistCheck(candidate, dict ? dict : DEFAULT_CRACKLIB_DICT);
+ result = FascistCheck(candidate, dict ? dict : defaultdict);
UNLOCK();
+ if (defaultdict != NULL)
+ {
+ free(defaultdict);
+ }
+
if (result != NULL)
{
PyErr_SetString(PyExc_ValueError, result);
static PyMethodDef
_cracklibmethods[] =
{
- {"FascistCheck", _cracklib_FascistCheck, METH_VARARGS | METH_KEYWORDS,
- _cracklib_FascistCheck_doc},
+ {"FascistCheck", (PyCFunction) _cracklib_FascistCheck,
+ METH_VARARGS | METH_KEYWORDS, _cracklib_FascistCheck_doc},
{NULL, NULL},
};
--- /dev/null
+#!/usr/bin/python
+# Copyright 2009 Jan Dittberner <jan@dittberner.info>
+#
+# This file is part of cracklib.
+#
+# cracklib is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# cracklib is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Prua; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os, sys
+
+from setuptools import setup, Extension, find_packages
+
+extensions = [
+ Extension("_cracklibmodule",
+ ["_cracklibmodule.c"],
+ libraries = ["crack"]),
+]
+
+setup(
+ name="cracklib",
+ version="@VERSION@",
+ description="A CPython extension module wrapping the libcrack library",
+ author="Jan Dittberner",
+ author_email="jan@dittberner.info",
+ url="http://cracklib.sourceforge.net/",
+ license="GPLv2+",
+ py_modules=['cracklib'],
+ ext_modules=extensions,
+ zip_safe=False,
+ classifiers=[
+ "Development Status :: 4 - Beta",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: GNU General Public License (GPL)",
+ "Programming Language :: Python",
+ "Topic :: Security",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Topic :: Systems :: Systems Administration",
+ ],
+)