int num_interfaces = iface_count();
int i;
char *ports;
+ char *tok;
+ const char *ptr;
unsigned dns_port = 0;
#ifdef HAVE_ATEXIT
ports = talloc_strdup(talloc_tos(), smb_ports);
}
+ for (ptr = ports;
+ next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) {
+ unsigned port = atoi(tok);
+
+ if (port == 0 || port > 0xffff) {
+ exit_server_cleanly("Invalid port in the config or on "
+ "the commandline specified!");
+ }
+ }
+
if (lp_interfaces() && lp_bind_interfaces_only()) {
/* We have been given an interfaces line, and been
told to only bind to those interfaces. Create a
for(i = 0; i < num_interfaces; i++) {
const struct sockaddr_storage *ifss =
iface_n_sockaddr_storage(i);
- char *tok;
- const char *ptr;
if (ifss == NULL) {
DEBUG(0,("open_sockets_smbd: "
for (ptr=ports;
next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) {
unsigned port = atoi(tok);
- if (port == 0 || port > 0xffff) {
- continue;
- }
/* Keep the first port for mDNS service
* registration.
/* Just bind to 0.0.0.0 - accept connections
from anywhere. */
- char *tok;
- const char *ptr;
const char *sock_addr = lp_socket_address();
char *sock_tok;
const char *sock_ptr;
next_token_talloc(talloc_tos(), &sock_ptr, &sock_tok, " \t,"); ) {
for (ptr=ports; next_token_talloc(talloc_tos(), &ptr, &tok, " \t,"); ) {
struct sockaddr_storage ss;
-
unsigned port = atoi(tok);
- if (port == 0 || port > 0xffff) {
- continue;
- }
/* Keep the first port for mDNS service
* registration.