X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=source%2Flibnet%2Fpy_net.c;h=443da299c7ca7d915c603d4321a96deb10008bcb;hb=791ce0fe39a9d9e0d40b9850ff6f0cc9077fe2f1;hp=2fcbc5d156cbe67d7741ef26a2db73ed0ae85c72;hpb=58e00594d8c191f499225aa2755a06bac2937300;p=kai%2Fsamba.git diff --git a/source/libnet/py_net.c b/source/libnet/py_net.c index 2fcbc5d156c..443da299c7c 100644 --- a/source/libnet/py_net.c +++ b/source/libnet/py_net.c @@ -22,11 +22,12 @@ #include "libnet.h" #include "param/param.h" #include "libcli/security/security.h" +#include "lib/events/events.h" -struct libnet_context *py_net_ctx(PyObject *obj) +struct libnet_context *py_net_ctx(PyObject *obj, struct event_context *ev) { /* FIXME: Use obj */ - return libnet_context_init(NULL, global_loadparm); + return libnet_context_init(ev, global_loadparm); } static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) @@ -35,6 +36,7 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) NTSTATUS status; PyObject *result; TALLOC_CTX *mem_ctx; + struct event_context *ev; struct libnet_context *libnet_ctx; const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL }; @@ -43,9 +45,12 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) &r.in.join_type, &r.in.level)) return NULL; - mem_ctx = talloc_new(NULL); + /* FIXME: we really need to get a context from the caller or we may end + * up with 2 event contexts */ + ev = event_context_init(NULL); + mem_ctx = talloc_new(ev); - libnet_ctx = py_net_ctx(cls); + libnet_ctx = py_net_ctx(cls, ev); status = libnet_Join(libnet_ctx, mem_ctx, &r); if (NT_STATUS_IS_ERR(status)) { @@ -66,8 +71,11 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs) return result; } +static char py_net_join_doc[] = "join(domain_name, netbios_name, join_type, level) -> (join_password, domain_sid, domain_name)\n\n" \ +"Join the domain with the specified name."; + static struct PyMethodDef net_methods[] = { - {"Join", (PyCFunction)py_net_join, METH_VARARGS|METH_KEYWORDS}, + {"Join", (PyCFunction)py_net_join, METH_VARARGS|METH_KEYWORDS, py_net_join_doc}, {NULL } };