summaryrefslogtreecommitdiffstats
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-17 12:09:03 +0000
committerJeremy Allison <jra@samba.org>2014-12-16 18:56:03 +0100
commitd9a8453bbf69567236038e62f1c5cc4df25d899b (patch)
treea2cdef50dfdd9195a606ecbfc6574af35fa55ddd /source3/lib/messages.c
parentbbc5c64191d304aabf6ebebb2111396ee8bc2bc1 (diff)
downloadsamba-d9a8453bbf69567236038e62f1c5cc4df25d899b.tar.gz
samba-d9a8453bbf69567236038e62f1c5cc4df25d899b.tar.xz
samba-d9a8453bbf69567236038e62f1c5cc4df25d899b.zip
messaging3: Add messaging_names_db
This will enable messaging3 users to more easily register themselves under a name Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 1fd7601f82..2711468718 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -53,6 +53,7 @@
#include "lib/background.h"
#include "lib/messages_dgm.h"
#include "lib/iov_buf.h"
+#include "lib/util/server_id_db.h"
struct messaging_callback {
struct messaging_callback *prev, *next;
@@ -75,6 +76,8 @@ struct messaging_context {
unsigned num_waiters;
struct messaging_backend *remote;
+
+ struct server_id_db *names_db;
};
struct messaging_hdr {
@@ -314,6 +317,15 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
return NULL;
}
+ ctx->names_db = server_id_db_init(
+ ctx, ctx->id, lp_cache_directory(), 0,
+ TDB_INCOMPATIBLE_HASH|TDB_CLEAR_IF_FIRST);
+ if (ctx->names_db == NULL) {
+ DEBUG(10, ("%s: server_id_db_init failed\n", __func__));
+ TALLOC_FREE(ctx);
+ return NULL;
+ }
+
talloc_set_destructor(ctx, messaging_context_destructor);
if (lp_clustering()) {
@@ -377,6 +389,8 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
}
}
+ server_id_db_reinit(msg_ctx->names_db, msg_ctx->id);
+
return NT_STATUS_OK;
}
@@ -963,4 +977,9 @@ struct tevent_context *messaging_tevent_context(
return msg_ctx->event_ctx;
}
+struct server_id_db *messaging_names_db(struct messaging_context *msg_ctx)
+{
+ return msg_ctx->names_db;
+}
+
/** @} **/