summaryrefslogtreecommitdiff
path: root/source4/lib/messaging
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-10-01 18:52:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:34 -0500
commit2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad (patch)
tree2d02f6e998c150cca5323e574ffb8094fffc288f /source4/lib/messaging
parent4d7273715f109db82a4ee4852855927a32bb4073 (diff)
downloadsamba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.tar.gz
samba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.tar.bz2
samba-2f3551ca7cee59d4d053cceb87abdf1da1b3a1ad.zip
r25446: Merge some changes I made on the way home from SFO:
2007-09-29 More higher-level passing around of lp_ctx. 2007-09-29 Fix warning. 2007-09-29 Pass loadparm contexts on a higher level. 2007-09-29 Avoid using global loadparm context. (This used to be commit 3468952e771ab31f90b6c374ade01c5550810f42)
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r--source4/lib/messaging/irpc.h7
-rw-r--r--source4/lib/messaging/messaging.c9
2 files changed, 8 insertions, 8 deletions
diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h
index bcfc1f1ab4..989e5d4255 100644
--- a/source4/lib/messaging/irpc.h
+++ b/source4/lib/messaging/irpc.h
@@ -76,13 +76,12 @@ struct irpc_request {
} async;
};
+struct loadparm_context;
+
typedef void (*msg_callback_t)(struct messaging_context *msg, void *private,
uint32_t msg_type,
struct server_id server_id, DATA_BLOB *data);
-struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
- struct server_id server_id,
- struct event_context *ev);
NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server,
uint32_t msg_type, DATA_BLOB *data);
NTSTATUS messaging_register(struct messaging_context *msg, void *private,
@@ -91,9 +90,11 @@ NTSTATUS messaging_register(struct messaging_context *msg, void *private,
NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private,
msg_callback_t fn, uint32_t *msg_type);
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct server_id server_id,
struct event_context *ev);
struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct event_context *ev);
NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server,
uint32_t msg_type, void *ptr);
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index e398b16d72..36cf9aa609 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -530,13 +530,13 @@ static int messaging_destructor(struct messaging_context *msg)
create the listening socket and setup the dispatcher
*/
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct server_id server_id,
struct event_context *ev)
{
struct messaging_context *msg;
NTSTATUS status;
struct socket_address *path;
- char *dir;
msg = talloc_zero(mem_ctx, struct messaging_context);
if (msg == NULL) {
@@ -555,11 +555,9 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
}
/* create the messaging directory if needed */
- dir = smbd_tmp_path(msg, "messaging");
mkdir(dir, 0700);
- talloc_free(dir);
- msg->base_path = smbd_tmp_path(msg, "messaging");
+ msg->base_path = talloc_reference(msg, dir);
msg->path = messaging_path(msg, server_id);
msg->server_id = server_id;
msg->idr = idr_init(msg);
@@ -610,12 +608,13 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
A hack, for the short term until we get 'client only' messaging in place
*/
struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
+ const char *dir,
struct event_context *ev)
{
struct server_id id;
ZERO_STRUCT(id);
id.id = random() % 0x10000000;
- return messaging_init(mem_ctx, id, ev);
+ return messaging_init(mem_ctx, dir, id, ev);
}
/*
a list of registered irpc server functions