added -b option
authorAndrew Tridgell <tridge@samba.org>
Mon, 20 Aug 2001 17:38:37 +0000 (17:38 +0000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 20 Aug 2001 17:38:37 +0000 (17:38 +0000)
(This used to be commit 1c2618df450ddde7e52ab8784fcdd2b64a85771e)

source3/utils/smbtree.c

index f3d3d2ae312da8a1b926bd78a643215661866bbf..0f824f7ecf3b429f3ce494d90ebc6685df1e7f11 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "includes.h"
 
+static BOOL use_bcast;
+
 struct user_auth_info {
        pstring username;
        pstring password;
@@ -43,6 +45,7 @@ static void usage(void)
 \t-W workgroup            workgroup of user to authenticate as\n\
 \t-D                      list only domains (workgroups) of tree\n\
 \t-S                      list domains and servers of tree\n\
+\t-b                      use bcast instead of using the master browser\n\
 \n\
 The username can be of the form username%%password or\n\
 workgroup\\username%%password.\n\n\
@@ -211,7 +214,7 @@ static BOOL get_workgroups(struct user_auth_info *user_info)
 
        pstrcpy(master_workgroup, lp_workgroup());
 
-        if (!find_master_ip(lp_workgroup(), &server_ip)) {
+        if (use_bcast || !find_master_ip(lp_workgroup(), &server_ip)) {
                 DEBUG(4, ("Unable to find master browser for workgroup %s\n", 
                          master_workgroup));
                if (!find_master_ip_bcast(master_workgroup, &server_ip)) {
@@ -358,7 +361,7 @@ static BOOL print_tree(struct user_auth_info *user_info)
 
        /* Parse command line args */
 
-       while ((opt = getopt(argc, argv, "U:hd:W:DS")) != EOF) {
+       while ((opt = getopt(argc, argv, "U:hd:W:DSb")) != EOF) {
                switch (opt) {
                case 'U':
                        pstrcpy(user_info.username,optarg);
@@ -370,6 +373,10 @@ static BOOL print_tree(struct user_auth_info *user_info)
                        }
                        break;
 
+               case 'b':
+                       use_bcast = True;
+                       break;
+
                case 'h':
                        usage();
                        exit(1);