diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-07-28 16:01:31 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-07-28 16:06:05 +1000 |
commit | 058cd95c88f693a42bb1c4f620b62346a3f0f08d (patch) | |
tree | 578da583349a27b03ad6a1bbb64f85502f054b67 /source4/libnet | |
parent | bfda910a20cb93e3db458456c75feb9d4cad2607 (diff) | |
download | samba-058cd95c88f693a42bb1c4f620b62346a3f0f08d.tar.gz samba-058cd95c88f693a42bb1c4f620b62346a3f0f08d.tar.bz2 samba-058cd95c88f693a42bb1c4f620b62346a3f0f08d.zip |
s4:libnet Add in a 'credentials' parameter for python libnet_Join
Diffstat (limited to 'source4/libnet')
-rw-r--r-- | source4/libnet/py_net.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index 4770cff82d..d9dc8d485b 100644 --- a/source4/libnet/py_net.c +++ b/source4/libnet/py_net.c @@ -27,10 +27,15 @@ /* FIXME: This prototype should be in param/pyparam.h */ struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx); -static struct libnet_context *py_net_ctx(PyObject *obj, struct tevent_context *ev) +static struct libnet_context *py_net_ctx(PyObject *obj, struct tevent_context *ev, struct cli_credentials *creds) { - /* FIXME: Use obj */ - return libnet_context_init(ev, py_default_loadparm_context(NULL)); +/* FIXME: Use obj */ + struct libnet_context *libnet; + libnet = libnet_context_init(ev, py_default_loadparm_context(NULL)); + if (!libnet) { + return NULL; + } + libnet->credentials = creds; } static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) @@ -41,11 +46,13 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) TALLOC_CTX *mem_ctx; struct tevent_context *ev; struct libnet_context *libnet_ctx; - const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL }; + struct cli_credentials *creds; + PyObject *py_creds; + const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", "credentials", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssii:Join", discard_const_p(char *, kwnames), + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssiiO:Join", discard_const_p(char *, kwnames), &r.in.domain_name, &r.in.netbios_name, - &r.in.join_type, &r.in.level)) + &r.in.join_type, &r.in.level, &py_creds)) return NULL; /* FIXME: we really need to get a context from the caller or we may end @@ -53,7 +60,13 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) ev = s4_event_context_init(NULL); mem_ctx = talloc_new(ev); - libnet_ctx = py_net_ctx(cls, ev); + creds = cli_credentials_from_py_object(py_creds); + if (creds == NULL) { + PyErr_SetString(PyExc_TypeError, "Expected credentials object"); + return NULL; + } + + libnet_ctx = py_net_ctx(cls, ev, creds); status = libnet_Join(libnet_ctx, mem_ctx, &r); if (NT_STATUS_IS_ERR(status)) { |