diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-10-13 20:01:56 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-10-13 14:06:07 +0200 |
commit | 3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c (patch) | |
tree | ed1f1f37b4ecbb887fa391da340de0c044e9dec7 /source4/lib/messaging/pymessaging.c | |
parent | 5603dab6478fbb40206a8664a308b5db5b1863e8 (diff) | |
download | samba-3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c.tar.gz samba-3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c.tar.bz2 samba-3cdb1fe4404e26ae383cfb73bfa8af36cb1d7f7c.zip |
s4-messaging: Pass the loadparm context, not just the messaging path
This will allow the TDB layer to get at the lp_ctx for tdb options.
Andrew Bartlett
Diffstat (limited to 'source4/lib/messaging/pymessaging.c')
-rw-r--r-- | source4/lib/messaging/pymessaging.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index 4f90db59f2..d9ad3790f9 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -64,13 +64,14 @@ typedef struct { static PyObject *py_imessaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs) { struct tevent_context *ev; - const char *kwnames[] = { "own_id", "messaging_path", NULL }; + const char *kwnames[] = { "own_id", "lp_ctx", NULL }; PyObject *own_id = Py_None; - const char *imessaging_path = NULL; + PyObject *py_lp_ctx = Py_None; imessaging_Object *ret; + struct loadparm_context *lp_ctx; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oz:connect", - discard_const_p(char *, kwnames), &own_id, &imessaging_path)) { + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:connect", + discard_const_p(char *, kwnames), &own_id, &py_lp_ctx)) { return NULL; } @@ -80,15 +81,15 @@ static PyObject *py_imessaging_connect(PyTypeObject *self, PyObject *args, PyObj ret->mem_ctx = talloc_new(NULL); - ev = s4_event_context_init(ret->mem_ctx); - - if (imessaging_path == NULL) { - imessaging_path = lpcfg_imessaging_path(ret->mem_ctx, - py_default_loadparm_context(ret->mem_ctx)); - } else { - imessaging_path = talloc_strdup(ret->mem_ctx, imessaging_path); + lp_ctx = lpcfg_from_py_object(ret->mem_ctx, py_lp_ctx); + if (lp_ctx == NULL) { + PyErr_SetString(PyExc_RuntimeError, "imessaging_connect unable to interpret loadparm_context"); + talloc_free(ret->mem_ctx); + return NULL; } + ev = s4_event_context_init(ret->mem_ctx); + if (own_id != Py_None) { struct server_id server_id; @@ -96,12 +97,12 @@ static PyObject *py_imessaging_connect(PyTypeObject *self, PyObject *args, PyObj return NULL; ret->msg_ctx = imessaging_init(ret->mem_ctx, - imessaging_path, + lp_ctx, server_id, ev, true); } else { ret->msg_ctx = imessaging_client_init(ret->mem_ctx, - imessaging_path, + lp_ctx, ev); } |