s3: server_id.pid has turned 64 (bits, that is)
authorVolker Lendecke <vl@samba.org>
Thu, 10 Nov 2011 16:17:20 +0000 (17:17 +0100)
committerVolker Lendecke <vlendec@samba.org>
Thu, 10 Nov 2011 17:57:01 +0000 (18:57 +0100)
Fix ctdb_processes_exist protocol. The socket expects pid_t which is 32 bits on
32 bit machines.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Nov 10 18:57:01 CET 2011 on sn-devel-104

source3/lib/ctdbd_conn.c

index 5c3b7c1f4f6221e730f47205e62b73fec1708a3e..e0bdbd05a5f0bff8abb0a82b5908084db6828450 100644 (file)
@@ -938,18 +938,25 @@ bool ctdb_processes_exist(struct ctdbd_connection *conn,
 
        for (i=0; i<num_pids; i++) {
                struct ctdb_req_control req;
+               pid_t pid;
 
                results[i] = false;
                reqids[i] = ctdbd_next_reqid(conn);
 
                ZERO_STRUCT(req);
 
+               /*
+                * pids[i].pid is uint64_t, scale down to pid_t which
+                * is the wire protocol towards ctdb.
+                */
+               pid = pids[i].pid;
+
                DEBUG(10, ("Requesting PID %d/%d, reqid=%d\n",
-                          (int)pids[i].vnn, (int)pids[i].pid,
+                          (int)pids[i].vnn, (int)pid,
                           (int)reqids[i]));
 
                req.hdr.length = offsetof(struct ctdb_req_control, data);
-               req.hdr.length += sizeof(pid_t);
+               req.hdr.length += sizeof(pid);
                req.hdr.ctdb_magic   = CTDB_MAGIC;
                req.hdr.ctdb_version = CTDB_VERSION;
                req.hdr.operation    = CTDB_REQ_CONTROL;
@@ -957,7 +964,7 @@ bool ctdb_processes_exist(struct ctdbd_connection *conn,
                req.hdr.destnode     = pids[i].vnn;
                req.opcode           = CTDB_CONTROL_PROCESS_EXISTS;
                req.srvid            = 0;
-               req.datalen          = sizeof(pids[i].pid);
+               req.datalen          = sizeof(pid);
                req.flags            = 0;
 
                DEBUG(10, ("ctdbd_control: Sending ctdb packet\n"));
@@ -967,7 +974,7 @@ bool ctdb_processes_exist(struct ctdbd_connection *conn,
                        conn->pkt, 2,
                        data_blob_const(
                                &req, offsetof(struct ctdb_req_control, data)),
-                       data_blob_const(&pids[i].pid, sizeof(pids[i].pid)));
+                       data_blob_const(&pid, sizeof(pid)));
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(10, ("ctdb_packet_send failed: %s\n",
                                   nt_errstr(status)));