diff options
author | Stefan Metzmacher <metze@samba.org> | 2016-07-12 08:14:36 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2016-07-22 16:03:26 +0200 |
commit | a5591e597dbcbd74a6cb76786f479d5962a41cfd (patch) | |
tree | 14329ce06f0ea6a8bd6713ce0ee01c238af27645 /auth/credentials/pycredentials.c | |
parent | 1fd927136be7230d5b670bf9b9ffe91071ec94d8 (diff) | |
download | samba-a5591e597dbcbd74a6cb76786f479d5962a41cfd.tar.gz |
pycredentials: add {get,set}_old_password()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth/credentials/pycredentials.c')
-rw-r--r-- | auth/credentials/pycredentials.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c index 13443910ad7..1c0e4069e8e 100644 --- a/auth/credentials/pycredentials.c +++ b/auth/credentials/pycredentials.c @@ -64,7 +64,6 @@ static PyObject *py_creds_get_password(PyObject *self, PyObject *unused) return PyString_FromStringOrNULL(cli_credentials_get_password(PyCredentials_AsCliCredentials(self))); } - static PyObject *py_creds_set_password(PyObject *self, PyObject *args) { char *newval; @@ -79,6 +78,25 @@ static PyObject *py_creds_set_password(PyObject *self, PyObject *args) return PyBool_FromLong(cli_credentials_set_password(PyCredentials_AsCliCredentials(self), newval, obt)); } +static PyObject *py_creds_get_old_password(PyObject *self, PyObject *unused) +{ + return PyString_FromStringOrNULL(cli_credentials_get_old_password(PyCredentials_AsCliCredentials(self))); +} + +static PyObject *py_creds_set_old_password(PyObject *self, PyObject *args) +{ + char *oldval; + enum credentials_obtained obt = CRED_SPECIFIED; + int _obt = obt; + + if (!PyArg_ParseTuple(args, "s|i", &oldval, &_obt)) { + return NULL; + } + obt = _obt; + + return PyBool_FromLong(cli_credentials_set_old_password(PyCredentials_AsCliCredentials(self), oldval, obt)); +} + static PyObject *py_creds_get_domain(PyObject *self, PyObject *unused) { return PyString_FromStringOrNULL(cli_credentials_get_domain(PyCredentials_AsCliCredentials(self))); @@ -398,6 +416,12 @@ static PyMethodDef py_creds_methods[] = { { "set_password", py_creds_set_password, METH_VARARGS, "S.set_password(password, obtained=CRED_SPECIFIED) -> None\n" "Change password." }, + { "get_old_password", py_creds_get_old_password, METH_NOARGS, + "S.get_old_password() -> password\n" + "Obtain old password." }, + { "set_old_password", py_creds_set_old_password, METH_VARARGS, + "S.set_old_password(password, obtained=CRED_SPECIFIED) -> None\n" + "Change old password." }, { "get_domain", py_creds_get_domain, METH_NOARGS, "S.get_domain() -> domain\n" "Obtain domain name." }, |