--- python-pam-0.4.2.orig/PAMmodule.c +++ python-pam-0.4.2/PAMmodule.c @@ -24,7 +24,7 @@ PyObject *userData; } PyPAMObject; -staticforward PyTypeObject PyPAMObject_Type; +static PyTypeObject PyPAMObject_Type; static void PyPAM_Err(PyPAMObject *self, int result) { @@ -80,6 +80,7 @@ resp_retcode = 0; if (!PyArg_ParseTuple(respTuple, "si", &resp_text, &resp_retcode)) { free(*resp); + *resp = NULL; Py_DECREF(respList); return PAM_CONV_ERR; } @@ -106,7 +107,7 @@ PyPAMObject *p; struct pam_conv *spc; - PyPAMObject_Type.ob_type = &PyType_Type; + Py_TYPE(&PyPAMObject_Type) = &PyType_Type; p = (PyPAMObject *) PyObject_NEW(PyPAMObject, &PyPAMObject_Type); if ((spc = (struct pam_conv *) malloc(sizeof(struct pam_conv))) == NULL) { @@ -489,35 +490,33 @@ PyObject_FREE(self); } -static PyObject * PyPAM_getattr(PyPAMObject *self, char *name) -{ - return Py_FindMethod(PyPAMObject_Methods, (PyObject *) self, name); -} - static PyObject * PyPAM_repr(PyPAMObject *self) { char buf[1024]; snprintf(buf, 1024, "", self->service, self->user, self->conv, self->pamh); - return PyString_FromString(buf); + return PyUnicode_FromString(buf); } static PyTypeObject PyPAMObject_Type = { - PyObject_HEAD_INIT(0) /* Must fill in type value later */ - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) /* Must fill in type value later */ "pam", sizeof(PyPAMObject), 0, (destructor)PyPAM_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ - (getattrfunc)PyPAM_getattr, /*tp_getattr*/ + 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ (reprfunc)PyPAM_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ + 0, /*hash*/ + 0, /*ternary*/ + 0, /*another repr*/ + (getattrofunc)PyObject_GenericGetAttr, }; static PyMethodDef PyPAM_Methods[] = { @@ -525,6 +524,16 @@ {NULL, NULL, 0, NULL} }; +#if PY_MAJOR_VERSION > 2 +static struct PyModuleDef PyPAM_Module = { + PyModuleDef_HEAD_INIT, + "PAM", /* name of module */ + NULL, /* module documentation */ + -1, /* size of per-interpreter state */ + PyPAM_Methods +}; +#endif + static char PyPAMObject_doc[] = ""; /* Convenience routine to export an integer value. @@ -534,7 +543,11 @@ */ static void insint(PyObject *d, char *name, int value) { +#if PY_MAJOR_VERSION > 2 + PyObject *v = PyLong_FromLong((long) value); +#else PyObject *v = PyInt_FromLong((long) value); +#endif if (!v || PyDict_SetItemString(d, name, v)) PyErr_Clear(); @@ -542,20 +555,32 @@ Py_XDECREF(v); } +#if PY_MAJOR_VERSION > 2 +PyMODINIT_FUNC PyInit_PAM(void) +#else void initPAM(void) +#endif { PyObject *m, *d; +#if PY_MAJOR_VERSION > 2 + m = PyModule_Create(&PyPAM_Module); +#else m = Py_InitModule("PAM", PyPAM_Methods); +#endif d = PyModule_GetDict(m); PyPAM_Error = PyErr_NewException("PAM.error", NULL, NULL); if (PyPAM_Error == NULL) - return; +#if PY_MAJOR_VERSION > 2 + return m; +#else + return; +#endif PyDict_SetItemString(d, "error", PyPAM_Error); - PyPAMObject_Type.ob_type = &PyType_Type; PyPAMObject_Type.tp_doc = PyPAMObject_doc; + PyPAMObject_Type.tp_methods = PyPAMObject_Methods, Py_INCREF(&PyPAMObject_Type); insint(d, "PAM_SUCCESS", PAM_SUCCESS); @@ -619,4 +644,7 @@ insint(d, "PAM_BINARY_PROMPT", PAM_BINARY_PROMPT); #endif +#if PY_MAJOR_VERSION > 2 + return m; +#endif } --- python-pam-0.4.2.orig/debian/README.Debian +++ python-pam-0.4.2/debian/README.Debian @@ -9,8 +9,10 @@ using PAM. No documentation yet. The module is mostly a wrapper around the PAM library -functions. There's a simple example included in /usr/doc/python-pam/examples. +functions. There's a simple example included in /usr/share/doc/python-pam/examples. 28.08.1999, Gregor Hoffleit + + -- Dima Barsky , Tue, 6 Mar 2012 22:20:11 +0000 --- python-pam-0.4.2.orig/debian/changelog +++ python-pam-0.4.2/debian/changelog @@ -1,3 +1,90 @@ +python-pam (0.4.2-13.4build3) jammy; urgency=medium + + * No-change rebuild to add python3.10. + + -- Matthias Klose Sat, 16 Oct 2021 06:58:57 +0000 + +python-pam (0.4.2-13.4build2) impish; urgency=medium + + * No-change rebuild to build packages with zstd compression. + + -- Matthias Klose Thu, 07 Oct 2021 12:23:02 +0200 + +python-pam (0.4.2-13.4build1) hirsute; urgency=medium + + * No-change rebuild to drop python3.8 extensions. + + -- Matthias Klose Mon, 07 Dec 2020 18:43:12 +0100 + +python-pam (0.4.2-13.4) unstable; urgency=medium + + * Non-maintainer upload. + * python3 port. Closes: #680148. + * Stop building the python2 package. Closes: ##937996. + * packaging using dh, dh-python, pybuild and -dbg builds. + * Bump debhelper version. Closes: #965790. + + -- Matthias Klose Mon, 02 Nov 2020 12:18:26 +0100 + +python-pam (0.4.2-13.3) unstable; urgency=medium + + * No-change rebuild to generate dependencies on python2. + Closes: #966781, #67203. + * Bump standards and debhelper versions. + + -- Matthias Klose Sat, 08 Aug 2020 22:11:37 +0200 + +python-pam (0.4.2-13.2) unstable; urgency=medium + + * Non-maintainer upload. + * Build using dh-python. Closes: #786291. + + -- Matthias Klose Tue, 18 Aug 2015 19:00:37 +0200 + +python-pam (0.4.2-13.1) unstable; urgency=low + + * Non-maintainer upload. + * debian/control: Change X-Python-Version to >= 2.6 to not explicitly + request Python 2.6. (Closes: #707531) + + -- Sebastian Ramacher Fri, 05 Jul 2013 02:38:29 +0200 + +python-pam (0.4.2-13) unstable; urgency=high + + * Acknowledged NMUs + * Fixed a security vulnerability in PyPAM_conv + (thanks Markus Vervier + for the report and the patch) + + -- Dima Barsky Tue, 06 Mar 2012 21:48:38 +0000 + +python-pam (0.4.2-12.3) unstable; urgency=low + + * Non-maintainer upload. + * Use python-support (closes: #620283). + + Add build-dependency on python-support. + + In debian/rules, replace call to dh_python with dh_pysupport. + + -- Jakub Wilk Fri, 08 Apr 2011 21:08:10 +0200 + +python-pam (0.4.2-12.2) unstable; urgency=low + + * Non-maintainer upload. + * Remove build-dependency on python2.5-dev. Closes: #596314. + + -- Matthias Klose Sun, 12 Sep 2010 15:37:47 +0200 + +python-pam (0.4.2-12.1) unstable; urgency=low + + * Non-maintainer upload. + * Prepare for the upcoming Python 2.6 transition; thanks to Piotr Ożarowski + for the bug report and to Kumar Appaiah for the patch; Closes: #556162 + - debian/rules + + optionally include python.mk, add $(py_setup_install_args) and + --prefix=/usr when installing + + -- Sandro Tosi Sun, 15 Nov 2009 21:36:54 +0100 + python-pam (0.4.2-12) unstable; urgency=low * Added Build-Depends: python2.5-dev (Closes: #415377) --- python-pam-0.4.2.orig/debian/compat +++ python-pam-0.4.2/debian/compat @@ -0,0 +1 @@ +9 --- python-pam-0.4.2.orig/debian/control +++ python-pam-0.4.2/debian/control @@ -1,18 +1,15 @@ Source: python-pam Section: python Priority: optional -Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python2.5-dev, libpam0g-dev +Build-Depends: debhelper (>= 9), python3-all-dev, libpam0g-dev, dh-python Maintainer: Dima Barsky -Standards-Version: 3.7.2 +Standards-Version: 4.5.0 -Package: python-pam +Package: python3-pam Architecture: any -Depends: ${python:Depends}, ${shlibs:Depends} -Conflicts: python2.3-pam, python2.4-pam -Replaces: python2.3-pam, python2.4-pam -Provides: ${python:Provides} -XB-Python-Version: ${python:Versions} -Description: A Python interface to the PAM library +Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends} +Suggests: python3-pam-dbg +Description: Python interface to the PAM library This module makes the PAM (Pluggable Authentication Modules) functions - available in Python. With this module you can write Python applications + available in Python 3. With this module you can write Python 3 applications that implement authentication services using PAM. --- python-pam-0.4.2.orig/debian/copyright +++ python-pam-0.4.2/debian/copyright @@ -14,4 +14,4 @@ Released under GNU GPL version 2. On Debian GNU/Linux systems, the complete text of the GNU General -Public License can be found in `/usr/share/common-licenses/GPL'. +Public License can be found in `/usr/share/common-licenses/GPL-2'. --- python-pam-0.4.2.orig/debian/python3-pam.examples +++ python-pam-0.4.2/debian/python3-pam.examples @@ -0,0 +1 @@ +examples/* --- python-pam-0.4.2.orig/debian/rules +++ python-pam-0.4.2/debian/rules @@ -1,59 +1,14 @@ #!/usr/bin/make -f -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 -# This is the debhelper compatibility version to use. -export DH_COMPAT=5 +export PYBUILD_DESTDIR_python3=debian/python3-pam/ -PYVERS=$(shell pyversions -r) python2.5 +%: + dh $@ --with python3 --buildsystem=pybuild -build: build-stamp -build-stamp: - dh_testdir - for python in $(PYVERS); \ - do $$python setup.py build; \ - done - touch build-stamp - -clean: - dh_testdir - for python in $(PYVERS); \ - do $$python setup.py clean; \ - done - rm -rf build-stamp build +override_dh_clean: + rm -rf build + rm -rf *.egg-info dh_clean -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - for python in $(PYVERS); \ - do $$python setup.py install --root=debian/python-pam; \ - done - -# Build architecture-independent files here. -binary-indep: build install - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installdocs -a -A AUTHORS README - dh_installexamples -a -A examples/* - dh_installchangelogs -a ChangeLog - dh_strip -a - dh_compress -a - dh_fixperms -a - #dh_pycentral is not needed as we don't have .py files (only a .so) - #dh_pycentral -a - dh_python -a - dh_installdeb -a - dh_shlibdeps -a - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary +override_dh_installdocs: + dh_installdocs AUTHORS README --- python-pam-0.4.2.orig/setup.py +++ python-pam-0.4.2/setup.py @@ -7,7 +7,7 @@ from distutils.extension import Extension ext = Extension( - name="PAMmodule", + name="PAM", libraries=["pam","pam_misc"], sources=["PAMmodule.c"] )