mantis 1606
authorChristian Grothoff <christian@grothoff.org>
Thu, 23 Sep 2010 07:49:34 +0000 (07:49 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 23 Sep 2010 07:49:34 +0000 (07:49 +0000)
src/monkey/gdbmi_connect.c
src/transport/plugin_transport_tcp.c
src/transport/plugin_transport_udp.c
src/transport/test_transport_api.c
src/util/os_installation.c
src/vpn/gnunet-vpn-pretty-print.c

index a39fdf27f4e4beb3677055cf9c40aae72107d671..501d1f0645f3a8921cb1ee0a9adeb451c53a99de 100644 (file)
@@ -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;
index 47ef1a91f7ff6e7c5bb48e7fb4106d7b585cff20..2b4553930592585d7fda3921c9f09577b2029978 100644 (file)
@@ -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
index 3f2b83b05aabd8f6b4842844e69959f329022684..b5beb157f011539f8f7d730a63d8ff85cff4a526 100644 (file)
@@ -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
 }
 
 /**
index 671e28bfcdf045e9ad600325911be26e6412b444..bf574ab04d815febe7fbadf9a1752c3ca0d707c1 100644 (file)
@@ -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");
index ce8d0aac79405baca4ae4e32f0e3ca37769a3e15..cbbc614334bf38762fffdf4c0386d83d7673d746 100644 (file)
@@ -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");
index da95af4e937738e2d9b1dd00911853affe1eaba9..577db50982b47de719ff61a357505add34f47559 100644 (file)
@@ -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