From 7464aacd1a020cb48cc01cc8198a7fd6b6ed5db1 Mon Sep 17 00:00:00 2001 From: Miroslav Suchý Date: Feb 23 2011 10:38:04 +0000 Subject: 679714 - deallocate the conversation response only in case of error --- diff --git a/PyPAM-0.5.0-nofree.patch b/PyPAM-0.5.0-nofree.patch new file mode 100644 index 0000000..7fdf110 --- /dev/null +++ b/PyPAM-0.5.0-nofree.patch @@ -0,0 +1,58 @@ +diff -up PyPAM-0.5.0/PAMmodule.c.nofree PyPAM-0.5.0/PAMmodule.c +--- PyPAM-0.5.0/PAMmodule.c.nofree 2011-01-18 21:24:59.000000000 +0100 ++++ PyPAM-0.5.0/PAMmodule.c 2011-02-22 23:31:19.000000000 +0100 +@@ -24,8 +24,6 @@ typedef struct { + char *service; + char *user; + PyObject *callback; +- struct pam_response *response_data; +- int response_len; + PyObject *user_data; + void *dlh1, *dlh2; + } PyPAMObject; +@@ -54,15 +52,6 @@ static int PyPAM_conv(int num_msg, const + + Py_INCREF(self); + +- if (NULL != self->response_data) { +- for (int i = 0; i < self->response_len; i++) { +- free(self->response_data[0].resp); +- } +- free(self->response_data); +- self->response_data = NULL; +- self->response_len = 0; +- } +- + PyObject* msgList = PyList_New(num_msg); + + for (int i = 0; i < num_msg; i++) { +@@ -92,6 +81,10 @@ static int PyPAM_conv(int num_msg, const + char* resp_text; + int resp_retcode = 0; + if (!PyArg_ParseTuple(respTuple, "si", &resp_text, &resp_retcode)) { ++ while (i > 0) { ++ free((--spr)->resp); ++ --i; ++ } + free(*resp); + Py_DECREF(respList); + return PAM_CONV_ERR; +@@ -101,10 +94,6 @@ static int PyPAM_conv(int num_msg, const + Py_DECREF(respTuple); + } + +- // Save this so we can free it later. +- self->response_data = *resp; +- self->response_len = PyList_Size(respList); +- + Py_DECREF(respList); + + return PAM_SUCCESS; +@@ -144,8 +133,6 @@ static PyObject * PyPAM_pam(PyObject *se + p->user = NULL; + Py_INCREF(Py_None); + p->callback = Py_None; +- p->response_data = NULL; +- p->response_len = 0; + Py_INCREF(Py_None); + p->user_data = Py_None; diff --git a/PyPAM.spec b/PyPAM.spec index 5664b57..a6bebb4 100644 --- a/PyPAM.spec +++ b/PyPAM.spec @@ -6,11 +6,12 @@ Summary: PAM bindings for Python Name: PyPAM Version: 0.5.0 -Release: 10%{?dist} +Release: 11%{?dist} Source0: http://www.pangalactic.org/PyPAM/%{name}-%{version}.tar.gz Url: http://www.pangalactic.org/PyPAM Patch0: PyPAM-dlopen.patch Patch1: PyPAM-0.5.0-dealloc.patch +Patch2: PyPAM-0.5.0-nofree.patch License: LGPLv2 Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -26,6 +27,7 @@ PAM (Pluggable Authentication Module) bindings for Python. %setup -q %patch0 -p1 -b .dlopen %patch1 -p1 -b .dealloc +%patch2 -p1 -b .nofree # remove prebuild rpm and others binaries rm -rf build dist @@ -50,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT %doc examples %changelog +* Wed Feb 23 2011 Miroslav Suchý 0.5.0-10 +- 679714 - deallocate the conversation response only in case of error + * Mon Feb 07 2011 Fedora Release Engineering - 0.5.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild