summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-02-15 11:22:45 +0100
committerJeremy Allison <jra@samba.org>2012-02-15 21:10:22 +0100
commitdd5868d41eeaa304a471822d7783526d9f4c37f5 (patch)
tree244604395cecaf711417fa641e654f126c225564 /source3/lib
parenta6bd7f3d574998419cac01b1f7b4fa2e1067bb7c (diff)
downloadsamba-dd5868d41eeaa304a471822d7783526d9f4c37f5.tar.gz
samba-dd5868d41eeaa304a471822d7783526d9f4c37f5.tar.bz2
samba-dd5868d41eeaa304a471822d7783526d9f4c37f5.zip
s3: Add SERVERID_UNIQUE_ID_NOT_TO_VERIFY, bug 8760
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 15 21:10:22 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/ctdbd_conn.c11
-rw-r--r--source3/lib/serverid.c20
2 files changed, 29 insertions, 2 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 12b736deb3..9c73002078 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "util_tdb.h"
+#include "serverid.h"
#ifdef CLUSTER_SUPPORT
@@ -1228,8 +1229,14 @@ bool ctdb_serverids_exist(struct ctdbd_connection *conn,
}
for (i=0; i<vnn->num_srvids; i++) {
- results[vnn->pid_indexes[i]] =
- ((reply->data[i/8] & (1<<(i%8))) != 0);
+ int idx = vnn->pid_indexes[i];
+
+ if (pids[i].unique_id ==
+ SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+ results[idx] = true;
+ continue;
+ }
+ results[idx] = ((reply->data[i/8] & (1<<(i%8))) != 0);
}
TALLOC_FREE(reply);
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index 6a8083a7a2..02de2b4f9c 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -265,6 +265,10 @@ bool serverid_exists(const struct server_id *id)
return false;
}
+ if (id->unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+ return true;
+ }
+
db = serverid_db();
if (db == NULL) {
return false;
@@ -308,6 +312,10 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
struct serverid_key key;
TDB_DATA tdbkey;
+ if (ids[i].unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+ results[i] = true;
+ continue;
+ }
if (!results[i]) {
continue;
}
@@ -433,3 +441,15 @@ bool serverid_traverse(int (*fn)(struct db_record *rec,
status = dbwrap_traverse(db, serverid_traverse_fn, &state, NULL);
return NT_STATUS_IS_OK(status);
}
+
+uint64_t serverid_get_random_unique_id(void)
+{
+ uint64_t unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY;
+
+ while (unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+ generate_random_buffer((uint8_t *)&unique_id,
+ sizeof(unique_id));
+ }
+
+ return unique_id;
+}