1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

s4-messaging: Fill in the whole server_id in all use cases

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
This commit is contained in:
Andrew Bartlett 2012-04-30 15:44:01 +10:00
parent 645e4bb436
commit f10c638100
4 changed files with 12 additions and 4 deletions

View 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...

View 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
*/

View 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;
}

View 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);
}