]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Changes as suggested by nickm
authorCristian Toader <cristian.matei.toader@gmail.com>
Mon, 29 Jul 2013 11:46:47 +0000 (14:46 +0300)
committerCristian Toader <cristian.matei.toader@gmail.com>
Mon, 29 Jul 2013 11:46:47 +0000 (14:46 +0300)
- char* to const char* and name refactoring
- workaround for accept4 syscall

src/common/compat.c
src/common/sandbox.c
src/common/sandbox.h

index 5b153674effe7fcf1ad9164d17035749ac0b6c49..47b65d35604ddb94d57b0b8f93ee5738d570a464 100644 (file)
@@ -125,7 +125,7 @@ tor_open_cloexec(const char *path, int flags, unsigned mode)
 {
   int fd;
 #ifdef O_CLOEXEC
-  path = get_prot_param(path);
+  path = sandbox_intern_string(path);
   fd = open(path, flags|O_CLOEXEC, mode);
   if (fd >= 0)
     return fd;
index 4a3faa47cd563377d7662c208c34641082001204..2e8467d7c1622287aae380ad0d0498c1a6fe8059 100644 (file)
@@ -49,6 +49,10 @@ static sandbox_static_cfg_t filter_static[] = {
 #endif
     {SCMP_SYS(rt_sigaction), PARAM_NUM, 0, (intptr_t)(SIGCHLD), 0},
     {SCMP_SYS(time), PARAM_NUM, 0, 0, 0},
+
+#ifdef __NR_socketcall
+    {SCMP_SYS(socketcall), PARAM_NUM, 0, 18, 0}, // accept4 workaround
+#endif
 };
 
 /** Variable used for storing all syscall numbers that will be allowed with the
@@ -136,7 +140,7 @@ static int filter_nopar_gen[] = {
     SCMP_SYS(exit),
 
     // socket syscalls
-    SCMP_SYS(accept4),
+//    SCMP_SYS(accept4),
     SCMP_SYS(bind),
     SCMP_SYS(connect),
     SCMP_SYS(getsockname),
@@ -149,17 +153,12 @@ static int filter_nopar_gen[] = {
     SCMP_SYS(setsockopt),
     SCMP_SYS(socket),
     SCMP_SYS(socketpair),
-
-#ifdef __NR_socketcall
-//    SCMP_SYS(socketcall),
-#endif
-
     SCMP_SYS(recvfrom),
     SCMP_SYS(unlink),
 };
 
-char*
-get_prot_param(char *param)
+const char*
+sandbox_intern_string(char *param)
 {
   int i, filter_size;
   sandbox_cfg_t *elem;
index c6d80659e398597018ff9b62659f1647dcc0ef24..9acf8c4a971faedf840e878c5be6dbde5dc60ece 100644 (file)
@@ -80,7 +80,7 @@ typedef struct pfd_elem sandbox_cfg_t;
 
 void sandbox_set_debugging_fd(int fd);
 int tor_global_sandbox(void);
-char* get_prot_param(char *param);
+const char* sandbox_intern_string(char *param);
 
 sandbox_cfg_t * sandbox_cfg_new();
 int sandbox_cfg_allow_open_filename(sandbox_cfg_t **cfg, char *file);