diff options
-rw-r--r-- | src/monkey/gdbmi_connect.c | 4 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 25 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 24 | ||||
-rw-r--r-- | src/transport/test_transport_api.c | 2 | ||||
-rw-r--r-- | src/util/os_installation.c | 2 | ||||
-rw-r--r-- | src/vpn/gnunet-vpn-pretty-print.c | 2 |
6 files changed, 52 insertions, 7 deletions
diff --git a/src/monkey/gdbmi_connect.c b/src/monkey/gdbmi_connect.c index a39fdf27f4..501d1f0645 100644 --- a/src/monkey/gdbmi_connect.c +++ b/src/monkey/gdbmi_connect.c @@ -626,7 +626,7 @@ char *mi_search_in_path(const char *file) if (!path) return NULL; pt=strdup(path); - r=strtok(pt,":"); + r=strtok(pt,PATH_SEPARATOR_STR); while (r) { strcpy(test,r); @@ -637,7 +637,7 @@ char *mi_search_in_path(const char *file) free(pt); return strdup(test); } - r=strtok(NULL,":"); + r=strtok(NULL,PATH_SEPARATOR_STR); } free(pt); return NULL; diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 47ef1a91f7..2b45539305 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -2238,28 +2238,36 @@ get_path_from_PATH (char *binary) p = getenv ("PATH"); if (p == NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "PATH is NULL, returning.\n"); return NULL; + } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "PATH is `%s', PATH_SEPARATOR is '%c'\n", p, PATH_SEPARATOR); path = GNUNET_strdup (p); /* because we write on it */ buf = GNUNET_malloc (strlen (path) + 20); pos = path; - while (NULL != (end = strchr (pos, ':'))) + while (NULL != (end = strchr (pos, PATH_SEPARATOR))) { *end = '\0'; sprintf (buf, "%s/%s", pos, binary); if (GNUNET_DISK_file_test (buf) == GNUNET_YES) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Check for `%s' have succeeded.\n", buf); GNUNET_free (path); return buf; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Check for `%s' have failed.\n", buf); pos = end + 1; } sprintf (buf, "%s/%s", pos, binary); if (GNUNET_DISK_file_test (buf) == GNUNET_YES) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Check for `%s' have succeeded.\n", buf); GNUNET_free (path); return buf; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Check for `%s' have failed.\n", buf); GNUNET_free (buf); GNUNET_free (path); return NULL; @@ -2281,11 +2289,22 @@ check_gnunet_nat_binary(char *binary) SOCKET rawsock; #endif +#ifdef MINGW + char *binaryexe; + GNUNET_asprintf (&binaryexe, "%s.exe", binary); + p = get_path_from_PATH (binaryexe); + free (binaryexe); +#else p = get_path_from_PATH (binary); +#endif if (p == NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "get_path_from_PATH (%s) have failed!\n", binary); return GNUNET_NO; + } if (0 != STAT (p, &statbuf)) { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "STAT (%s, &statbuf) have failed!\n", p); GNUNET_free (p); return GNUNET_SYSERR; } @@ -2298,7 +2317,11 @@ check_gnunet_nat_binary(char *binary) #else rawsock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); if (INVALID_SOCKET == rawsock) + { + DWORD err = GetLastError (); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) have failed! GLE = %d\n", err); return GNUNET_NO; /* not running as administrator */ + } closesocket (rawsock); return GNUNET_YES; #endif diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 3f2b83b05a..b5beb157f0 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -1999,7 +1999,7 @@ get_path_from_PATH (char *binary) buf = GNUNET_malloc (strlen (path) + 20); pos = path; - while (NULL != (end = strchr (pos, ':'))) + while (NULL != (end = strchr (pos, PATH_SEPARATOR))) { *end = '\0'; sprintf (buf, "%s/%s", pos, binary); @@ -2033,8 +2033,18 @@ check_gnunet_nat_binary(char *binary) { struct stat statbuf; char *p; +#ifdef MINGW + SOCKET rawsock; +#endif +#ifdef MINGW + char *binaryexe; + GNUNET_asprintf (&binaryexe, "%s.exe", binary); + p = get_path_from_PATH (binaryexe); + free (binaryexe); +#else p = get_path_from_PATH (binary); +#endif if (p == NULL) return GNUNET_NO; if (0 != STAT (p, &statbuf)) @@ -2043,10 +2053,22 @@ check_gnunet_nat_binary(char *binary) return GNUNET_SYSERR; } GNUNET_free (p); +#ifndef MINGW if ( (0 != (statbuf.st_mode & S_ISUID)) && (statbuf.st_uid == 0) ) return GNUNET_YES; return GNUNET_NO; +#else + rawsock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); + if (INVALID_SOCKET == rawsock) + { + DWORD err = GetLastError (); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) have failed! GLE = %d\n", err); + return GNUNET_NO; /* not running as administrator */ + } + closesocket (rawsock); + return GNUNET_YES; +#endif } /** diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 671e28bfcd..bf574ab04d 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -470,7 +470,7 @@ get_path_from_PATH () buf = GNUNET_malloc (strlen (path) + 20); pos = path; - while (NULL != (end = strchr (pos, ':'))) + while (NULL != (end = strchr (pos, PATH_SEPARATOR))) { *end = '\0'; sprintf (buf, "%s/%s", pos, "gnunet-nat-server"); diff --git a/src/util/os_installation.c b/src/util/os_installation.c index ce8d0aac79..cbbc614334 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c @@ -209,7 +209,7 @@ get_path_from_PATH () buf = GNUNET_malloc (strlen (path) + 20); pos = path; - while (NULL != (end = strchr (pos, ':'))) + while (NULL != (end = strchr (pos, PATH_SEPARATOR))) { *end = '\0'; sprintf (buf, "%s/%s", pos, "gnunet-arm"); diff --git a/src/vpn/gnunet-vpn-pretty-print.c b/src/vpn/gnunet-vpn-pretty-print.c index da95af4e93..577db50982 100644 --- a/src/vpn/gnunet-vpn-pretty-print.c +++ b/src/vpn/gnunet-vpn-pretty-print.c @@ -4,7 +4,7 @@ #include <ctype.h> #include <malloc.h> #ifndef _WIN32 - #include <arpa/inet.h> +#include <arpa/inet.h> #else #include <ws2tcpip.h> #endif |