diff options
-rw-r--r-- | source4/libcli/raw/clisocket.c | 11 | ||||
-rw-r--r-- | source4/param/loadparm.c | 8 | ||||
-rw-r--r-- | source4/smb_server/smb_server.c | 9 |
3 files changed, 17 insertions, 11 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; diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index a0582b6f46..fa6a658e20 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -89,7 +89,7 @@ struct param_opt { */ typedef struct { - char *smb_ports; + char **smb_ports; char *dos_charset; char *unix_charset; char *display_charset; @@ -633,7 +633,7 @@ static struct parm_struct parm_table[] = { {"Protocol Options", P_SEP, P_SEPARATOR}, - {"smb ports", P_STRING, P_GLOBAL, &Globals.smb_ports, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, + {"smb ports", P_LIST, P_GLOBAL, &Globals.smb_ports, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, {"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_DEVELOPER}, {"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_DEVELOPER}, {"min protocol", P_ENUM, P_GLOBAL, &Globals.minprotocol, NULL, enum_protocol, FLAG_DEVELOPER}, @@ -1112,7 +1112,7 @@ static void init_globals(void) Globals.client_signing = SMB_SIGNING_SUPPORTED; Globals.server_signing = SMB_SIGNING_SUPPORTED; - string_set(&Globals.smb_ports, SMB_PORTS); + Globals.smb_ports = str_list_make(SMB_PORTS, NULL); } static TALLOC_CTX *lp_talloc; @@ -1207,7 +1207,7 @@ static const char *lp_string(const char *s) #define FN_LOCAL_INTEGER(fn_name,val) \ int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} -FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports) +FN_GLOBAL_LIST(lp_smb_ports, &Globals.smb_ports) FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset) FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset) FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset) diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index f679a65287..513011216f 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -681,12 +681,11 @@ static void add_socket(struct server_service *service, struct in_addr *ifip) { char *ptr, *tok; - const char *delim = ", "; + char **ports = lp_smb_ports(); + int i; - for (tok=strtok_r(lp_smb_ports(), delim, &ptr); - tok; - tok=strtok_r(NULL, delim, &ptr)) { - uint16_t port = atoi(tok); + for (i=0;ports[i];i++) { + uint16_t port = atoi(ports[i]); if (port == 0) continue; service_setup_socket(service, model_ops, socket_ctx, ifip, &port); } |