|
|
154a42 |
diff --git a/PAMmodule.c b/PAMmodule.c
|
|
|
154a42 |
index 03cb799..a7ff8a5 100644
|
|
|
154a42 |
--- a/PAMmodule.c
|
|
|
154a42 |
+++ b/PAMmodule.c
|
|
|
154a42 |
@@ -24,8 +24,6 @@ typedef struct {
|
|
|
154a42 |
char *service;
|
|
|
154a42 |
char *user;
|
|
|
154a42 |
PyObject *callback;
|
|
|
154a42 |
- struct pam_response *response_data;
|
|
|
154a42 |
- int response_len;
|
|
|
154a42 |
PyObject *user_data;
|
|
|
154a42 |
void *dlh1, *dlh2;
|
|
|
154a42 |
} PyPAMObject;
|
|
|
154a42 |
@@ -54,15 +52,6 @@ static int PyPAM_conv(int num_msg, const struct pam_message **msg,
|
|
|
154a42 |
|
|
|
154a42 |
Py_INCREF(self);
|
|
|
154a42 |
|
|
|
154a42 |
- if (NULL != self->response_data) {
|
|
|
154a42 |
- for (int i = 0; i < self->response_len; i++) {
|
|
|
154a42 |
- free(self->response_data[0].resp);
|
|
|
154a42 |
- }
|
|
|
154a42 |
- free(self->response_data);
|
|
|
154a42 |
- self->response_data = NULL;
|
|
|
154a42 |
- self->response_len = 0;
|
|
|
154a42 |
- }
|
|
|
154a42 |
-
|
|
|
154a42 |
PyObject* msgList = PyList_New(num_msg);
|
|
|
154a42 |
|
|
|
154a42 |
for (int i = 0; i < num_msg; i++) {
|
|
|
154a42 |
@@ -92,6 +81,10 @@ static int PyPAM_conv(int num_msg, const struct pam_message **msg,
|
|
|
154a42 |
char* resp_text;
|
|
|
154a42 |
int resp_retcode = 0;
|
|
|
154a42 |
if (!PyArg_ParseTuple(respTuple, "si", &resp_text, &resp_retcode)) {
|
|
|
154a42 |
+ while (i > 0) {
|
|
|
154a42 |
+ free((--spr)->resp);
|
|
|
154a42 |
+ --i;
|
|
|
154a42 |
+ }
|
|
|
154a42 |
free(*resp);
|
|
|
154a42 |
Py_DECREF(respList);
|
|
|
154a42 |
return PAM_CONV_ERR;
|
|
|
154a42 |
@@ -100,10 +93,6 @@ static int PyPAM_conv(int num_msg, const struct pam_message **msg,
|
|
|
154a42 |
spr->resp_retcode = resp_retcode;
|
|
|
154a42 |
Py_DECREF(respTuple);
|
|
|
154a42 |
}
|
|
|
154a42 |
-
|
|
|
154a42 |
- // Save this so we can free it later.
|
|
|
154a42 |
- self->response_data = *resp;
|
|
|
154a42 |
- self->response_len = PyList_Size(respList);
|
|
|
154a42 |
|
|
|
154a42 |
Py_DECREF(respList);
|
|
|
154a42 |
|
|
|
154a42 |
@@ -144,8 +133,6 @@ static PyObject * PyPAM_pam(PyObject *self, PyObject *args)
|
|
|
154a42 |
p->user = NULL;
|
|
|
154a42 |
Py_INCREF(Py_None);
|
|
|
154a42 |
p->callback = Py_None;
|
|
|
154a42 |
- p->response_data = NULL;
|
|
|
154a42 |
- p->response_len = 0;
|
|
|
154a42 |
Py_INCREF(Py_None);
|
|
|
154a42 |
p->user_data = Py_None;
|
|
|
154a42 |
|