summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/auth/auth_samba4.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/ridalloc.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/rootdse.c2
-rw-r--r--source4/lib/messaging/messaging.c13
-rw-r--r--source4/lib/messaging/messaging.h4
-rw-r--r--source4/lib/messaging/pymessaging.c27
-rw-r--r--source4/lib/messaging/tests/irpc.c4
-rw-r--r--source4/lib/messaging/tests/messaging.c4
-rw-r--r--source4/librpc/rpc/pyrpc_util.c2
-rw-r--r--source4/scripting/python/samba/tests/messaging.py1
-rw-r--r--source4/smbd/server.c2
-rw-r--r--source4/smbd/service_stream.c2
-rw-r--r--source4/smbd/service_task.c2
-rw-r--r--source4/utils/ntlm_auth.c2
14 files changed, 36 insertions, 33 deletions
diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c
index 994bde17132..21c7b44eedf 100644
--- a/source3/auth/auth_samba4.c
+++ b/source3/auth/auth_samba4.c
@@ -122,7 +122,7 @@ static NTSTATUS prepare_gensec(TALLOC_CTX *mem_ctx,
}
msg_ctx = imessaging_client_init(frame,
- lpcfg_imessaging_path(frame, lp_ctx),
+ lp_ctx,
event_ctx);
if (msg_ctx == NULL) {
DEBUG(1, ("imessaging_init failed\n"));
diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c b/source4/dsdb/samdb/ldb_modules/ridalloc.c
index ed87f86fa24..2cef1c445f6 100644
--- a/source4/dsdb/samdb/ldb_modules/ridalloc.c
+++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c
@@ -73,7 +73,7 @@ static void ridalloc_poke_rid_manager(struct ldb_module *module)
(struct loadparm_context *)ldb_get_opaque(ldb, "loadparm");
TALLOC_CTX *tmp_ctx = talloc_new(module);
- msg = imessaging_client_init(tmp_ctx, lpcfg_imessaging_path(tmp_ctx, lp_ctx),
+ msg = imessaging_client_init(tmp_ctx, lp_ctx,
ldb_get_event_context(ldb));
if (!msg) {
DEBUG(3,(__location__ ": Failed to create messaging context\n"));
diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c
index 9813fe8b078..46dbb75b371 100644
--- a/source4/dsdb/samdb/ldb_modules/rootdse.c
+++ b/source4/dsdb/samdb/ldb_modules/rootdse.c
@@ -1299,7 +1299,7 @@ static int rootdse_become_master(struct ldb_module *module,
"RODC cannot become a role master.");
}
- msg = imessaging_client_init(tmp_ctx, lpcfg_imessaging_path(tmp_ctx, lp_ctx),
+ msg = imessaging_client_init(tmp_ctx, lp_ctx,
ldb_get_event_context(ldb));
if (!msg) {
ldb_asprintf_errstring(ldb, "Failed to generate client messaging context in %s", lpcfg_imessaging_path(tmp_ctx, lp_ctx));
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 11ebf19b22c..51fc8e26edf 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -34,6 +34,7 @@
#include "../lib/util/util_tdb.h"
#include "cluster/cluster.h"
#include "../lib/util/tevent_ntstatus.h"
+#include "lib/param/param.h"
/* change the message version with any incompatible changes in the protocol */
#define IMESSAGING_VERSION 1
@@ -566,7 +567,7 @@ int imessaging_cleanup(struct imessaging_context *msg)
memory
*/
struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
- const char *dir,
+ struct loadparm_context *lp_ctx,
struct server_id server_id,
struct tevent_context *ev,
bool auto_remove)
@@ -592,9 +593,11 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
}
/* create the messaging directory if needed */
- mkdir(dir, 0700);
- msg->base_path = talloc_reference(msg, dir);
+ msg->base_path = lpcfg_imessaging_path(msg, lp_ctx);
+
+ mkdir(msg->base_path, 0700);
+
msg->path = imessaging_path(msg, server_id);
msg->server_id = server_id;
msg->idr = idr_init(msg);
@@ -648,13 +651,13 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
A hack, for the short term until we get 'client only' messaging in place
*/
struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
- const char *dir,
+ struct loadparm_context *lp_ctx,
struct tevent_context *ev)
{
struct server_id id;
ZERO_STRUCT(id);
id.pid = random() % 0x10000000;
- return imessaging_init(mem_ctx, dir, id, ev, true);
+ return imessaging_init(mem_ctx, lp_ctx, id, ev, true);
}
/*
a list of registered irpc server functions
diff --git a/source4/lib/messaging/messaging.h b/source4/lib/messaging/messaging.h
index e51590fe74a..984cd36e89d 100644
--- a/source4/lib/messaging/messaging.h
+++ b/source4/lib/messaging/messaging.h
@@ -54,13 +54,13 @@ NTSTATUS imessaging_register(struct imessaging_context *msg, void *private_data,
NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_data,
msg_callback_t fn, uint32_t *msg_type);
struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
- const char *dir,
+ struct loadparm_context *lp_ctx,
struct server_id server_id,
struct tevent_context *ev,
bool auto_remove);
int imessaging_cleanup(struct imessaging_context *msg);
struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
- const char *dir,
+ struct loadparm_context *lp_ctx,
struct tevent_context *ev);
NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id server,
uint32_t msg_type, void *ptr);
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index 4f90db59f2d..d9ad3790f99 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);
}
diff --git a/source4/lib/messaging/tests/irpc.c b/source4/lib/messaging/tests/irpc.c
index c94765a1677..83361073b83 100644
--- a/source4/lib/messaging/tests/irpc.c
+++ b/source4/lib/messaging/tests/irpc.c
@@ -247,14 +247,14 @@ static bool irpc_setup(struct torture_context *tctx, void **_data)
data->ev = tctx->ev;
torture_assert(tctx, data->msg_ctx1 =
imessaging_init(tctx,
- lpcfg_imessaging_path(tctx, tctx->lp_ctx),
+ tctx->lp_ctx,
cluster_id(0, MSG_ID1),
data->ev, true),
"Failed to init first messaging context");
torture_assert(tctx, data->msg_ctx2 =
imessaging_init(tctx,
- lpcfg_imessaging_path(tctx, tctx->lp_ctx),
+ tctx->lp_ctx,
cluster_id(0, MSG_ID2),
data->ev, true),
"Failed to init second messaging context");
diff --git a/source4/lib/messaging/tests/messaging.c b/source4/lib/messaging/tests/messaging.c
index c17b95e9c4c..b6d1c35d1ef 100644
--- a/source4/lib/messaging/tests/messaging.c
+++ b/source4/lib/messaging/tests/messaging.c
@@ -72,7 +72,7 @@ static bool test_ping_speed(struct torture_context *tctx)
ev = tctx->ev;
msg_server_ctx = imessaging_init(tctx,
- lpcfg_imessaging_path(tctx, tctx->lp_ctx), cluster_id(0, 1),
+ tctx->lp_ctx, cluster_id(0, 1),
ev, true);
torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context");
@@ -81,7 +81,7 @@ static bool test_ping_speed(struct torture_context *tctx)
imessaging_register_tmp(msg_server_ctx, tctx, exit_message, &msg_exit);
msg_client_ctx = imessaging_init(tctx,
- lpcfg_imessaging_path(tctx, tctx->lp_ctx),
+ tctx->lp_ctx,
cluster_id(0, 2),
ev, true);
diff --git a/source4/librpc/rpc/pyrpc_util.c b/source4/librpc/rpc/pyrpc_util.c
index fa6bdab2a28..d0fa5d72853 100644
--- a/source4/librpc/rpc/pyrpc_util.c
+++ b/source4/librpc/rpc/pyrpc_util.c
@@ -74,7 +74,7 @@ static NTSTATUS pyrpc_irpc_connect(TALLOC_CTX *mem_ctx, const char *irpc_server,
{
struct imessaging_context *msg;
- msg = imessaging_client_init(mem_ctx, lpcfg_imessaging_path(mem_ctx, lp_ctx), event_ctx);
+ msg = imessaging_client_init(mem_ctx, lp_ctx, event_ctx);
NT_STATUS_HAVE_NO_MEMORY(msg);
*binding_handle = irpc_binding_handle_by_name(mem_ctx, msg, irpc_server, table);
diff --git a/source4/scripting/python/samba/tests/messaging.py b/source4/scripting/python/samba/tests/messaging.py
index 7f2d4a904b9..8525b30c4bd 100644
--- a/source4/scripting/python/samba/tests/messaging.py
+++ b/source4/scripting/python/samba/tests/messaging.py
@@ -26,7 +26,6 @@ from samba.tests import TestCase
class MessagingTests(TestCase):
def get_context(self, *args, **kwargs):
- kwargs["messaging_path"] = "."
return Messaging(*args, **kwargs)
def test_register(self):
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index c8549e2b568..86622c8be97 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -221,7 +221,7 @@ static NTSTATUS setup_parent_messaging(struct tevent_context *event_ctx,
NTSTATUS status;
msg = imessaging_init(talloc_autofree_context(),
- lpcfg_imessaging_path(event_ctx, lp_ctx),
+ lp_ctx,
cluster_id(0, SAMBA_PARENT_TASKID), event_ctx, false);
NT_STATUS_HAVE_NO_MEMORY(msg);
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index 28159f4f00d..22c4c040e40 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -189,7 +189,7 @@ static void stream_new_connection(struct tevent_context *ev,
/* setup to receive internal messages on this connection */
srv_conn->msg_ctx = imessaging_init(srv_conn,
- lpcfg_imessaging_path(srv_conn, lp_ctx),
+ lp_ctx,
srv_conn->server_id, ev, false);
if (!srv_conn->msg_ctx) {
stream_terminate_connection(srv_conn, "imessaging_init() failed");
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index f68805fde03..4531c3aebca 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -79,7 +79,7 @@ static void task_server_callback(struct tevent_context *event_ctx,
task->lp_ctx = lp_ctx;
task->msg_ctx = imessaging_init(task,
- lpcfg_imessaging_path(task, task->lp_ctx),
+ task->lp_ctx,
task->server_id,
task->event_ctx, false);
if (!task->msg_ctx) {
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 465d9b59829..c0a06bd3367 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -463,7 +463,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
const char *winbind_method[] = { "winbind", NULL };
struct auth4_context *auth_context;
- msg = imessaging_client_init(state, lpcfg_imessaging_path(state, lp_ctx), ev);
+ msg = imessaging_client_init(state, lp_ctx, ev);
if (!msg) {
talloc_free(mem_ctx);
exit(1);