summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-22 12:48:09 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-22 17:06:07 +0200
commit5bd80b20a1e7d2ad2cd5c426f3729ed0ba96cbb1 (patch)
treefbd9426ef58c32497ab956a910a2ff15b6d3a3ce /source3
parentefbe1602bd014eada4811f336bdccbf4692d3807 (diff)
downloadsamba-5bd80b20a1e7d2ad2cd5c426f3729ed0ba96cbb1.tar.gz
samba-5bd80b20a1e7d2ad2cd5c426f3729ed0ba96cbb1.tar.bz2
samba-5bd80b20a1e7d2ad2cd5c426f3729ed0ba96cbb1.zip
s3:smbtree: try to fix completely broken logic in get_workgroups()
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/smbtree.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 41f4103e5a..e1836ab4d7 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -95,24 +95,32 @@ static bool get_workgroups(struct user_auth_info *user_info)
return false;
}
- if (!use_bcast && !find_master_ip(lp_workgroup(), &server_ss)) {
- DEBUG(4, ("Unable to find master browser for workgroup %s, falling back to broadcast\n",
- master_workgroup));
- use_bcast = True;
- } else if(!use_bcast) {
- char addr[INET6_ADDRSTRLEN];
- print_sockaddr(addr, sizeof(addr), &server_ss);
- if (!(cli = get_ipc_connect(addr, &server_ss, user_info)))
- return False;
- }
+ if (!use_bcast && !find_master_ip(lp_workgroup(), &server_ss)) {
+ DEBUG(4,("Unable to find master browser for workgroup %s, "
+ "falling back to broadcast\n",
+ master_workgroup));
+ use_bcast = true;
+ }
+
+ if (!use_bcast) {
+ char addr[INET6_ADDRSTRLEN];
+
+ print_sockaddr(addr, sizeof(addr), &server_ss);
- if (!(cli = get_ipc_connect_master_ip_bcast(talloc_tos(),
- user_info,
- &master_workgroup))) {
+ cli = get_ipc_connect(addr, &server_ss, user_info);
+ if (cli == NULL) {
+ return false;
+ }
+ } else {
+ cli = get_ipc_connect_master_ip_bcast(talloc_tos(),
+ user_info,
+ &master_workgroup);
+ if (cli == NULL) {
DEBUG(4, ("Unable to find master browser by "
"broadcast\n"));
- return False;
- }
+ return false;
+ }
+ }
if (!cli_NetServerEnum(cli, master_workgroup,
SV_TYPE_DOMAIN_ENUM, add_name, &workgroups))