Commit 025af57c 025af57ccc94b0552e1d832373b0faab8ef411eb by Wojciech Polak

Python: Allow to set mu_pam_service.

* python/libmu_py/auth.c (api_set_pam_service): New function.
* python/mailutils/auth.py (set_pam_service): New function.
1 parent f6db8dab
......@@ -19,6 +19,7 @@
*/
#include "libmu_py.h"
#include <mailutils/pam.h>
#define PY_MODULE "auth"
#define PY_CSNAME1 "AuthorityType"
......@@ -621,6 +622,17 @@ api_authenticate (PyObject *self, PyObject *args)
return _ro (PyInt_FromLong (status));
}
static PyObject *
api_set_pam_service (PyObject *self, PyObject *args)
{
char *pam_service;
if (!PyArg_ParseTuple (args, "s", &pam_service))
return NULL;
mu_pam_service = pam_service;
return _ro (Py_None);
}
static PyMethodDef methods[] = {
{ "authority_create", (PyCFunction) api_authority_create, METH_VARARGS,
......@@ -668,6 +680,9 @@ static PyMethodDef methods[] = {
{ "authenticate", (PyCFunction) api_authenticate, METH_VARARGS,
"" },
{ "set_pam_service", (PyCFunction) api_set_pam_service, METH_VARARGS,
"" },
{ NULL, NULL, 0, NULL }
};
......
......@@ -47,6 +47,9 @@ def authenticate (auth_data, password):
if status:
raise AuthError (status)
def set_pam_service (pam_service):
auth.set_pam_service (pam_service)
class Authority:
__owner = False
......