| … | |
… | |
| 10 | #ifndef __SANDBOX_H__ |
10 | #ifndef __SANDBOX_H__ |
| 11 | #define __SANDBOX_H__ |
11 | #define __SANDBOX_H__ |
| 12 | |
12 | |
| 13 | #include "localdecls.h" |
13 | #include "localdecls.h" |
| 14 | #include "config.h" |
14 | #include "config.h" |
|
|
15 | #include "rcscripts/rctypes.h" |
| 15 | |
16 | |
| 16 | #define LD_PRELOAD_EQ "LD_PRELOAD=" |
17 | #define LD_PRELOAD_EQ "LD_PRELOAD=" |
| 17 | #define LD_PRELOAD_FILE "/etc/ld.so.preload" |
18 | #define LD_PRELOAD_FILE "/etc/ld.so.preload" |
| 18 | #define LIB_NAME "libsandbox.so" |
19 | #define LIB_NAME "libsandbox.so" |
| 19 | #define BASHRC_NAME "sandbox.bashrc" |
20 | #define BASHRC_NAME "sandbox.bashrc" |
| … | |
… | |
| 91 | else \ |
92 | else \ |
| 92 | fprintf(stderr, _hilight _args); \ |
93 | fprintf(stderr, _hilight _args); \ |
| 93 | errno = old_errno; \ |
94 | errno = old_errno; \ |
| 94 | } while (0) |
95 | } while (0) |
| 95 | |
96 | |
| 96 | typedef enum { |
|
|
| 97 | false, |
|
|
| 98 | true |
|
|
| 99 | } bool; |
|
|
| 100 | |
|
|
| 101 | void get_sandbox_lib(char *path); |
97 | void get_sandbox_lib(char *path); |
| 102 | #ifdef OUTSIDE_LIBSANDBOX |
98 | #ifdef OUTSIDE_LIBSANDBOX |
| 103 | void get_sandbox_rc(char *path); |
99 | void get_sandbox_rc(char *path); |
| 104 | void get_sandbox_log(char *path); |
100 | void get_sandbox_log(char *path); |
| 105 | void get_sandbox_debug_log(char *path); |
101 | void get_sandbox_debug_log(char *path); |
| 106 | int get_tmp_dir(char *path); |
102 | int get_tmp_dir(char *path); |
| 107 | #endif /* OUTSIDE_LIBSANDBOX */ |
|
|
| 108 | int exists(const char *pathname); |
|
|
| 109 | #ifdef OUTSIDE_LIBSANDBOX |
|
|
| 110 | int is_file(const char *pathname); |
|
|
| 111 | int is_dir(const char *pathname, int follow_link); |
|
|
| 112 | long file_length(int fd); |
103 | long file_length(int); |
| 113 | #endif /* OUTSIDE_LIBSANDBOX */ |
104 | #endif /* OUTSIDE_LIBSANDBOX */ |
| 114 | bool is_env_on (const char *); |
105 | bool is_env_on (const char *); |
| 115 | bool is_env_off (const char *); |
106 | bool is_env_off (const char *); |
| 116 | |
107 | |
|
|
108 | #ifndef OUTSIDE_LIBSANDBOX |
| 117 | /* Compat functions for GNU extensions */ |
109 | /* Compat functions for GNU extensions */ |
| 118 | char *gstrndup (const char *str, size_t size); |
110 | char *gstrndup (const char *str, size_t size); |
| 119 | /* Same as basename(3), but do not modify path */ |
111 | /* Same as basename(3), but do not modify path */ |
| 120 | char *gbasename (const char *path); |
112 | char *gbasename (const char *path); |
|
|
113 | #endif /* !OUTSIDE_LIBSANDBOX */ |
| 121 | |
114 | |
| 122 | /* glibc modified realpath() function */ |
115 | /* glibc modified realpath() function */ |
| 123 | char *erealpath(const char *, char *); |
116 | char *erealpath(const char *, char *); |
| 124 | #ifndef OUTSIDE_LIBSANDBOX |
117 | #ifndef OUTSIDE_LIBSANDBOX |
| 125 | char *egetcwd(char *, size_t); |
118 | char *egetcwd(char *, size_t); |
| 126 | #endif |
119 | #endif /* !OUTSIDE_LIBSANDBOX */ |
| 127 | |
120 | |
| 128 | #endif /* __SANDBOX_H__ */ |
121 | #endif /* __SANDBOX_H__ */ |
| 129 | |
122 | |
| 130 | // vim:noexpandtab noai:cindent ai |
123 | // vim:noexpandtab noai:cindent ai |