mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
r1819: changed "smb ports" to be a LIST parameter type in loadparm (its a classic case for a list)
This commit is contained in:
parent
ec41c73ae1
commit
e53d32c65a
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user