Merge lp:~vorlon/ubuntu/quantal/python-pam/python3 into lp:ubuntu/quantal/python-pam

Proposed by Steve Langasek
Status: Needs review
Proposed branch: lp:~vorlon/ubuntu/quantal/python-pam/python3
Merge into: lp:ubuntu/quantal/python-pam
Diff against target: 333 lines (+107/-78)
11 files modified
PAMmodule.c (+24/-12)
debian/changelog (+14/-0)
debian/compat (+1/-0)
debian/control (+28/-4)
debian/python-pam-dbg.install (+1/-0)
debian/python-pam.examples (+1/-0)
debian/python-pam.install (+2/-0)
debian/python3-pam-dbg.install (+1/-0)
debian/python3-pam.examples (+1/-0)
debian/python3-pam.install (+2/-0)
debian/rules (+32/-62)
To merge this branch: bzr merge lp:~vorlon/ubuntu/quantal/python-pam/python3
Reviewer Review Type Date Requested Status
Barry Warsaw (community) Approve
Review via email: mp+107314@code.launchpad.net

Description of the change

python-pam is not maintained upstream or in Debian, so I guess it's up to
us to fix this one.

To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote :

Steve, this looks good. My only minor thought is the API change in the repr() to always be unicode. I.e. this is a change for the Python 2 version, but since it's just a repr it doesn't bother me. I like Saphhira's additional patch, though with a few changes.

I'll mark this approved, merge yours and Sapphira's into trunk and upload.

Thanks both of you for the patch!

Revision history for this message
Barry Warsaw (barry) :
review: Approve

Unmerged revisions

20. By Steve Langasek

Modernize packaging to dh and debhelper 9.

19. By Steve Langasek

use PyModule_Create instead of Py_InitModule for python3

18. By Steve Langasek

use PyLong_FromLong when building for python3.

17. By Steve Langasek

use PyUnicode_FromString, not PyString_FromString

16. By Steve Langasek

* Port to python3; dead project upstream so not forwarding anywhere.
  - replace 'staticforward' with 'static'.
  - replace ob_type with Py_TYPE(ob).
  - drop tp_getattr function, we just need to set tp_methods instead.
  - fix PyTypeObject definition.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'PAMmodule.c'
--- PAMmodule.c 2012-03-08 08:06:43 +0000
+++ PAMmodule.c 2012-05-25 03:33:19 +0000
@@ -24,7 +24,7 @@
24 PyObject *userData;24 PyObject *userData;
25} PyPAMObject;25} PyPAMObject;
2626
27staticforward PyTypeObject PyPAMObject_Type;27static PyTypeObject PyPAMObject_Type;
2828
29static void PyPAM_Err(PyPAMObject *self, int result)29static void PyPAM_Err(PyPAMObject *self, int result)
30{30{
@@ -107,7 +107,7 @@
107 PyPAMObject *p;107 PyPAMObject *p;
108 struct pam_conv *spc;108 struct pam_conv *spc;
109109
110 PyPAMObject_Type.ob_type = &PyType_Type;110 Py_TYPE(&PyPAMObject_Type) = &PyType_Type;
111 p = (PyPAMObject *) PyObject_NEW(PyPAMObject, &PyPAMObject_Type);111 p = (PyPAMObject *) PyObject_NEW(PyPAMObject, &PyPAMObject_Type);
112112
113 if ((spc = (struct pam_conv *) malloc(sizeof(struct pam_conv))) == NULL) {113 if ((spc = (struct pam_conv *) malloc(sizeof(struct pam_conv))) == NULL) {
@@ -490,29 +490,23 @@
490 PyObject_FREE(self);490 PyObject_FREE(self);
491}491}
492492
493static PyObject * PyPAM_getattr(PyPAMObject *self, char *name)
494{
495 return Py_FindMethod(PyPAMObject_Methods, (PyObject *) self, name);
496}
497
498static PyObject * PyPAM_repr(PyPAMObject *self)493static PyObject * PyPAM_repr(PyPAMObject *self)
499{494{
500 char buf[1024];495 char buf[1024];
501 496
502 snprintf(buf, 1024, "<pam object, service=\"%s\", user=\"%s\", conv=%p, pamh=%p>",497 snprintf(buf, 1024, "<pam object, service=\"%s\", user=\"%s\", conv=%p, pamh=%p>",
503 self->service, self->user, self->conv, self->pamh);498 self->service, self->user, self->conv, self->pamh);
504 return PyString_FromString(buf);499 return PyUnicode_FromString(buf);
505}500}
506501
507static PyTypeObject PyPAMObject_Type = {502static PyTypeObject PyPAMObject_Type = {
508 PyObject_HEAD_INIT(0) /* Must fill in type value later */503 PyVarObject_HEAD_INIT(&PyType_Type, 0) /* Must fill in type value later */
509 0,
510 "pam",504 "pam",
511 sizeof(PyPAMObject),505 sizeof(PyPAMObject),
512 0,506 0,
513 (destructor)PyPAM_dealloc, /*tp_dealloc*/507 (destructor)PyPAM_dealloc, /*tp_dealloc*/
514 0, /*tp_print*/508 0, /*tp_print*/
515 (getattrfunc)PyPAM_getattr, /*tp_getattr*/509 0, /*tp_getattr*/
516 0, /*tp_setattr*/510 0, /*tp_setattr*/
517 0, /*tp_compare*/511 0, /*tp_compare*/
518 (reprfunc)PyPAM_repr, /*tp_repr*/512 (reprfunc)PyPAM_repr, /*tp_repr*/
@@ -526,6 +520,16 @@
526 {NULL, NULL, 0, NULL}520 {NULL, NULL, 0, NULL}
527};521};
528522
523#if PY_MAJOR_VERSION > 2
524static struct PyModuleDef PyPAM_Module = {
525 PyModuleDef_HEAD_INIT,
526 "PAM", /* name of module */
527 NULL, /* module documentation */
528 -1, /* size of per-interpreter state */
529 PyPAM_Methods
530};
531#endif
532
529static char PyPAMObject_doc[] = "";533static char PyPAMObject_doc[] = "";
530534
531/* Convenience routine to export an integer value.535/* Convenience routine to export an integer value.
@@ -535,7 +539,11 @@
535 */539 */
536static void insint(PyObject *d, char *name, int value)540static void insint(PyObject *d, char *name, int value)
537{541{
542#if PY_MAJOR_VERSION > 2
543 PyObject *v = PyLong_FromLong((long) value);
544#else
538 PyObject *v = PyInt_FromLong((long) value);545 PyObject *v = PyInt_FromLong((long) value);
546#endif
539547
540 if (!v || PyDict_SetItemString(d, name, v))548 if (!v || PyDict_SetItemString(d, name, v))
541 PyErr_Clear();549 PyErr_Clear();
@@ -547,7 +555,11 @@
547{555{
548 PyObject *m, *d;556 PyObject *m, *d;
549557
558#if PY_MAJOR_VERSION > 2
559 m = PyModule_Create(&PyPAM_Module);
560#else
550 m = Py_InitModule("PAM", PyPAM_Methods);561 m = Py_InitModule("PAM", PyPAM_Methods);
562#endif
551 d = PyModule_GetDict(m);563 d = PyModule_GetDict(m);
552 564
553 PyPAM_Error = PyErr_NewException("PAM.error", NULL, NULL);565 PyPAM_Error = PyErr_NewException("PAM.error", NULL, NULL);
@@ -555,8 +567,8 @@
555 return;567 return;
556 PyDict_SetItemString(d, "error", PyPAM_Error);568 PyDict_SetItemString(d, "error", PyPAM_Error);
557569
558 PyPAMObject_Type.ob_type = &PyType_Type;
559 PyPAMObject_Type.tp_doc = PyPAMObject_doc;570 PyPAMObject_Type.tp_doc = PyPAMObject_doc;
571 PyPAMObject_Type.tp_methods = PyPAMObject_Methods,
560 Py_INCREF(&PyPAMObject_Type);572 Py_INCREF(&PyPAMObject_Type);
561573
562 insint(d, "PAM_SUCCESS", PAM_SUCCESS);574 insint(d, "PAM_SUCCESS", PAM_SUCCESS);
563575
=== modified file 'debian/changelog'
--- debian/changelog 2012-03-08 08:06:43 +0000
+++ debian/changelog 2012-05-25 03:33:19 +0000
@@ -1,3 +1,17 @@
1python-pam (0.4.2-12.2ubuntu5) UNRELEASED; urgency=low
2
3 * Port to python3; dead project upstream so not forwarding anywhere.
4 - replace 'staticforward' with 'static'.
5 - replace ob_type with Py_TYPE(ob).
6 - drop tp_getattr function, we just need to set tp_methods instead.
7 - fix PyTypeObject definition.
8 - use PyUnicode_FromString, not PyString_FromString
9 - use PyLong_FromLong when building for python3.
10 - use PyModule_Create instead of Py_InitModule for python3
11 * Modernize packaging to dh and debhelper 9.
12
13 -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 24 May 2012 22:56:26 +0000
14
1python-pam (0.4.2-12.2ubuntu4) precise; urgency=low15python-pam (0.4.2-12.2ubuntu4) precise; urgency=low
216
3 * SECURITY UPDATE: possible code execution via double-free (LP: #949218)17 * SECURITY UPDATE: possible code execution via double-free (LP: #949218)
418
=== added file 'debian/compat'
--- debian/compat 1970-01-01 00:00:00 +0000
+++ debian/compat 2012-05-25 03:33:19 +0000
@@ -0,0 +1,1 @@
19
02
=== modified file 'debian/control'
--- debian/control 2012-03-08 08:06:43 +0000
+++ debian/control 2012-05-25 03:33:19 +0000
@@ -1,14 +1,16 @@
1Source: python-pam1Source: python-pam
2Section: python2Section: python
3Priority: optional3Priority: optional
4Build-Depends: debhelper (>= 5.0.37.2), python-all-dev (>= 2.3.5-11), python-all-dbg, libpam0g-dev4Build-Depends: debhelper (>= 9), python-all-dev (>= 2.3.5-11), python-all-dbg, python3-all-dev, python3-all-dbg, libpam0g-dev
5Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>5Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
6XSBC-Original-Maintainer: Dima Barsky <dima@debian.org>6XSBC-Original-Maintainer: Dima Barsky <dima@debian.org>
7Standards-Version: 3.7.27X-Python-Version: >= 2.6
8X-Python3-Version: >= 3.2
9Standards-Version: 3.9.3
810
9Package: python-pam11Package: python-pam
10Architecture: any12Architecture: any
11Depends: ${python:Depends}, ${shlibs:Depends}13Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}
12Conflicts: python2.3-pam, python2.4-pam14Conflicts: python2.3-pam, python2.4-pam
13Replaces: python2.3-pam, python2.4-pam15Replaces: python2.3-pam, python2.4-pam
14Provides: ${python:Provides}16Provides: ${python:Provides}
@@ -22,10 +24,32 @@
22Package: python-pam-dbg24Package: python-pam-dbg
23Priority: extra25Priority: extra
24Architecture: any26Architecture: any
25Depends: python-pam (= ${Source-Version}), python-dbg27Depends: python-pam (= ${binary:Version}), python-dbg, ${shlibs:Depends}, ${misc:Depends}
26Description: A Python interface to the PAM library (debug extension)28Description: A Python interface to the PAM library (debug extension)
27 This module makes the PAM (Pluggable Authentication Modules) functions29 This module makes the PAM (Pluggable Authentication Modules) functions
28 available in Python. With this module you can write Python applications30 available in Python. With this module you can write Python applications
29 that implement authentication services using PAM.31 that implement authentication services using PAM.
30 .32 .
31 This package contains the extension built for the python debug interpreter.33 This package contains the extension built for the python debug interpreter.
34
35Package: python3-pam
36Architecture: any
37Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
38Provides: ${python3:Provides}
39Suggests: python3-pam-dbg
40XB-Python-Version: ${python3:Versions}
41Description: A Python interface to the PAM library
42 This module makes the PAM (Pluggable Authentication Modules) functions
43 available in Python 3. With this module you can write Python 3 applications
44 that implement authentication services using PAM.
45
46Package: python3-pam-dbg
47Priority: extra
48Architecture: any
49Depends: python3-pam (= ${binary:Version}), python3-dbg, ${shlibs:Depends}, ${misc:Depends}
50Description: A Python interface to the PAM library (debug extension)
51 This module makes the PAM (Pluggable Authentication Modules) functions
52 available in Python 3. With this module you can write Python 3 applications
53 that implement authentication services using PAM.
54 .
55 This package contains the extension built for the python debug interpreter.
3256
=== added file 'debian/python-pam-dbg.install'
--- debian/python-pam-dbg.install 1970-01-01 00:00:00 +0000
+++ debian/python-pam-dbg.install 2012-05-25 03:33:19 +0000
@@ -0,0 +1,1 @@
1usr/lib/python2*/dist-packages/*_d.so
02
=== added file 'debian/python-pam.examples'
--- debian/python-pam.examples 1970-01-01 00:00:00 +0000
+++ debian/python-pam.examples 2012-05-25 03:33:19 +0000
@@ -0,0 +1,1 @@
1examples/*
02
=== added file 'debian/python-pam.install'
--- debian/python-pam.install 1970-01-01 00:00:00 +0000
+++ debian/python-pam.install 2012-05-25 03:33:19 +0000
@@ -0,0 +1,2 @@
1usr/lib/python2*/dist-packages/*[!_][!_].so
2usr/lib/python2*/dist-packages/*.egg-info
03
=== added file 'debian/python3-pam-dbg.install'
--- debian/python3-pam-dbg.install 1970-01-01 00:00:00 +0000
+++ debian/python3-pam-dbg.install 2012-05-25 03:33:19 +0000
@@ -0,0 +1,1 @@
1usr/lib/python3/dist-packages/*-[0-9][0-9]d*.so
02
=== added file 'debian/python3-pam.examples'
--- debian/python3-pam.examples 1970-01-01 00:00:00 +0000
+++ debian/python3-pam.examples 2012-05-25 03:33:19 +0000
@@ -0,0 +1,1 @@
1examples/*
02
=== added file 'debian/python3-pam.install'
--- debian/python3-pam.install 1970-01-01 00:00:00 +0000
+++ debian/python3-pam.install 2012-05-25 03:33:19 +0000
@@ -0,0 +1,2 @@
1usr/lib/python3/dist-packages/*-[0-9][0-9][!d]*.so
2usr/lib/python3/dist-packages/*.egg-info
03
=== modified file 'debian/rules'
--- debian/rules 2010-11-24 16:06:15 +0000
+++ debian/rules 2012-05-25 03:33:19 +0000
@@ -2,67 +2,37 @@
2# Uncomment this to turn on verbose mode.2# Uncomment this to turn on verbose mode.
3#export DH_VERBOSE=13#export DH_VERBOSE=1
44
5# This is the debhelper compatibility version to use.5PYTHON2=$(shell pyversions -vr)
6export DH_COMPAT=56PYTHON3=$(shell py3versions -vr)
77
8PYVERS=$(shell pyversions -r)8%:
99 dh $@ --with python2,python3
10-include /usr/share/python/python.mk10
1111build-python%:
12build: build-stamp12 python$* setup.py build
13build-stamp:13 python$*-dbg setup.py build
14 dh_testdir14
15 set -e; \15override_dh_auto_build: $(PYTHON3:%=build-python%)
16 for python in $(PYVERS); do \16 dh_auto_build
17 $$python setup.py build; \17
18 $$python-dbg setup.py build; \18install-python%:
19 done19 python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
20 touch build-stamp20 python$*-dbg setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
2121
22clean:22override_dh_auto_install: $(PYTHON3:%=install-python%)
23 dh_testdir23 dh_auto_install
24 set -e; \24
25 for python in $(PYVERS); do \25override_dh_auto_clean:
26 $$python setup.py clean; \26 dh_auto_clean
27 $$python-dbg setup.py clean; \27 rm -rf build
28 done28 rm -rf *.egg-info
29 rm -rf build-stamp build29
30 dh_clean30override_dh_installdocs:
3131 dh_installdocs AUTHORS README
32install: build32
33 dh_testdir33override_dh_installchangelogs:
34 dh_testroot34 dh_installchangelogs ChangeLog
35 dh_clean -k
36 dh_installdirs
37
38 set -e; \
39 for python in $(PYVERS); do \
40 $$python setup.py install --root=debian/python-pam --install-layout=deb; \
41 $$python-dbg setup.py install --root=debian/python-pam-dbg --install-layout=deb; \
42 done
43 find debian/python-pam-dbg ! -type d ! -name '*_d.so' | xargs rm -f
44
45# Build architecture-independent files here.
46binary-indep: build install
47
48# Build architecture-dependent files here.
49binary-arch: build install
50 dh_testdir
51 dh_testroot
52 dh_installdocs -a AUTHORS README
53 dh_installexamples -a examples/*
54 dh_installchangelogs -a ChangeLog
55 rm -rf debian/python-pam-dbg/usr/share/doc/python-pam-dbg35 rm -rf debian/python-pam-dbg/usr/share/doc/python-pam-dbg
56 ln -sf python-pam debian/python-pam-dbg/usr/share/doc/python-pam-dbg36 ln -sf python-pam debian/python-pam-dbg/usr/share/doc/python-pam-dbg
57 dh_strip -a -Npython-pam-dbg --dbg-package=python-pam-dbg37 rm -rf debian/python3-pam-dbg/usr/share/doc/python3-pam-dbg
58 dh_compress -a38 ln -sf python3-pam debian/python3-pam-dbg/usr/share/doc/python3-pam-dbg
59 dh_fixperms -a
60 dh_python2 -a
61 dh_installdeb -a
62 dh_shlibdeps -a
63 dh_gencontrol -a
64 dh_md5sums -a
65 dh_builddeb -a
66
67binary: binary-indep binary-arch
68.PHONY: build clean binary-indep binary-arch binary

Subscribers

People subscribed via source and target branches