summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-04-15 01:18:06 +0200
committerStefan Metzmacher <metze@samba.org>2008-04-18 14:43:06 +0200
commitb86b442a1e8a49d32a4b7cb44a9f6b5e270be403 (patch)
treeab427d6c5d2a5bcced5286713d7db0169ae9f3e0 /source3
parent9714899c29807b4b2e72009913c14091da762460 (diff)
downloadsamba-b86b442a1e8a49d32a4b7cb44a9f6b5e270be403.tar.gz
samba-b86b442a1e8a49d32a4b7cb44a9f6b5e270be403.tar.bz2
samba-b86b442a1e8a49d32a4b7cb44a9f6b5e270be403.zip
messages_ctdbd: make sure a ctdbd connection is only used in the process that created it
metze (This used to be commit 259786980a3a65fa67a4de12a65d33095fa53ce2)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/messages_ctdbd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index f1a02e6af9..0c8a2aa8e4 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -35,10 +35,18 @@ struct messaging_ctdbd_context {
* This is a Samba3 hack/optimization. Routines like process_exists need to
* talk to ctdbd, and they don't get handed a messaging context.
*/
-struct ctdbd_connection *global_ctdbd_connection;
+static struct ctdbd_connection *global_ctdbd_connection;
+static int global_ctdb_connection_pid;
struct ctdbd_connection *messaging_ctdbd_connection(void)
{
+ if (global_ctdb_connection_pid != getpid()) {
+ DEBUG(0,("messaging_ctdbd_connection():"
+ "valid for pid[%d] but it's [%d]\n",
+ global_ctdb_connection_pid, getpid()));
+ smb_panic("messaging_ctdbd_connection() invalid process\n");
+ }
+
return global_ctdbd_connection;
}
@@ -66,6 +74,7 @@ static int messaging_ctdbd_destructor(struct messaging_ctdbd_context *ctx)
/*
* The global connection just went away
*/
+ global_ctdb_connection_pid = 0;
global_ctdbd_connection = NULL;
return 0;
}
@@ -107,6 +116,7 @@ NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
return status;
}
+ global_ctdb_connection_pid = getpid();
global_ctdbd_connection = ctx->conn;
talloc_set_destructor(ctx, messaging_ctdbd_destructor);