aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-09-23 07:49:34 +0000
committerChristian Grothoff <christian@grothoff.org>2010-09-23 07:49:34 +0000
commit2ab3c347974b33e0715ce1fad0f42d4846da3aee (patch)
tree01ab192b63c4ecce1fdcc3449dd2bc71bf574307 /src/transport/plugin_transport_udp.c
parent956380b60d975e1a86784dae08555d6acdedb3b2 (diff)
downloadgnunet-2ab3c347974b33e0715ce1fad0f42d4846da3aee.tar.gz
gnunet-2ab3c347974b33e0715ce1fad0f42d4846da3aee.zip
mantis 1606
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 3f2b83b05..b5beb157f 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)
1999 buf = GNUNET_malloc (strlen (path) + 20); 1999 buf = GNUNET_malloc (strlen (path) + 20);
2000 pos = path; 2000 pos = path;
2001 2001
2002 while (NULL != (end = strchr (pos, ':'))) 2002 while (NULL != (end = strchr (pos, PATH_SEPARATOR)))
2003 { 2003 {
2004 *end = '\0'; 2004 *end = '\0';
2005 sprintf (buf, "%s/%s", pos, binary); 2005 sprintf (buf, "%s/%s", pos, binary);
@@ -2033,8 +2033,18 @@ check_gnunet_nat_binary(char *binary)
2033{ 2033{
2034 struct stat statbuf; 2034 struct stat statbuf;
2035 char *p; 2035 char *p;
2036#ifdef MINGW
2037 SOCKET rawsock;
2038#endif
2036 2039
2040#ifdef MINGW
2041 char *binaryexe;
2042 GNUNET_asprintf (&binaryexe, "%s.exe", binary);
2043 p = get_path_from_PATH (binaryexe);
2044 free (binaryexe);
2045#else
2037 p = get_path_from_PATH (binary); 2046 p = get_path_from_PATH (binary);
2047#endif
2038 if (p == NULL) 2048 if (p == NULL)
2039 return GNUNET_NO; 2049 return GNUNET_NO;
2040 if (0 != STAT (p, &statbuf)) 2050 if (0 != STAT (p, &statbuf))
@@ -2043,10 +2053,22 @@ check_gnunet_nat_binary(char *binary)
2043 return GNUNET_SYSERR; 2053 return GNUNET_SYSERR;
2044 } 2054 }
2045 GNUNET_free (p); 2055 GNUNET_free (p);
2056#ifndef MINGW
2046 if ( (0 != (statbuf.st_mode & S_ISUID)) && 2057 if ( (0 != (statbuf.st_mode & S_ISUID)) &&
2047 (statbuf.st_uid == 0) ) 2058 (statbuf.st_uid == 0) )
2048 return GNUNET_YES; 2059 return GNUNET_YES;
2049 return GNUNET_NO; 2060 return GNUNET_NO;
2061#else
2062 rawsock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP);
2063 if (INVALID_SOCKET == rawsock)
2064 {
2065 DWORD err = GetLastError ();
2066 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) have failed! GLE = %d\n", err);
2067 return GNUNET_NO; /* not running as administrator */
2068 }
2069 closesocket (rawsock);
2070 return GNUNET_YES;
2071#endif
2050} 2072}
2051 2073
2052/** 2074/**