s3-cluster Always fill in the clustering vnn element
authorAndrew Bartlett <abartlet@samba.org>
Wed, 16 Feb 2011 04:13:53 +0000 (15:13 +1100)
committerGünther Deschner <gd@samba.org>
Thu, 17 Feb 2011 15:02:19 +0000 (16:02 +0100)
This avoids this structure being partially uninitialised.

Adnrew Bartlett

source3/lib/serverid.c
source3/lib/util.c
source3/smbd/oplock.c
source3/utils/net_serverid.c

index ded72981ec4be7a203fdb9946b6db90995604974..a8cdcfa2a9d3b338f4d15ed35dfddcc2b90f6615 100644 (file)
@@ -23,9 +23,7 @@
 
 struct serverid_key {
        pid_t pid;
-#ifdef CLUSTER_SUPPORT
        uint32_t vnn;
-#endif
 };
 
 struct serverid_data {
@@ -71,9 +69,7 @@ static void serverid_fill_key(const struct server_id *id,
 {
        ZERO_STRUCTP(key);
        key->pid = id->pid;
-#ifdef CLUSTER_SUPPORT
        key->vnn = id->vnn;
-#endif
 }
 
 bool serverid_register(const struct server_id id, uint32_t msg_flags)
@@ -276,9 +272,7 @@ static bool serverid_rec_parse(const struct db_record *rec,
        memcpy(&data, rec->value.dptr, sizeof(data));
 
        id->pid = key.pid;
-#ifdef CLUSTER_SUPPORT
        id->vnn = key.vnn;
-#endif
        id->unique_id = data.unique_id;
        *msg_flags = data.msg_flags;
        return true;
index 08a24ec7222d1f5471dfdf99e3e530d56fb08f5a..e70dd6a341ccdb9422a93a36107833c8ef2a165c 100644 (file)
@@ -2574,9 +2574,7 @@ struct server_id pid_to_procid(pid_t pid)
        struct server_id result;
        result.pid = pid;
        result.unique_id = my_unique_id;
-#ifdef CLUSTER_SUPPORT
        result.vnn = my_vnn;
-#endif
        return result;
 }
 
@@ -2589,10 +2587,8 @@ bool procid_equal(const struct server_id *p1, const struct server_id *p2)
 {
        if (p1->pid != p2->pid)
                return False;
-#ifdef CLUSTER_SUPPORT
        if (p1->vnn != p2->vnn)
                return False;
-#endif
        return True;
 }
 
@@ -2606,10 +2602,8 @@ bool procid_is_me(const struct server_id *pid)
 {
        if (pid->pid != sys_getpid())
                return False;
-#ifdef CLUSTER_SUPPORT
        if (pid->vnn != my_vnn)
                return False;
-#endif
        return True;
 }
 
@@ -2617,7 +2611,6 @@ struct server_id interpret_pid(const char *pid_string)
 {
        struct server_id result;
        int pid;
-#ifdef CLUSTER_SUPPORT
        unsigned int vnn;
        if (sscanf(pid_string, "%u:%d", &vnn, &pid) == 2) {
                result.vnn = vnn;
@@ -2631,13 +2624,6 @@ struct server_id interpret_pid(const char *pid_string)
                result.vnn = NONCLUSTER_VNN;
                result.pid = -1;
        }
-#else
-       if (sscanf(pid_string, "%d", &pid) != 1) {
-               result.pid = -1;
-       } else {
-               result.pid = pid;
-       }
-#endif
        /* Assigning to result.pid may have overflowed
           Map negative pid to -1: i.e. error */
        if (result.pid < 0) {
@@ -2649,7 +2635,6 @@ struct server_id interpret_pid(const char *pid_string)
 
 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid)
 {
-#ifdef CLUSTER_SUPPORT
        if (pid->vnn == NONCLUSTER_VNN) {
                return talloc_asprintf(mem_ctx,
                                "%d",
@@ -2661,11 +2646,6 @@ char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid)
                                        (unsigned)pid->vnn,
                                        (int)pid->pid);
        }
-#else
-       return talloc_asprintf(mem_ctx,
-                       "%d",
-                       (int)pid->pid);
-#endif
 }
 
 char *procid_str_static(const struct server_id *pid)
@@ -2680,11 +2660,7 @@ bool procid_valid(const struct server_id *pid)
 
 bool procid_is_local(const struct server_id *pid)
 {
-#ifdef CLUSTER_SUPPORT
        return pid->vnn == my_vnn;
-#else
-       return True;
-#endif
 }
 
 /****************************************************************
index a2ba0109aef93e1e2ec8169274bb4ff150f4f975..4e5237e61f2b202471e3a9bccf506afa1c914c12 100644 (file)
@@ -887,9 +887,7 @@ void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e)
        SIVAL(msg,OP_BREAK_MSG_UID_OFFSET,e->uid);
        SSVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET,e->flags);
        SIVAL(msg,OP_BREAK_MSG_NAME_HASH_OFFSET,e->name_hash);
-#ifdef CLUSTER_SUPPORT
        SIVAL(msg,OP_BREAK_MSG_VNN_OFFSET,e->pid.vnn);
-#endif
 }
 
 /****************************************************************************
@@ -911,9 +909,7 @@ void message_to_share_mode_entry(struct share_mode_entry *e, char *msg)
        e->uid = (uint32)IVAL(msg,OP_BREAK_MSG_UID_OFFSET);
        e->flags = (uint16)SVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET);
        e->name_hash = IVAL(msg,OP_BREAK_MSG_NAME_HASH_OFFSET);
-#ifdef CLUSTER_SUPPORT
        e->pid.vnn = IVAL(msg,OP_BREAK_MSG_VNN_OFFSET);
-#endif
 }
 
 /****************************************************************************
index 0561b8447442a71e89df200b0e017d41c418919a..ab4da1d26bcd35f9a07472aaa9d42bb83699f405 100644 (file)
@@ -44,11 +44,9 @@ static int net_serverid_wipe_fn(struct db_record *rec,
 {
        NTSTATUS status;
 
-#ifdef CLUSTER_SUPPORT
        if (id->vnn != get_my_vnn()) {
                return 0;
        }
-#endif
        status = rec->delete_rec(rec);
        if (!NT_STATUS_IS_OK(status)) {
                char *str = procid_str(talloc_tos(), id);