summaryrefslogtreecommitdiff
path: root/src/common/sandbox.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-09-09 15:59:41 -0400
committerNick Mathewson <nickm@torproject.org>2013-09-09 15:59:41 -0400
commit49f9c4924e54b55c34050a2ce1053f7cd78eeaf5 (patch)
tree5c9fe9fc3c7eb80f4ac066af3a0190a4d4e5b649 /src/common/sandbox.c
parente9ec0cb5506b81f7f7c54e06a95dafac4acb38e3 (diff)
downloadtor-49f9c4924e54b55c34050a2ce1053f7cd78eeaf5.tar.gz
tor-49f9c4924e54b55c34050a2ce1053f7cd78eeaf5.zip
Fix compilation on OSX
Diffstat (limited to 'src/common/sandbox.c')
-rw-r--r--src/common/sandbox.c77
1 files changed, 70 insertions, 7 deletions
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index a5bc892973..0eb27bc510 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -26,10 +26,6 @@
#include "util.h"
#include "tor_queue.h"
-#if defined(HAVE_SECCOMP_H) && defined(__linux__)
-#define USE_LIBSECCOMP
-#endif
-
#define DEBUGGING_CLOSE
#if defined(USE_LIBSECCOMP)
@@ -1083,11 +1079,15 @@ sandbox_cfg_allow_execve_array(sandbox_cfg_t **cfg, ...)
}
int
-sandbox_getaddrinfo(const char *name, const struct addrinfo *hints,
- struct addrinfo **res)
+sandbox_getaddrinfo(const char *name, const char *servname,
+ const struct addrinfo *hints,
+ struct addrinfo **res)
{
sb_addr_info_t *el;
+ if (servname != NULL)
+ return -1;
+
*res = NULL;
for (el = sb_addr_info; el; el = el->next) {
@@ -1386,21 +1386,24 @@ sandbox_cfg_new(void)
}
int
-sandbox_init(sandbox_cfg_t* cfg)
+sandbox_init(sandbox_cfg_t *cfg)
{
#if defined(USE_LIBSECCOMP)
return initialise_libseccomp_sandbox(cfg);
#elif defined(_WIN32)
+ (void)cfg;
log_warn(LD_BUG,"Windows sandboxing is not implemented. The feature is "
"currently disabled.");
return 0;
#elif defined(TARGET_OS_MAC)
+ (void)cfg;
log_warn(LD_BUG,"Mac OSX sandboxing is not implemented. The feature is "
"currently disabled");
return 0;
#else
+ (void)cfg;
log_warn(LD_BUG,"Sandboxing is not implemented for your platform. The "
"feature is currently disabled");
return 0;
@@ -1417,3 +1420,63 @@ sandbox_set_debugging_fd(int fd)
#endif
}
+#ifndef USE_LIBSECCOMP
+int
+sandbox_cfg_allow_open_filename(sandbox_cfg_t **cfg, char *file,
+ int fr)
+{
+ (void)cfg; (void)file; (void)fr;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_open_filename_array(sandbox_cfg_t **cfg, ...)
+{
+ (void)cfg;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_openat_filename(sandbox_cfg_t **cfg, char *file,
+ int fr)
+{
+ (void)cfg; (void)file; (void)fr;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_openat_filename_array(sandbox_cfg_t **cfg, ...)
+{
+ (void)cfg;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_execve(sandbox_cfg_t **cfg, const char *com)
+{
+ (void)cfg; (void)com;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_execve_array(sandbox_cfg_t **cfg, ...)
+{
+ (void)cfg;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_stat_filename(sandbox_cfg_t **cfg, char *file,
+ int fr)
+{
+ (void)cfg; (void)file; (void)fr;
+ return 0;
+}
+
+int
+sandbox_cfg_allow_stat_filename_array(sandbox_cfg_t **cfg, ...)
+{
+ (void)cfg;
+ return 0;
+}
+#endif