lib: Remove temporary ctdb_connection in ctdb_control
authorVolker Lendecke <vl@samba.org>
Fri, 25 Sep 2015 21:39:41 +0000 (14:39 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 2 Oct 2015 22:01:11 +0000 (00:01 +0200)
I can just assume this is a bad hack for a condition that should have been
fixed in a different way. Today we pretty much expect a messaging_context to be
properly initialized everywhere, and this includes a ctdb connection.

If something later fails due to this commit, we need to do a
messaging_init before the offending call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/ctdbd_conn.c

index 07d1282dc31c16961e8ab713bceb20fbe522251f..a690a5554a63799945b61ef8d8f493445c6e5dab 100644 (file)
@@ -646,24 +646,11 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
        struct ctdb_req_control req;
        struct ctdb_req_header *hdr;
        struct ctdb_reply_control *reply = NULL;
-       struct ctdbd_connection *new_conn = NULL;
        struct iovec iov[2];
        ssize_t nwritten;
        NTSTATUS status;
        int ret;
 
-       if (conn == NULL) {
-               status = ctdbd_init_connection(NULL, &new_conn);
-
-               if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(10, ("Could not init temp connection: %s\n",
-                                  nt_errstr(status)));
-                       goto fail;
-               }
-
-               conn = new_conn;
-       }
-
        ZERO_STRUCT(req);
        req.hdr.length = offsetof(struct ctdb_req_control, data) + data.dsize;
        req.hdr.ctdb_magic   = CTDB_MAGIC;
@@ -691,7 +678,6 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
        }
 
        if (flags & CTDB_CTRL_FLAG_NOREPLY) {
-               TALLOC_FREE(new_conn);
                if (cstatus) {
                        *cstatus = 0;
                }
@@ -726,7 +712,6 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
        status = NT_STATUS_OK;
 
  fail:
-       TALLOC_FREE(new_conn);
        TALLOC_FREE(reply);
        return status;
 }