File PyPAM-0.5.0-setitem.patch of Package python-pam

--- PAMmodule.c
+++ PAMmodule.c
@@ -344,17 +344,21 @@
 static PyObject * PyPAM_set_item(PyObject *self, PyObject *args)
 {
     int                 result, item;
-    char                *s_val, *n_val;
+    char                *s_val;
     PyObject            *o_val;
     PyPAMObject         *_self = (PyPAMObject *) self;
     
     if (PyArg_ParseTuple(args, "is", &item, &s_val)) {
-        n_val = strdup(s_val);
         if (item == PAM_USER)
-            _self->user = n_val;
+            _self->user = strdup(s_val);
         if (item == PAM_SERVICE)
-            _self->service = n_val;
-        result = pam_set_item(_self->pamh, item, (void *) n_val);
+            _self->service = strdup(s_val);
+        if (item == PAM_CONV) {
+            PyErr_SetString(PyExc_TypeError, "parameter must be function, not string");
+            return NULL;
+        }
+
+        result = pam_set_item(_self->pamh, item, (void *) s_val);
     } else {
         // An error occured parsing the tuple.  Clear it.  Then try to parse
         // it a different way.
openSUSE Build Service is sponsored by