summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2017-08-29 13:31:07 +0200
committerVolker Lendecke <vl@samba.org>2017-09-26 13:47:31 +0200
commit61de349673809b17e680496b616bc432bf0823b0 (patch)
tree8d8f0c42c5e495f52e94475b9b109a1a23a4a542
parentf059585fe61e33ce2dd518464829c183de874d8a (diff)
downloadsamba-61de349673809b17e680496b616bc432bf0823b0.tar.gz
lib: Use CTDB_CONTROL_CHECK_PID_SRVID
Also check the unique ID for remote server ids, just like we do for local server ids Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Sep 26 13:47:31 CEST 2017 on sn-devel-144
-rw-r--r--source3/lib/ctdbd_conn.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 2a7fd444b77..521e0168ca3 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -784,12 +784,27 @@ static int ctdbd_control(struct ctdbd_connection *conn,
bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
pid_t pid, uint64_t unique_id)
{
+ uint8_t buf[sizeof(pid)+sizeof(unique_id)];
int32_t cstatus = 0;
int ret;
- ret = ctdbd_control(conn, vnn, CTDB_CONTROL_PROCESS_EXISTS, 0, 0,
- (TDB_DATA) { .dptr = (uint8_t *)&pid,
- .dsize = sizeof(pid) },
+ if (unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+ ret = ctdbd_control(conn, vnn, CTDB_CONTROL_PROCESS_EXISTS,
+ 0, 0,
+ (TDB_DATA) { .dptr = (uint8_t *)&pid,
+ .dsize = sizeof(pid) },
+ NULL, NULL, &cstatus);
+ if (ret != 0) {
+ return false;
+ }
+ return (cstatus == 0);
+ }
+
+ memcpy(buf, &pid, sizeof(pid));
+ memcpy(buf+sizeof(pid), &unique_id, sizeof(unique_id));
+
+ ret = ctdbd_control(conn, vnn, CTDB_CONTROL_CHECK_PID_SRVID, 0, 0,
+ (TDB_DATA) { .dptr = buf, .dsize = sizeof(buf) },
NULL, NULL, &cstatus);
if (ret != 0) {
return false;