summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-11-21 16:20:10 +0100
committerJeremy Allison <jra@samba.org>2014-12-07 00:12:07 +0100
commit6a3db15810a01dc51faf39ea355525bc4c598758 (patch)
treeb078cbfb7711a5d77a4796f3cccdc1134993c78d
parentecd0e6e985ff8719963e31e1395b9ccbd38d94e1 (diff)
downloadsamba-6a3db15810a01dc51faf39ea355525bc4c598758.tar.gz
samba-6a3db15810a01dc51faf39ea355525bc4c598758.tar.xz
samba-6a3db15810a01dc51faf39ea355525bc4c598758.zip
ctdbd_conn: Accept msgs to all registered srvids
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/lib/ctdbd_conn.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index a26f410236..5dc007bf5c 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -54,6 +54,7 @@ struct ctdbd_connection {
uint32_t reqid;
uint32_t our_vnn;
uint64_t rand_srvid;
+ uint64_t *srvids;
int fd;
struct tevent_fd *fde;
@@ -109,10 +110,43 @@ static void ctdb_packet_dump(struct ctdb_req_header *hdr)
NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid)
{
+ NTSTATUS status;
int cstatus;
- return ctdbd_control(conn, CTDB_CURRENT_NODE,
- CTDB_CONTROL_REGISTER_SRVID, srvid, 0,
- tdb_null, NULL, NULL, &cstatus);
+ size_t num_srvids;
+ uint64_t *tmp;
+
+ status = ctdbd_control(conn, CTDB_CURRENT_NODE,
+ CTDB_CONTROL_REGISTER_SRVID, srvid, 0,
+ tdb_null, NULL, NULL, &cstatus);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ num_srvids = talloc_array_length(conn->srvids);
+
+ tmp = talloc_realloc(conn, conn->srvids, uint64_t,
+ num_srvids + 1);
+ if (tmp == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ conn->srvids = tmp;
+
+ conn->srvids[num_srvids] = srvid;
+ return NT_STATUS_OK;
+}
+
+static bool ctdb_is_our_srvid(struct ctdbd_connection *conn, uint64_t srvid)
+{
+ size_t i, num_srvids;
+
+ num_srvids = talloc_array_length(conn->srvids);
+
+ for (i=0; i<num_srvids; i++) {
+ if (srvid == conn->srvids[i]) {
+ return true;
+ }
+ }
+ return false;
}
/*
@@ -661,8 +695,7 @@ static NTSTATUS ctdb_handle_message(struct messaging_context *msg_ctx,
return NT_STATUS_OK;
}
- /* only messages to our pid or the broadcast are valid here */
- if (msg->srvid != getpid() && msg->srvid != MSG_SRVID_SAMBA) {
+ if (!ctdb_is_our_srvid(conn, msg->srvid)) {
DEBUG(0,("Got unexpected message with srvid=%llu\n",
(unsigned long long)msg->srvid));
return NT_STATUS_OK;