*/
#include "includes.h"
+#include "system/filesys.h"
#include "serverid.h"
#include "dbwrap.h"
struct serverid_key {
pid_t pid;
-#ifdef CLUSTER_SUPPORT
uint32_t vnn;
-#endif
};
struct serverid_data {
*/
db = tdb_wrap_open(mem_ctx, lock_path("serverid.tdb"),
- 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT,
+ 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT,
0644);
if (db == NULL) {
DEBUG(1, ("could not open serverid.tdb: %s\n",
return db;
}
db = db_open(NULL, lock_path("serverid.tdb"), 0,
- TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0644);
+ TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644);
return db;
}
{
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)
struct serverid_key key;
TDB_DATA tdbkey;
+ if (lp_clustering() && !process_exists(*id)) {
+ return false;
+ }
+
db = serverid_db();
if (db == NULL) {
return false;
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;