summaryrefslogtreecommitdiff
path: root/source4/lib/messaging/messaging.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/messaging/messaging.c')
-rw-r--r--source4/lib/messaging/messaging.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index c4c0d0e059..36cf9aa609 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -34,6 +34,7 @@
#include "lib/util/util_tdb.h"
#include "lib/util/util_tdb.h"
#include "cluster/cluster.h"
+#include "param/param.h"
/* change the message version with any incompatible changes in the protocol */
#define MESSAGING_VERSION 1
@@ -136,7 +137,8 @@ static void messaging_dispatch(struct messaging_context *msg, struct messaging_r
/* temporary IDs use an idtree, the rest use a array of pointers */
if (rec->header->msg_type >= MSG_TMP_BASE) {
- d = idr_find(msg->dispatch_tree, rec->header->msg_type);
+ d = (struct dispatch_fn *)idr_find(msg->dispatch_tree,
+ rec->header->msg_type);
} else if (rec->header->msg_type < msg->num_types) {
d = msg->dispatch[rec->header->msg_type];
} else {
@@ -416,7 +418,8 @@ void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void
struct dispatch_fn *d, *next;
if (msg_type >= msg->num_types) {
- d = idr_find(msg->dispatch_tree, msg_type);
+ d = (struct dispatch_fn *)idr_find(msg->dispatch_tree,
+ msg_type);
if (!d) return;
idr_remove(msg->dispatch_tree, msg_type);
talloc_free(d);
@@ -504,7 +507,7 @@ NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id serv
{
DATA_BLOB blob;
- blob.data = (void *)&ptr;
+ blob.data = (uint8_t *)&ptr;
blob.length = sizeof(void *);
return messaging_send(msg, server, msg_type, &blob);
@@ -527,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) {
@@ -552,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);
@@ -607,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
@@ -665,7 +667,7 @@ static void irpc_handler_reply(struct messaging_context *msg_ctx, struct irpc_me
{
struct irpc_request *irpc;
- irpc = idr_find(msg_ctx->idr, m->header.callid);
+ irpc = (struct irpc_request *)idr_find(msg_ctx->idr, m->header.callid);
if (irpc == NULL) return;
/* parse the reply data */