/[path-sandbox]/trunk/src/libsandbox.c
Gentoo

Diff of /trunk/src/libsandbox.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 188 Revision 189
77#endif 77#endif
78 78
79#undef open 79#undef open
80#undef open64 80#undef open64
81 81
82//#include "localdecls.h"
83#include "sandbox.h" 82#include "sandbox.h"
84 83
85/* Macros to check if a function should be executed */ 84/* Macros to check if a function should be executed */
86#define FUNCTION_SANDBOX_SAFE(_func, _path) \ 85#define FUNCTION_SANDBOX_SAFE(_func, _path) \
87 ((0 == is_sandbox_on()) || (1 == before_syscall(_func, _path))) 86 ((0 == is_sandbox_on()) || (1 == before_syscall(_func, _path)))
127static int sb_path_size_warning = 0; 126static int sb_path_size_warning = 0;
128 127
129void __attribute__ ((constructor)) libsb_init(void); 128void __attribute__ ((constructor)) libsb_init(void);
130void __attribute__ ((destructor)) libsb_fini(void); 129void __attribute__ ((destructor)) libsb_fini(void);
131 130
132/* glibc modified realpath() functions */ 131/* glibc modified realpath() function */
133static char *erealpath(const char *, char *); 132extern char *erealpath(const char *, char *);
134/* glibc modified getcwd() functions */
135static char *egetcwd(char *, size_t); 133extern char *egetcwd(char *, size_t);
136 134
137static void *get_dlsym(const char *, const char *); 135static void *get_dlsym(const char *, const char *);
138static int canonicalize(const char *, char *); 136static int canonicalize(const char *, char *);
139static char *filter_path(const char *, int); 137static char *filter_path(const char *, int);
140static int check_prefixes(char **, int, const char *); 138static int check_prefixes(char **, int, const char *);
377} 375}
378 376
379#define creat_decl(_name) \ 377#define creat_decl(_name) \
380\ 378\
381extern int _name(const char *, mode_t); \ 379extern int _name(const char *, mode_t); \
382static int (*true_ ## _name) (const char *, mode_t) = NULL; \ 380/* static int (*true_ ## _name) (const char *, mode_t) = NULL; */ \
383\ 381\
384int _name(const char *pathname, mode_t mode) \ 382int _name(const char *pathname, mode_t mode) \
385{ \ 383{ \
386 int result = -1; \ 384 int result = -1; \
387\ 385\
664} 662}
665 663
666#define creat64_decl(_name) \ 664#define creat64_decl(_name) \
667\ 665\
668extern int _name(const char *, __mode_t); \ 666extern int _name(const char *, __mode_t); \
669static int (*true_ ## _name) (const char *, __mode_t) = NULL; \ 667/* static int (*true_ ## _name) (const char *, __mode_t) = NULL; */ \
670\ 668\
671int _name(const char *pathname, __mode_t mode) \ 669int _name(const char *pathname, __mode_t mode) \
672{ \ 670{ \
673 int result = -1; \ 671 int result = -1; \
674\ 672\
1456 } else { 1454 } else {
1457 return before_syscall("open_wr", file); 1455 return before_syscall("open_wr", file);
1458 } 1456 }
1459} 1457}
1460 1458
1461#include "getcwd.c"
1462#include "canonicalize.c"
1463#include "sandbox_futils.c"
1464 1459
1465// vim:noexpandtab noai:cindent ai 1460// vim:noexpandtab noai:cindent ai

Legend:
Removed from v.188  
changed lines
  Added in v.189

  ViewVC Help
Powered by ViewVC 1.1.20