summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-04-14 19:32:42 +0200
committerAndrew Bartlett <abartlet@samba.org>2008-04-14 19:32:42 +0200
commit68a2c547d00d7a8d0c15744172489d9d010c31a3 (patch)
tree54313b0dc50014015d680121fa750a5d4777c7a4 /source4/libnet
parent2cdfaedee203a726bddfb46fb10d9604de32a05f (diff)
parent4f51b0246db3242ee02ee16905cba13a5dc5633a (diff)
downloadsamba-68a2c547d00d7a8d0c15744172489d9d010c31a3.tar.gz
samba-68a2c547d00d7a8d0c15744172489d9d010c31a3.tar.bz2
samba-68a2c547d00d7a8d0c15744172489d9d010c31a3.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-abartlet
(This used to be commit 0f0c8519b87481e3473a469cefd51c76b4a7632e)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet.c13
-rw-r--r--source4/libnet/py_net.c13
2 files changed, 14 insertions, 12 deletions
diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c
index d1605bc17d..c966898cee 100644
--- a/source4/libnet/libnet.c
+++ b/source4/libnet/libnet.c
@@ -28,20 +28,17 @@ struct libnet_context *libnet_context_init(struct event_context *ev,
{
struct libnet_context *ctx;
+ /* We require an event context here */
+ if (!ev) {
+ return NULL;
+ }
+
/* create brand new libnet context */
ctx = talloc(ev, struct libnet_context);
if (!ctx) {
return NULL;
}
- /* events */
- if (ev == NULL) {
- ev = event_context_find(ctx);
- if (ev == NULL) {
- talloc_free(ctx);
- return NULL;
- }
- }
ctx->event_ctx = ev;
ctx->lp_ctx = lp_ctx;
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index 2fcbc5d156..cf81d8070d 100644
--- a/source4/libnet/py_net.c
+++ b/source4/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)) {