no SUID on W32
authorChristian Grothoff <christian@grothoff.org>
Tue, 21 Sep 2010 07:45:55 +0000 (07:45 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 21 Sep 2010 07:45:55 +0000 (07:45 +0000)
src/transport/plugin_transport_tcp.c

index 91ba644ec16ce8b419266b1ce300e236dc555cdb..47ef1a91f7ff6e7c5bb48e7fb4106d7b585cff20 100644 (file)
@@ -2277,6 +2277,9 @@ check_gnunet_nat_binary(char *binary)
 {
   struct stat statbuf;
   char *p;
+#ifdef MINGW
+  SOCKET rawsock;
+#endif
 
   p = get_path_from_PATH (binary);
   if (p == NULL)
@@ -2287,10 +2290,18 @@ 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)
+    return GNUNET_NO; /* not running as administrator */
+  closesocket (rawsock);
+  return GNUNET_YES;
+#endif
 }
 
 /**