Don't force a .bat extension for scripts under Windows.
[tinc] / src / net_setup.c
index ee8296c..64d2515 100644 (file)
@@ -455,11 +455,7 @@ bool setup_myself_reloadable(void) {
 
        free(scriptextension);
        if(!get_config_string(lookup_config(config_tree, "ScriptsExtension"), &scriptextension))
-#ifdef HAVE_MINGW
-               scriptextension = xstrdup(".bat");
-#else
                scriptextension = xstrdup("");
-#endif
 
        get_config_string(lookup_config(config_tree, "Proxy"), &proxy);
        if(proxy) {
@@ -711,7 +707,12 @@ static bool setup_myself(void) {
        get_config_bool(lookup_config(config_tree, "TunnelServer"), &tunnelserver);
        strictsubnets |= tunnelserver;
 
-
+       if(get_config_int(lookup_config(config_tree, "MaxConnectionBurst"), &max_connection_burst)) {
+               if(max_connection_burst <= 0) {
+                       logger(DEBUG_ALWAYS, LOG_ERR, "MaxConnectionBurst cannot be negative!");
+                       return false;
+               }
+       }
 
        if(get_config_int(lookup_config(config_tree, "UDPRcvBuf"), &udp_rcvbuf)) {
                if(udp_rcvbuf <= 0) {
@@ -828,12 +829,11 @@ static bool setup_myself(void) {
                io_add(&device_io, handle_device_data, NULL, device_fd, IO_READ);
 
        /* Run tinc-up script to further initialize the tap interface */
-       char *envp[5];
+       char *envp[5] = {NULL};
        xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
        xasprintf(&envp[1], "DEVICE=%s", device ? : "");
        xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
        xasprintf(&envp[3], "NAME=%s", myself->name);
-       envp[4] = NULL;
 
        execute_script("tinc-up", envp);
 
@@ -846,37 +846,6 @@ static bool setup_myself(void) {
 
        /* Open sockets */
 
-#ifndef HAVE_MINGW
-       int unix_fd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if(unix_fd < 0) {
-               logger(DEBUG_ALWAYS, LOG_ERR, "Could not create UNIX socket: %s", sockstrerror(errno));
-               return false;
-       }
-
-       struct sockaddr_un sa;
-       sa.sun_family = AF_UNIX;
-       strncpy(sa.sun_path, unixsocketname, sizeof sa.sun_path);
-
-       if(connect(unix_fd, (struct sockaddr *)&sa, sizeof sa) >= 0) {
-               logger(DEBUG_ALWAYS, LOG_ERR, "UNIX socket %s is still in use!", unixsocketname);
-               return false;
-       }
-
-       unlink(unixsocketname);
-
-       if(bind(unix_fd, (struct sockaddr *)&sa, sizeof sa) < 0) {
-               logger(DEBUG_ALWAYS, LOG_ERR, "Could not bind UNIX socket to %s: %s", unixsocketname, sockstrerror(errno));
-               return false;
-       }
-
-       if(listen(unix_fd, 3) < 0) {
-               logger(DEBUG_ALWAYS, LOG_ERR, "Could not listen on UNIX socket %s: %s", unixsocketname, sockstrerror(errno));
-               return false;
-       }
-
-       io_add(&unix_socket, handle_new_unix_connection, &unix_socket, unix_fd, IO_READ);
-#endif
-
        if(!do_detach && getenv("LISTEN_FDS")) {
                sockaddr_t sa;
                socklen_t salen;
@@ -1060,17 +1029,11 @@ void close_network_connections(void) {
                close(listen_socket[i].udp.fd);
        }
 
-#ifndef HAVE_MINGW
-       io_del(&unix_socket);
-       close(unix_socket.fd);
-#endif
-
-       char *envp[5];
+       char *envp[5] = {NULL};
        xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
        xasprintf(&envp[1], "DEVICE=%s", device ? : "");
        xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
        xasprintf(&envp[3], "NAME=%s", myself->name);
-       envp[4] = NULL;
 
        exit_requests();
        exit_edges();