]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Move get_ipc_connect_master_ip_bcast() to smbtree.c
authorVolker Lendecke <vl@samba.org>
Sun, 5 Apr 2020 11:01:07 +0000 (13:01 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 8 Apr 2020 14:46:40 +0000 (14:46 +0000)
... the only user

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/libsmb/cliconnect.c
source3/libsmb/proto.h
source3/utils/smbtree.c

index 13d035a8d41e0b8477620ed81b0f4280d1c7626d..b87287fa24d7ff0853d430553fc954fb90b8c715 100644 (file)
@@ -3873,45 +3873,3 @@ struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
 
        return cli;
 }
-
-/*
- * Return the IP address and workgroup of a master browser on the network, and
- * connect to it.
- */
-
-struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
-                                       const struct user_auth_info *user_info,
-                                       char **pp_workgroup_out)
-{
-       struct sockaddr_storage *ip_list;
-       struct cli_state *cli;
-       int i, count;
-       NTSTATUS status;
-
-       *pp_workgroup_out = NULL;
-
-        DEBUG(99, ("Do broadcast lookup for workgroups on local network\n"));
-
-        /* Go looking for workgroups by broadcasting on the local network */
-
-       status = name_resolve_bcast(MSBROWSE, 1, talloc_tos(),
-                                   &ip_list, &count);
-        if (!NT_STATUS_IS_OK(status)) {
-                DEBUG(99, ("No master browsers responded: %s\n",
-                          nt_errstr(status)));
-                return NULL;
-        }
-
-       for (i = 0; i < count; i++) {
-               char addr[INET6_ADDRSTRLEN];
-               print_sockaddr(addr, sizeof(addr), &ip_list[i]);
-               DEBUG(99, ("Found master browser %s\n", addr));
-
-               cli = get_ipc_connect_master_ip(ctx, &ip_list[i],
-                               user_info, pp_workgroup_out);
-               if (cli)
-                       return(cli);
-       }
-
-       return NULL;
-}
index 879a9dae8efee4f10cf8327f0c3110e262cc8246..b9764a4aae2096342c8a20e5ccae5106fd232294 100644 (file)
@@ -129,9 +129,6 @@ struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
                                struct sockaddr_storage *mb_ip,
                                const struct user_auth_info *user_info,
                                char **pp_workgroup_out);
-struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
-                                       const struct user_auth_info *user_info,
-                                       char **pp_workgroup_out);
 
 /* The following definitions come from libsmb/clidfs.c  */
 
index 626279a96fd75c89268c8295f69aef7a70874b04..123ae35d6630f03c354c0a29fd7446b2f1048ada 100644 (file)
@@ -27,6 +27,7 @@
 #include "libsmb/namequery.h"
 #include "libsmb/clirap.h"
 #include "../libcli/smb/smbXcli_base.h"
+#include "nameserv.h"
 
 static int use_bcast;
 
@@ -78,6 +79,50 @@ static void add_name(const char *machine_name, uint32_t server_type,
         DLIST_ADD(*name_list, new_name);
 }
 
+/*
+ * Return the IP address and workgroup of a master browser on the network, and
+ * connect to it.
+ */
+
+static struct cli_state *get_ipc_connect_master_ip_bcast(
+       TALLOC_CTX *ctx,
+       const struct user_auth_info *user_info,
+       char **pp_workgroup_out)
+{
+       struct sockaddr_storage *ip_list;
+       struct cli_state *cli;
+       int i, count;
+       NTSTATUS status;
+
+       *pp_workgroup_out = NULL;
+
+        DEBUG(99, ("Do broadcast lookup for workgroups on local network\n"));
+
+        /* Go looking for workgroups by broadcasting on the local network */
+
+       status = name_resolve_bcast(
+               MSBROWSE, 1, talloc_tos(), &ip_list, &count);
+        if (!NT_STATUS_IS_OK(status)) {
+                DEBUG(99, ("No master browsers responded: %s\n",
+                          nt_errstr(status)));
+                return NULL;
+        }
+
+       for (i = 0; i < count; i++) {
+               char addr[INET6_ADDRSTRLEN];
+               print_sockaddr(addr, sizeof(addr), &ip_list[i]);
+               DEBUG(99, ("Found master browser %s\n", addr));
+
+               cli = get_ipc_connect_master_ip(
+                       ctx, &ip_list[i], user_info, pp_workgroup_out);
+               if (cli != NULL) {
+                       return(cli);
+               }
+       }
+
+       return NULL;
+}
+
 /****************************************************************************
   display tree of smb workgroups, servers and shares
 ****************************************************************************/