Remove use of global loadparm in python modules.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2008 15:50:11 +0000 (16:50 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 2 Nov 2008 15:50:11 +0000 (16:50 +0100)
source4/lib/messaging/pymessaging.c
source4/libnet/py_net.c

index c2c23b679e0cab3c9a64a614e0eb16402afa30cc..ad8f955466f4b396c5e62f24a32f4e950fee4fcc 100644 (file)
@@ -34,6 +34,9 @@
 PyAPI_DATA(PyTypeObject) messaging_Type;
 PyAPI_DATA(PyTypeObject) irpc_ClientConnectionType;
 
+/* FIXME: This prototype should be in param/pyparam.h */
+struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx);
+
 static bool server_id_from_py(PyObject *object, struct server_id *server_id)
 {
        if (!PyTuple_Check(object)) {
@@ -80,7 +83,8 @@ PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwa
        ev = s4_event_context_init(ret->mem_ctx);
 
        if (messaging_path == NULL) {
-               messaging_path = lp_messaging_path(ret->mem_ctx, global_loadparm);
+               messaging_path = lp_messaging_path(ret->mem_ctx, 
+                                                                  py_default_loadparm_context(ret->mem_ctx));
        } else {
                messaging_path = talloc_strdup(ret->mem_ctx, messaging_path);
        }
@@ -334,7 +338,8 @@ PyObject *py_irpc_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
        ev = s4_event_context_init(ret->mem_ctx);
 
        if (messaging_path == NULL) {
-               messaging_path = lp_messaging_path(ret->mem_ctx, global_loadparm);
+               messaging_path = lp_messaging_path(ret->mem_ctx, 
+                                                                  py_default_loadparm_context(ret->mem_ctx));
        } else {
                messaging_path = talloc_strdup(ret->mem_ctx, messaging_path);
        }
index 37d51d78409ab8ac208c22e9e9b11979017bc2ca..887c3f466c65b193a6f74125a72ce4158cd09be7 100644 (file)
 #include "lib/events/events.h"
 #include "param/param.h"
 
+/* 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 event_context *ev)
 {
        /* FIXME: Use obj */
-       return libnet_context_init(ev, global_loadparm);
+       return libnet_context_init(ev, py_default_loadparm_context(NULL));
 }
 
 static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs)