summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/raw/clisocket.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index 78d37b9be1..b09bebf133 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -62,8 +62,15 @@ BOOL smbcli_sock_connect(struct smbcli_socket *sock, struct in_addr *ip, int por
}
if (port == 0) {
- return smbcli_sock_connect(sock, ip, 445) ||
- smbcli_sock_connect(sock, ip, 139);
+ int i;
+ const char **ports = lp_smb_ports();
+ for (i=0;ports[i];i++) {
+ int port = atoi(ports[i]);
+ if (port != 0 && smbcli_sock_connect(sock, ip, port)) {
+ return True;
+ }
+ }
+ return False;
}
sock->dest_ip = *ip;