aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/os_installation.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index d500580bf..b63a19d2e 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -38,8 +38,11 @@
38#if DARWIN 38#if DARWIN
39#include <mach-o/ldsyms.h> 39#include <mach-o/ldsyms.h>
40#include <mach-o/dyld.h> 40#include <mach-o/dyld.h>
41#elif WINDOWS
42#include <windows.h>
41#endif 43#endif
42 44
45
43#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) 46#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
44 47
45#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) 48#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
@@ -662,7 +665,6 @@ GNUNET_OS_check_helper_binary (const char *binary)
662 char *p; 665 char *p;
663 char *pf; 666 char *pf;
664#ifdef MINGW 667#ifdef MINGW
665 SOCKET rawsock;
666 char *binaryexe; 668 char *binaryexe;
667 669
668 GNUNET_asprintf (&binaryexe, "%s.exe", binary); 670 GNUNET_asprintf (&binaryexe, "%s.exe", binary);
@@ -730,33 +732,19 @@ GNUNET_OS_check_helper_binary (const char *binary)
730 return GNUNET_YES; 732 return GNUNET_YES;
731 } 733 }
732 /* binary exists, but not SUID */ 734 /* binary exists, but not SUID */
733 GNUNET_free (p);
734 return GNUNET_NO;
735#else 735#else
736 GNUNET_free (p); 736 return GNUNET_YES;
737 { 737 /* FIXME:
738 static int once; /* remember result from previous runs... */ 738 * no suid for windows possible!
739 739 * permissions-checking is too specific(as in non-portable)
740 if (0 == once) 740 * user/group checking is pointless (users/applications can drop privileges)
741 { 741 * using token checking for elevated permissions would limit gnunet
742 rawsock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); 742 * to run only on winserver 2008 and 2012!
743 if (INVALID_SOCKET == rawsock) 743 *
744 { 744 * thus, ad add "dryrun" checking */
745 DWORD err = GetLastError ();
746
747 LOG (GNUNET_ERROR_TYPE_DEBUG,
748 "socket (AF_INET, SOCK_RAW, IPPROTO_ICMP) failed! GLE = %d\n", err);
749 once = -1;
750 return GNUNET_NO; /* not running as administrator */
751 }
752 once = 1;
753 closesocket (rawsock);
754 }
755 if (-1 == once)
756 return GNUNET_NO;
757 return GNUNET_YES;
758 }
759#endif 745#endif
746 GNUNET_free (p);
747 return GNUNET_NO;
760} 748}
761 749
762 750