diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2017-03-21 09:58:18 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-03-29 02:37:25 +0200 |
commit | 76692faa9f991f7460a778fbaf7e5cd902a9608f (patch) | |
tree | 2070ca9a3d11d322be0b26d835a3a149ae33c269 /source4/libnet | |
parent | b57e3cf1dfab2734baf63d06546f28fdf96fab9d (diff) | |
download | samba-76692faa9f991f7460a778fbaf7e5cd902a9608f.tar.gz |
python net: add username, oldpassword and domain to change_password
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source4/libnet')
-rw-r--r-- | source4/libnet/py_net.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index bf39415cf32..35869358de2 100644 --- a/source4/libnet/py_net.c +++ b/source4/libnet/py_net.c @@ -156,20 +156,32 @@ static PyObject *py_net_change_password(py_net_Object *self, PyObject *args, PyO NTSTATUS status; TALLOC_CTX *mem_ctx; struct tevent_context *ev; - const char *kwnames[] = { "newpassword", NULL }; + const char *kwnames[] = { "newpassword", "oldpassword", "domain", "username", NULL }; ZERO_STRUCT(r); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:change_password", - discard_const_p(char *, kwnames), - &r.generic.in.newpassword)) { + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|sss:change_password", + discard_const_p(char *, kwnames), + &r.generic.in.newpassword, + &r.generic.in.oldpassword, + &r.generic.in.domain_name, + &r.generic.in.account_name)) { return NULL; } r.generic.level = LIBNET_CHANGE_PASSWORD_GENERIC; - r.generic.in.account_name = cli_credentials_get_username(self->libnet_ctx->cred); - r.generic.in.domain_name = cli_credentials_get_domain(self->libnet_ctx->cred); - r.generic.in.oldpassword = cli_credentials_get_password(self->libnet_ctx->cred); + if (r.generic.in.account_name == NULL) { + r.generic.in.account_name + = cli_credentials_get_username(self->libnet_ctx->cred); + } + if (r.generic.in.domain_name == NULL) { + r.generic.in.domain_name + = cli_credentials_get_domain(self->libnet_ctx->cred); + } + if (r.generic.in.oldpassword == NULL) { + r.generic.in.oldpassword + = cli_credentials_get_password(self->libnet_ctx->cred); + } /* FIXME: we really need to get a context from the caller or we may end * up with 2 event contexts */ |