gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13072 - in gnunet/src: monkey transport util vpn


From: gnunet
Subject: [GNUnet-SVN] r13072 - in gnunet/src: monkey transport util vpn
Date: Thu, 23 Sep 2010 09:49:34 +0200

Author: grothoff
Date: 2010-09-23 09:49:34 +0200 (Thu, 23 Sep 2010)
New Revision: 13072

Modified:
   gnunet/src/monkey/gdbmi_connect.c
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/test_transport_api.c
   gnunet/src/util/os_installation.c
   gnunet/src/vpn/gnunet-vpn-pretty-print.c
Log:
mantis 1606

Modified: gnunet/src/monkey/gdbmi_connect.c
===================================================================
--- gnunet/src/monkey/gdbmi_connect.c   2010-09-23 07:45:12 UTC (rev 13071)
+++ gnunet/src/monkey/gdbmi_connect.c   2010-09-23 07:49:34 UTC (rev 13072)
@@ -626,7 +626,7 @@
  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 @@
        free(pt);
        return strdup(test);
       }
-    r=strtok(NULL,":");
+    r=strtok(NULL,PATH_SEPARATOR_STR);
    }
  free(pt);
  return NULL;

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-09-23 07:45:12 UTC (rev 
13071)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-09-23 07:49:34 UTC (rev 
13072)
@@ -2238,28 +2238,36 @@
 
   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 @@
   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 @@
 #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

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2010-09-23 07:45:12 UTC (rev 
13071)
+++ gnunet/src/transport/plugin_transport_udp.c 2010-09-23 07:49:34 UTC (rev 
13072)
@@ -1999,7 +1999,7 @@
   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 @@
 {
   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 @@
       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
 }
 
 /**

Modified: gnunet/src/transport/test_transport_api.c
===================================================================
--- gnunet/src/transport/test_transport_api.c   2010-09-23 07:45:12 UTC (rev 
13071)
+++ gnunet/src/transport/test_transport_api.c   2010-09-23 07:49:34 UTC (rev 
13072)
@@ -470,7 +470,7 @@
   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");

Modified: gnunet/src/util/os_installation.c
===================================================================
--- gnunet/src/util/os_installation.c   2010-09-23 07:45:12 UTC (rev 13071)
+++ gnunet/src/util/os_installation.c   2010-09-23 07:49:34 UTC (rev 13072)
@@ -209,7 +209,7 @@
   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");

Modified: gnunet/src/vpn/gnunet-vpn-pretty-print.c
===================================================================
--- gnunet/src/vpn/gnunet-vpn-pretty-print.c    2010-09-23 07:45:12 UTC (rev 
13071)
+++ gnunet/src/vpn/gnunet-vpn-pretty-print.c    2010-09-23 07:49:34 UTC (rev 
13072)
@@ -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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]