s3:serverid: don't ignore the result of dbwrap_parse_record()
[ddiss/samba.git] / source3 / lib / serverid.c
index 48d5b4251a18d842ca2d14c20d5457c4bbdc15a0..4e3175662030b314b5e10eacc99884bfd5b4c661 100644 (file)
@@ -311,6 +311,7 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
                struct serverid_exists_state state;
                struct serverid_key key;
                TDB_DATA tdbkey;
+               NTSTATUS status;
 
                if (ids[i].unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
                        results[i] = true;
@@ -325,7 +326,11 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
 
                state.id = &ids[i];
                state.exists = false;
-               dbwrap_parse_record(db, tdbkey, server_exists_parse, &state);
+               status = dbwrap_parse_record(db, tdbkey, server_exists_parse, &state);
+               if (!NT_STATUS_IS_OK(status)) {
+                       results[i] = false;
+                       continue;
+               }
                results[i] = state.exists;
        }
        return true;
@@ -453,3 +458,24 @@ uint64_t serverid_get_random_unique_id(void)
 
        return unique_id;
 }
+
+bool serverid_equal(const struct server_id *p1, const struct server_id *p2)
+{
+       if (p1->pid != p2->pid) {
+               return false;
+       }
+
+       if (p1->task_id != p2->task_id) {
+               return false;
+       }
+
+       if (p1->vnn != p2->vnn) {
+               return false;
+       }
+
+       if (p1->unique_id != p2->unique_id) {
+               return false;
+       }
+
+       return true;
+}