Univention Bugzilla – Attachment 10241 Details for
Bug 50575
Python3: we need python3-smbpasswd
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
50575.patch (text/plain), 10.17 KB, created by
Florian Best
on 2019-11-29 15:08 CET
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2019-11-29 15:08 CET
Size:
10.17 KB
patch
obsolete
>From 5c880e9a45eddadb8d6b38bbb18197c9722476c3 Mon Sep 17 00:00:00 2001 >From: Florian Best <best@univention.de> >Date: Fri, 29 Nov 2019 14:50:58 +0100 >Subject: [PATCH 1/4] remove trailing whitespace > >Signed-off-by: Florian Best <best@univention.de> >--- > setup.py | 25 +++++++++++-------------- > smbpasswd.c | 58 +++++++++++++++++++++++++++++----------------------------- > 2 files changed, 40 insertions(+), 43 deletions(-) > >diff --git setup.py setup.py >index 98a873c..5ce09f7 100755 >--- setup.py >+++ setup.py >@@ -7,20 +7,17 @@ > # > # 2002-10-27 Barry Pederson <bp@barryp.org> > >-import sys > from distutils.core import setup, Extension > >-setup(name = "smbpasswd", >- description = "SMB Password Hash Generator - suitable for use with Samba", >- version = "1.0.1", >- license = "GPL", >- author = "Barry Pederson", >- author_email = "bp@barryp.org", >- url = "http://barryp.org/software/py-smbpasswd", >- ext_modules = >- [ >+setup( >+ name="smbpasswd", >+ description="SMB Password Hash Generator - suitable for use with Samba", >+ version="1.0.1", >+ license="GPL", >+ author="Barry Pederson", >+ author_email="bp@barryp.org", >+ url="http://barryp.org/software/py-smbpasswd", >+ ext_modules=[ > Extension("smbpasswd", ['md4.c', 'smbdes.c', 'smbpasswd.c']) >- ] >- ) >- >-##### That's all folks ########### >+ ] >+) >diff --git smbpasswd.c smbpasswd.c >index d237021..0f625c9 100755 >--- smbpasswd.c >+++ smbpasswd.c >@@ -1,6 +1,6 @@ > /* > Python Samba Password Hash Generating module >- >+ > Copyright (C) 2002 Barry Pederson <bp@barryp.org> > > This program is free software; you can redistribute it and/or modify >@@ -23,8 +23,8 @@ > > */ > >- >-#include "Python.h" >+ >+#include "Python.h" > #include <memory.h> > #include <ctype.h> > >@@ -56,25 +56,25 @@ Functions:\n\ > static char HEXCHARS[] = "0123456789ABCDEF"; > > static PyObject * >-hash_to_string(char *tmp) >+hash_to_string(char *tmp) > { > int i; > unsigned char c; > char outbuffer[32]; > > /* build string from binary hash */ >- for(i = 0; i < 16; i++) >+ for(i = 0; i < 16; i++) > { > c=tmp[i]; > outbuffer[ i*2 ] = HEXCHARS[(c>>4) & 0x0f]; > outbuffer[(i*2)+1] = HEXCHARS[ c & 0x0f]; > } >- >+ > return PyString_FromStringAndSize(outbuffer, 32); > } > > >-static PyObject * >+static PyObject * > lmhash(PyObject *self, PyObject *args) > { > char *pwd; >@@ -88,69 +88,69 @@ lmhash(PyObject *self, PyObject *args) > if (!(PyArg_ParseTuple(args, "s#", &pwd, &pwd_len))) > return NULL; > >- /* make a copy that's truncated to 14 chars and uppercased */ >- if (pwd_len > LMPASSWDLEN) >+ /* make a copy that's truncated to 14 chars and uppercased */ >+ if (pwd_len > LMPASSWDLEN) > pwd_len = LMPASSWDLEN; > memset(lmpwd, '\0', sizeof(lmpwd)); > for (i = 0; i < pwd_len; i++) >- lmpwd[i]=toupper(pwd[i]); >+ lmpwd[i]=toupper(pwd[i]); > > /* Generate the hash */ > memset(hashout,'\0',sizeof(hashout)); >- E_P16(lmpwd, hashout); >- >- /* clean things up - don't know how much good it does since >- Python presumably has other copies of the password floating >+ E_P16(lmpwd, hashout); >+ >+ /* clean things up - don't know how much good it does since >+ Python presumably has other copies of the password floating > around, but what the hell - I'll do my part since I know it's > safe. > */ > memset(lmpwd, '\0', sizeof(lmpwd)); >- >+ > return hash_to_string(hashout); > } > > >-static PyObject * >+static PyObject * > nthash(PyObject *self, PyObject *args) > { > char *pwd; > int pwd_len; > char hashout[17]; >- >- pwd = NULL; >+ >+ pwd = NULL; > if (!(PyArg_ParseTuple(args, "es#", "utf-16le", &pwd, &pwd_len))) > return NULL; > > memset(hashout,'\0',sizeof(hashout)); >- mdfour(hashout, pwd, pwd_len); >- >- /* clean things up - don't know how much good it does since >- Python presumably has other copies of the password floating >+ mdfour(hashout, pwd, pwd_len); >+ >+ /* clean things up - don't know how much good it does since >+ Python presumably has other copies of the password floating > around, but what the hell - I'll do my part since I'm pretty > sure it's safe, from my understanding of PyArg_ParseTuple and "es#" > */ > memset(pwd, '\0', pwd_len); > PyMem_Free(pwd); >- >+ > return hash_to_string(hashout); > } > > >-static PyObject * >+static PyObject * > hash(PyObject *self, PyObject *args) > { > PyObject *result; >- >+ > result = PyTuple_New(2); > PyTuple_SetItem(result, 0, lmhash(self, args)); > PyTuple_SetItem(result, 1, nthash(self, args)); >- >- return result; >+ >+ return result; > } > > > /* List of functions exported by this module */ >-static PyMethodDef smbpasswd_functions[] = >+static PyMethodDef smbpasswd_functions[] = > { > {"lmhash", lmhash, METH_VARARGS}, > {"nthash", nthash, METH_VARARGS}, >@@ -160,7 +160,7 @@ static PyMethodDef smbpasswd_functions[] = > > > /* Initialize this module. */ >-void >+void > initsmbpasswd(void) > { > Py_InitModule3("smbpasswd", smbpasswd_functions, module_doc); >-- >2.11.0 > > >From 2a6ce47e2b4f5e8acf3e5ba57cba2faa078aa14d Mon Sep 17 00:00:00 2001 >From: Florian Best <best@univention.de> >Date: Fri, 29 Nov 2019 14:51:39 +0100 >Subject: [PATCH 2/4] Migrate to Python 3 compatibility > >Signed-off-by: Florian Best <best@univention.de> >--- > smbpasswd.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > >diff --git smbpasswd.c smbpasswd.c >index 0f625c9..bb7cfe9 100755 >--- smbpasswd.c >+++ smbpasswd.c >@@ -29,6 +29,9 @@ > #include <ctype.h> > > #define LMPASSWDLEN 14 >+#if PY_MAJOR_VERSION >= 3 >+ #define PyString_FromStringAndSize PyUnicode_FromStringAndSize >+#endif > > /* from md4.c and smbdes.c */ > void mdfour(unsigned char *out, unsigned char *in, int n); >@@ -160,10 +163,36 @@ static PyMethodDef smbpasswd_functions[] = > > > /* Initialize this module. */ >-void >+ >+#if PY_MAJOR_VERSION >= 3 >+ static struct PyModuleDef moduledef = { >+ PyModuleDef_HEAD_INIT, >+ "smbpasswd", /* m_name */ >+ module_doc, /* m_doc */ >+ -1, /* m_size */ >+ smbpasswd_functions, /* m_methods */ >+ NULL, /* m_reload */ >+ NULL, /* m_traverse */ >+ NULL, /* m_clear */ >+ NULL, /* m_free */ >+ }; >+#endif >+ >+ >+ >+PyMODINIT_FUNC >+ >+#if PY_MAJOR_VERSION >= 3 >+PyInit_smbpasswd(void) >+#else > initsmbpasswd(void) >+#endif > { >+#if PY_MAJOR_VERSION >= 3 >+ PyModule_Create(&moduledef); >+#else > Py_InitModule3("smbpasswd", smbpasswd_functions, module_doc); >+#endif > } > > /****** EOF *********/ >-- >2.11.0 > > >From a68e6ee989367013535389449fa13f990a728c73 Mon Sep 17 00:00:00 2001 >From: Florian Best <best@univention.de> >Date: Fri, 29 Nov 2019 14:54:04 +0100 >Subject: [PATCH 3/4] Add python3-smbpasswd package > >Signed-off-by: Florian Best <best@univention.de> >--- > debian/compat | 2 +- > debian/control | 15 ++++++++++++--- > debian/pycompat | 1 - > debian/python-smbpasswd.install | 1 + > debian/python3-smbpasswd.install | 1 + > 5 files changed, 15 insertions(+), 5 deletions(-) > delete mode 100644 debian/pycompat > create mode 100644 debian/python-smbpasswd.install > create mode 100644 debian/python3-smbpasswd.install > >diff --git debian/compat debian/compat >index 7ed6ff8..ec63514 100644 >--- debian/compat >+++ debian/compat >@@ -1 +1 @@ >-5 >+9 >diff --git debian/control debian/control >index 951b429..cc20dcd 100644 >--- debian/control >+++ debian/control >@@ -2,8 +2,8 @@ Source: python-smbpasswd > Section: python > Priority: optional > Maintainer: Bjorn Ove Grotan <bgrotan@grotan.com> >-Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), >- cdbs (>= 0.4.5), dh-python >+Build-Depends: debhelper, python-all-dev (>= 2.3.5-11), >+ cdbs (>= 0.4.5), dh-python, python3-all-dev > Standards-Version: 3.7.2 > > Package: python-smbpasswd >@@ -11,7 +11,16 @@ Architecture: any > Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends} > Provides: ${python:Provides} > Suggests: luma >-XB-Python-Version: ${python:Versions} >+Description: This module can generate both LANMAN and NT password hashes >+ smbpasswd was written to generate password hashes suitable for use with samba, >+ and possibly other places which uses LANMAN and/or NT hashes - such as >+ samba with ldap-backend, or even as hash in some radius implementations. >+ >+Package: python3-smbpasswd >+Architecture: any >+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends} >+Provides: ${python3:Provides} >+Suggests: luma > Description: This module can generate both LANMAN and NT password hashes > smbpasswd was written to generate password hashes suitable for use with samba, > and possibly other places which uses LANMAN and/or NT hashes - such as >diff --git debian/pycompat debian/pycompat >deleted file mode 100644 >index 0cfbf08..0000000 >--- debian/pycompat >+++ /dev/null >@@ -1 +0,0 @@ >-2 >diff --git debian/python-smbpasswd.install debian/python-smbpasswd.install >new file mode 100644 >index 0000000..40e809f >--- /dev/null >+++ debian/python-smbpasswd.install >@@ -0,0 +1 @@ >+usr/lib/python2.7/dist-packages >diff --git debian/python3-smbpasswd.install debian/python3-smbpasswd.install >new file mode 100644 >index 0000000..0017270 >--- /dev/null >+++ debian/python3-smbpasswd.install >@@ -0,0 +1 @@ >+usr/lib/python3/dist-packages >-- >2.11.0 > > >From ca8ebb776dad82cdffa4e19dff71a5ca9ec77be5 Mon Sep 17 00:00:00 2001 >From: Florian Best <best@univention.de> >Date: Fri, 29 Nov 2019 14:57:07 +0100 >Subject: [PATCH 4/4] debian/changelog > >Signed-off-by: Florian Best <best@univention.de> >--- > debian/changelog | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git debian/changelog debian/changelog >index 423fa93..b6ec453 100644 >--- debian/changelog >+++ debian/changelog >@@ -1,3 +1,10 @@ >+python-smbpasswd (1.0.2-1) unstable; urgency=medium >+ >+ * Non-maintainer upload. >+ * Build python3 package >+ >+ -- Florian Best <best@univention.de> Fri, 29 Nov 2019 14:56:20 +0100 >+ > python-smbpasswd (1.0.1-1.3) unstable; urgency=medium > > * Non-maintainer upload. >-- >2.11.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 50575
: 10241