]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: skip ctdb public ips in fsctl_network_iface_info()
authorStefan Metzmacher <metze@samba.org>
Thu, 25 Jun 2020 13:32:11 +0000 (15:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 8 Jul 2020 17:16:40 +0000 (17:16 +0000)
Multi-Channel clients should not connect to ctdb public ip addresses
(which move between nodes).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11898

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jul  8 17:16:40 UTC 2020 on sn-devel-184

source3/smbd/smb2_ioctl_network_fs.c

index 8154fa3f92ed2ea7986bdf0642b1422743b2724a..f202cddd29c52154894b7e567556e245f0132295 100644 (file)
@@ -30,6 +30,8 @@
 #include "librpc/gen_ndr/ndr_ioctl.h"
 #include "smb2_ioctl_private.h"
 #include "../lib/tsocket/tsocket.h"
+#include "lib/messages_ctdb.h"
+#include "ctdbd_conn.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_SMB2
@@ -302,6 +304,7 @@ static NTSTATUS fsctl_network_iface_info(TALLOC_CTX *mem_ctx,
        size_t i;
        size_t num_ifaces = iface_count();
        enum ndr_err_code ndr_err;
+       struct ctdb_public_ip_list_old *ips = NULL;
 
        if (in_input->length != 0) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -309,6 +312,18 @@ static NTSTATUS fsctl_network_iface_info(TALLOC_CTX *mem_ctx,
 
        *out_output = data_blob_null;
 
+       if (lp_clustering()) {
+               int ret;
+
+               ret = ctdbd_control_get_public_ips(messaging_ctdb_connection(),
+                                                  0, /* flags */
+                                                  mem_ctx,
+                                                  &ips);
+               if (ret != 0) {
+                       return NT_STATUS_INTERNAL_ERROR;
+               }
+       }
+
        array = talloc_zero_array(mem_ctx,
                                  struct fsctl_net_iface_info,
                                  num_ifaces);
@@ -345,6 +360,19 @@ static NTSTATUS fsctl_network_iface_info(TALLOC_CTX *mem_ctx,
                        return NT_STATUS_NO_MEMORY;
                }
 
+               if (ips != NULL) {
+                       bool is_public_ip;
+
+                       is_public_ip = ctdbd_find_in_public_ips(ips, ifss);
+                       if (is_public_ip) {
+                               DBG_DEBUG("Interface [%s] - "
+                                         "has public ip - "
+                                         "skipping address [%s].\n",
+                                         iface->name, addr);
+                               continue;
+                       }
+               }
+
                cur->ifindex = iface->if_index;
                if (cur->ifindex == 0) {
                        /*