git.samba.org
/
ira
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bfda910
)
s4:libnet Add in a 'credentials' parameter for python libnet_Join
author
Andrew Bartlett
<abartlet@samba.org>
Tue, 28 Jul 2009 06:01:31 +0000
(16:01 +1000)
committer
Andrew Bartlett
<abartlet@samba.org>
Tue, 28 Jul 2009 06:06:05 +0000
(16:06 +1000)
source4/libnet/py_net.c
patch
|
blob
|
history
diff --git
a/source4/libnet/py_net.c
b/source4/libnet/py_net.c
index 4770cff82d30ccabba14a8019a52f50aec76cfcd..d9dc8d485b4054cba203f1c1abd65955e80d7869 100644
(file)
--- 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);
/* 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)
}
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;
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, "ssii
O
:Join", discard_const_p(char *, kwnames),
&r.in.domain_name, &r.in.netbios_name,
&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
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);
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)) {
status = libnet_Join(libnet_ctx, mem_ctx, &r);
if (NT_STATUS_IS_ERR(status)) {