[Pkg-cracklib-commits] r60 - in cracklib2/trunk/debian: . patches

jandd-guest at alioth.debian.org jandd-guest at alioth.debian.org
Wed Sep 24 20:49:03 UTC 2008


Author: jandd-guest
Date: 2008-09-24 20:49:01 +0000 (Wed, 24 Sep 2008)
New Revision: 60

Removed:
   cracklib2/trunk/debian/patches/04-improved-python-binding.patch
Modified:
   cracklib2/trunk/debian/changelog
   cracklib2/trunk/debian/patches/02-ccwarnings.patch
   cracklib2/trunk/debian/patches/series
   cracklib2/trunk/debian/rules
Log:
update to new upstream release

Modified: cracklib2/trunk/debian/changelog
===================================================================
--- cracklib2/trunk/debian/changelog	2008-09-15 21:43:53 UTC (rev 59)
+++ cracklib2/trunk/debian/changelog	2008-09-24 20:49:01 UTC (rev 60)
@@ -1,3 +1,13 @@
+cracklib2 (2.8.13-1) UNRELEASED; urgency=low
+
+  * new upstream release
+  * removed debian/patches/04-improved-python-binding.patch, it has been
+    included upstream
+  * refreshed debian/patchs/02-ccwarnings.patch
+  * change debian/rules to use lib in top_builddir
+
+ -- Jan Dittberner <jan at dittberner.info>  Wed, 24 Sep 2008 21:28:23 +0200
+
 cracklib2 (2.8.12-8) unstable; urgency=low
 
   * provide a python-crack wrapper to mimic the behavior of the python-

Modified: cracklib2/trunk/debian/patches/02-ccwarnings.patch
===================================================================
--- cracklib2/trunk/debian/patches/02-ccwarnings.patch	2008-09-15 21:43:53 UTC (rev 59)
+++ cracklib2/trunk/debian/patches/02-ccwarnings.patch	2008-09-24 20:49:01 UTC (rev 60)
@@ -1,6 +1,6 @@
 --- a/lib/packlib.c
 +++ b/lib/packlib.c
-@@ -12,7 +12,7 @@
+@@ -15,7 +15,7 @@
  #endif
  #include "packer.h"
  

Deleted: cracklib2/trunk/debian/patches/04-improved-python-binding.patch
===================================================================
--- cracklib2/trunk/debian/patches/04-improved-python-binding.patch	2008-09-15 21:43:53 UTC (rev 59)
+++ cracklib2/trunk/debian/patches/04-improved-python-binding.patch	2008-09-24 20:49:01 UTC (rev 60)
@@ -1,478 +0,0 @@
---- a/python/Makefile.am
-+++ b/python/Makefile.am
-@@ -1,6 +1,7 @@
- if BUILD_PYTHON
--pyexec_LTLIBRARIES = cracklibmodule.la
--cracklibmodule_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/lib -lcrack
-+python_PYTHON = cracklib.py
-+pyexec_LTLIBRARIES = _cracklibmodule.la
-+_cracklibmodule_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/lib -lcrack
- DEFS += '-DDEFAULT_CRACKLIB_DICT="$(DEFAULT_CRACKLIB_DICT)"'
- DEFS += '-DPYTHON_H="python at PYTHON_VERSION@/Python.h"'
- endif
---- /dev/null
-+++ b/python/_cracklibmodule.c
-@@ -0,0 +1,149 @@
-+/*
-+ * A Python binding for cracklib.
-+ *
-+ * Parts of this code are based on work Copyright (c) 2003 by Domenico
-+ * Andreoli.
-+ *
-+ * Copyright (c) 2008 Jan Dittberner <jan at 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
-+ */
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include PYTHON_H
-+#ifdef HAVE_PTHREAD_H
-+#include <pthread.h>
-+#endif
-+#include "../lib/crack.h"
-+
-+#ifdef HAVE_PTHREAD_H
-+static pthread_mutex_t cracklib_mutex = PTHREAD_MUTEX_INITIALIZER;
-+#define LOCK() pthread_mutex_lock(&cracklib_mutex)
-+#define UNLOCK() pthread_mutex_unlock(&cracklib_mutex)
-+#else
-+#define LOCK()
-+#define UNLOCK()
-+#endif
-+
-+#define DICT_SUFFIX ".pwd"
-+
-+static char _cracklib_FascistCheck_doc [] =
-+	"arguments: passwd, dictpath (optional)\n"
-+	"\n"
-+	"  passwd - password to be checked for weakness\n"
-+	"  dictpath - full path name to the cracklib dictionary database\n"
-+	"\n"
-+	"if dictpath is not specified the default dictionary database\n"
-+	"will be used.\n"
-+	"\n"
-+	"return value: the same password passed as first argument.\n"
-+	"\n"
-+	"if password is weak, exception ValueError is raised with argument\n"
-+	"set to the reason of weakness.\n"
-+;
-+
-+static PyObject *
-+_cracklib_FascistCheck(PyObject *self, PyObject *args, PyObject *kwargs)
-+{
-+    int i;
-+    char *candidate, *dict;
-+    const char *result;
-+    struct stat st;
-+    char *keywords[] = {"pw", "dictpath", NULL};
-+    char *dictfile;
-+
-+    self = NULL;
-+    candidate = NULL;
-+    dict = NULL;
-+
-+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|s", keywords,
-+                                     &candidate, &dict))
-+    {
-+        PyErr_SetString(PyExc_ValueError, "error parsing arguments");
-+        return NULL;
-+    }
-+
-+    if (candidate == NULL)
-+    {
-+        PyErr_SetString(PyExc_ValueError, "first argument was not a string!");
-+        return NULL;
-+    }
-+    if (dict != NULL)
-+    {
-+        if (dict[0] != '/')
-+        {
-+            PyErr_SetString(PyExc_ValueError,
-+                            "second argument was not an absolute path!");
-+            return NULL;
-+        }
-+        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 DICT_SUFFIX, &st) == -1)
-+        {
-+            PyErr_SetFromErrnoWithFilename(PyExc_OSError,
-+                                           DEFAULT_CRACKLIB_DICT);
-+            return NULL;
-+        }
-+    }
-+
-+    LOCK();
-+    result = FascistCheck(candidate, dict ? dict : DEFAULT_CRACKLIB_DICT);
-+    UNLOCK();
-+
-+    if (result != NULL)
-+    {
-+    	PyErr_SetString(PyExc_ValueError, result);
-+        return NULL;
-+    }
-+    return Py_BuildValue("s", candidate);
-+}
-+
-+static PyMethodDef
-+_cracklibmethods[] =
-+{
-+    {"FascistCheck", _cracklib_FascistCheck, METH_VARARGS | METH_KEYWORDS,
-+     _cracklib_FascistCheck_doc},
-+    {NULL, NULL},
-+};
-+
-+static char _cracklib_doc[] =
-+    "Python bindings for cracklib.\n"
-+    "\n"
-+    "This module enables the use of cracklib features from within a Python\n"
-+    "program or interpreter.\n"
-+;
-+
-+void
-+init_cracklib(void)
-+{
-+    Py_InitModule3("_cracklib", _cracklibmethods, _cracklib_doc);
-+}
---- a/python/cracklibmodule.c
-+++ /dev/null
-@@ -1,107 +0,0 @@
--/*
-- *  A Python binding for cracklib.
-- */
--
--#include <sys/types.h>
--#include <sys/stat.h>
--#include PYTHON_H
--#ifdef HAVE_PTHREAD_H
--#include <pthread.h>
--#endif
--#include "../lib/crack.h"
--
--#ifdef HAVE_PTHREAD_H
--static pthread_mutex_t cracklib_mutex = PTHREAD_MUTEX_INITIALIZER;
--#define LOCK() pthread_mutex_lock(&cracklib_mutex)
--#define UNLOCK() pthread_mutex_unlock(&cracklib_mutex)
--#else
--#define LOCK()
--#define UNLOCK()
--#endif
--
--#define DICT_SUFFIX ".pwd"
--
--static PyObject *
--cracklib_FascistCheck(PyObject *self, PyObject *args, PyObject *kwargs)
--{
--    int i;
--    char *candidate, *dict;
--    const char *result;
--    struct stat st;
--    char *keywords[] = {"pw", "dictpath", NULL};
--    char *dictfile;
--
--    self = NULL;
--    candidate = NULL;
--    dict = NULL;
--
--    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|s", keywords,
--                                     &candidate, &dict))
--    {
--        PyErr_SetString(PyExc_ValueError, "error parsing arguments");
--        return NULL;
--    }
--
--    if (candidate == NULL)
--    {
--        PyErr_SetString(PyExc_ValueError, "first argument was not a string!");
--        return NULL;
--    }
--    if (dict != NULL)
--    {
--        if (dict[0] != '/')
--        {
--            PyErr_SetString(PyExc_ValueError,
--                            "second argument was not an absolute path!");
--            return NULL;
--        }
--        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 DICT_SUFFIX, &st) == -1)
--        {
--            PyErr_SetFromErrnoWithFilename(PyExc_OSError,
--                                           DEFAULT_CRACKLIB_DICT);
--            return NULL;
--        }
--    }
--
--    LOCK();
--    result = FascistCheck(candidate, dict ? dict : DEFAULT_CRACKLIB_DICT);
--    UNLOCK();
--
--    if (result != NULL)
--    {
--        return PyString_FromString(result);
--    } else
--    {
--        Py_INCREF(Py_None);
--        return Py_None;
--    }
--}
--
--static PyMethodDef
--cracklibmethods[] =
--{
--    {"FascistCheck", cracklib_FascistCheck, METH_VARARGS | METH_KEYWORDS},
--    {NULL, NULL},
--};
--
--void
--initcracklib(void)
--{
--    Py_InitModule("cracklib", cracklibmethods);
--}
---- /dev/null
-+++ b/python/cracklib.py
-@@ -0,0 +1,201 @@
-+#
-+# A Python binding for cracklib.
-+#
-+# Parts of this code are based on work Copyright (c) 2003 by Domenico
-+# Andreoli.
-+#
-+# Copyright (c) 2008 Jan Dittberner <jan at 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 string
-+from _cracklib import FascistCheck
-+
-+ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-+ascii_lowercase = "abcdefghijklmnopqrstuvwxyz"
-+
-+diff_ok = 5
-+min_length = 9
-+dig_credit = 1
-+up_credit = 1
-+low_credit = 1
-+oth_credit = 1
-+
-+
-+def palindrome(s):
-+    for i in range(len(s)):
-+        if s[i] != s[-i - 1]:
-+            return 0
-+    return 1
-+
-+
-+def distdifferent(old, new, i, j):
-+    """Calculate how different two strings are in terms of the number
-+    of character removals, additions, and changes needed to go from one
-+    to the other."""
-+    if i == 0 or len(old) <= i:
-+        c = 0
-+    else:
-+        c = old[i - 1]
-+
-+    if j == 0 or len(new) <= i:
-+        d = 0
-+    else:
-+        d = new[j - 1]
-+
-+    return c != d
-+
-+
-+def distcalculate(distances, old, new, i, j):
-+    tmp = 0
-+
-+    if distances[i][j] != -1:
-+        return distances[i][j]
-+
-+    tmp =          distcalculate(distances, old, new, i - 1, j - 1)
-+    tmp = min(tmp, distcalculate(distances, old, new, i    , j - 1))
-+    tmp = min(tmp, distcalculate(distances, old, new, i - 1, j    ))
-+    tmp = tmp + distdifferent(old, new, i, j)
-+
-+    distances[i][j] = tmp
-+
-+    return tmp
-+
-+
-+def distance(old, new):
-+    m = len(old)
-+    n = len(new)
-+
-+    distances = [ [] for i in range(m + 1) ]
-+    for i in range(m + 1):
-+        distances[i] = [ -1 for j in range(n + 1) ]
-+
-+    for i in range(m + 1):
-+        distances[i][0] = i
-+    for j in range(n + 1):
-+        distances[0][j] = j
-+    distances[0][0] = 0
-+
-+    r = distcalculate(distances, old, new, m, n)
-+
-+    for i in range(len(distances)):
-+        for j in range(len(distances[i])):
-+            distances[i][j] = 0
-+
-+    return r
-+
-+
-+def similar(old, new):
-+    if distance(old, new) >= diff_ok:
-+        return 0
-+
-+    if len(new) >= (len(old) * 2):
-+        return 0
-+
-+    # passwords are too similar
-+    return 1
-+
-+
-+def simple(new):
-+    digits = 0
-+    uppers = 0
-+    lowers = 0
-+    others = 0
-+
-+    for c in new:
-+        if c in string.digits:
-+            digits = digits + 1
-+        elif c in ascii_uppercase:
-+            uppers = uppers + 1
-+        elif c in ascii_lowercase:
-+            lowers = lowers + 1
-+        else:
-+            others = others + 1
-+
-+    # The scam was this - a password of only one character type
-+    # must be 8 letters long.  Two types, 7, and so on.
-+    # This is now changed, the base size and the credits or defaults
-+    # see the docs on the module for info on these parameters, the
-+    # defaults cause the effect to be the same as before the change
-+
-+    if dig_credit >= 0 and digits > dig_credit:
-+        digits = dig_credit
-+
-+    if up_credit >= 0 and uppers > up_credit:
-+        uppers = up_credit
-+
-+    if low_credit >= 0 and lowers > low_credit:
-+        lowers = low_credit
-+
-+    if oth_credit >= 0 and others > oth_credit:
-+        others = oth_credit
-+
-+    size = min_length
-+
-+    if dig_credit >= 0:
-+        size = size - digits
-+    elif digits < (dig_credit * -1):
-+        return 1
-+
-+    if up_credit >= 0:
-+        size = size - uppers
-+    elif uppers < (up_credit * -1):
-+        return 1
-+
-+    if low_credit >= 0:
-+        size = size - lowers
-+    elif lowers < (low_credit * -1):
-+        return 1
-+
-+    if oth_credit >= 0:
-+        size = size - others
-+    elif others < (oth_credit * -1):
-+        return 1
-+
-+    if len(new) < size:
-+        return 1
-+
-+    return 0
-+
-+
-+def VeryFascistCheck(new, old = None, dictpath = None):
-+    if old != None:
-+        if new == old:
-+            raise ValueError, "is the same as the old one"
-+
-+        oldmono = old.lower()
-+        newmono = new.lower()
-+        wrapped = old + old
-+
-+        if newmono == oldmono:
-+            raise ValueError, "case changes only"
-+        if wrapped.find(new) != -1:
-+            raise ValueError, "is rotated"
-+        if similar(oldmono, newmono):
-+            raise ValueError, "is too similar to the old one"
-+
-+    if dictpath == None:
-+        FascistCheck(new)
-+    else:
-+        FascistCheck(new, dictpath)
-+
-+    if palindrome(new):
-+        raise ValueError, "is a palindrome"
-+    if simple(new):
-+        raise ValueError, "is too simple"
-+
-+    return new

Modified: cracklib2/trunk/debian/patches/series
===================================================================
--- cracklib2/trunk/debian/patches/series	2008-09-15 21:43:53 UTC (rev 59)
+++ cracklib2/trunk/debian/patches/series	2008-09-24 20:49:01 UTC (rev 60)
@@ -1,4 +1,3 @@
 01-cracklib-format-optim.patch
 02-ccwarnings.patch
 03-packer-dont-print-skipping-line.patch
-04-improved-python-binding.patch

Modified: cracklib2/trunk/debian/rules
===================================================================
--- cracklib2/trunk/debian/rules	2008-09-15 21:43:53 UTC (rev 59)
+++ cracklib2/trunk/debian/rules	2008-09-24 20:49:01 UTC (rev 60)
@@ -31,7 +31,7 @@
 build-stamp: configure-stamp
 	$(MAKE) -C debian/tmpbuild
 	for i in $(PYVERS); do \
-		${MAKE} -C debian/build$$i/python LDFLAGS=-L`pwd`/debian/tmpbuild/lib/.libs; \
+		${MAKE} -C debian/build$$i/python top_builddir=`pwd`/debian/tmpbuild; \
 	done
 	xmlto -o debian/doc xhtml-nochunks debian/libcrack2.xml
 	xmlto -o debian/doc xhtml-nochunks debian/cracklib-runtime.xml




More information about the Pkg-cracklib-commits mailing list