s4-messaging: Fill in the whole server_id in all use cases
authorAndrew Bartlett <abartlet@samba.org>
Mon, 30 Apr 2012 05:44:01 +0000 (15:44 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 30 Apr 2012 07:55:11 +0000 (17:55 +1000)
This started per https://bugzilla.samba.org/show_bug.cgi?id=8872#c4
and avoids any possible collision with a different process.

We also need to ensure that across a Samba installation on a single
node that id.vnn is the same.  Samba4 previously used 0, while Samba3
used NONCLUSTER_VNN.  When a message is sent between these 'different'
nodes, the error NT_STATUS_INVALID_DEVICE_REQUEST is raised.

Andrew Bartlett

librpc/idl/server_id.idl
source3/include/serverid.h
source4/cluster/local.c
source4/lib/messaging/messaging.c

index ac2e9ab318274e2e961d62737a7a8a613d211e54..554e428bf2b567146f15f3c299f9b6b5078c172e 100644 (file)
@@ -11,6 +11,9 @@ interface server_id
 
        const int NONCLUSTER_VNN = 0xFFFFFFFF;
 
+       /** Don't verify this unique id */
+       const int SERVERID_UNIQUE_ID_NOT_TO_VERIFY = 0xFFFFFFFFFFFFFFFFULL;
+
        /* used to look like the following, note that unique_id was not
         * marshalled at all...
 
index 8fc06a15d88251cadd8881c1b099603980d12532..1833f53d559488fcd228792865dee1bd5f3cebe0 100644 (file)
@@ -22,9 +22,6 @@
 
 #include "includes.h"
 
-/** Don't verify this unique id */
-#define SERVERID_UNIQUE_ID_NOT_TO_VERIFY 0xFFFFFFFFFFFFFFFFULL
-
 /*
  * Register a server with its unique id
  */
index 24cbe81c48277c605aeaef61948b3fe5a704a834..df67bcfa799741180ba9aa36a93e3b816eb59e2d 100644 (file)
@@ -37,6 +37,9 @@ static struct server_id local_id(struct cluster_ops *ops, uint64_t pid, uint32_t
        ZERO_STRUCT(server_id);
        server_id.pid = pid;
        server_id.task_id = task_id;
+       server_id.vnn = NONCLUSTER_VNN;
+       /* This is because we are not in the s3 serverid database */
+       server_id.unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY;
        return server_id;
 }
 
index 80812c2885081a4a399843ab96204d45c8fddef5..4d69b9424bdfea4eb50f4b148f1d7b756df7bbf2 100644 (file)
@@ -663,7 +663,12 @@ struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
 {
        struct server_id id;
        ZERO_STRUCT(id);
-       id.pid = generate_random() % 0x10000000;
+       id.pid = getpid();
+       id.task_id = generate_random();
+       id.vnn = NONCLUSTER_VNN;
+
+       /* This is because we are not in the s3 serverid database */
+       id.unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY;
 
        return imessaging_init(mem_ctx, lp_ctx, id, ev, true);
 }