/[path-sandbox]/trunk/src/sandbox.h
Gentoo

Contents of /trunk/src/sandbox.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 286 - (show annotations) (download) (as text)
Thu Jul 6 16:37:20 2006 UTC (11 years, 11 months ago) by azarah
File MIME type: text/x-chdr
File size: 3532 byte(s)
Set default values via a config file.  Also support sandbox.d
config directory for package specific configuration files.

1 /*
2 * Copyright (C) 2002 Brad House <brad@mainstreetsoftworks.com>,
3 * Possibly based on code from Geert Bevin, Uwyn, http://www.uwyn.com
4 * Distributed under the terms of the GNU General Public License, v2 or later
5 * Author: Brad House <brad@mainstreetsoftworks.com>
6 *
7 * $Header$
8 */
9
10 #ifndef __SANDBOX_H__
11 #define __SANDBOX_H__
12
13 #include "localdecls.h"
14 #include "config.h"
15 #include "rcscripts/rctypes.h"
16
17 #define SANDBOX_CONF_FILE ETCDIR "/sandbox.conf"
18 #define SANDBOX_CONFD_DIR ETCDIR "/sandbox.d"
19
20 #define LD_PRELOAD_EQ "LD_PRELOAD="
21 #define LD_PRELOAD_FILE "/etc/ld.so.preload"
22 #define LIB_NAME "libsandbox.so"
23 #define BASHRC_NAME "sandbox.bashrc"
24 #define TMPDIR "/tmp"
25 #define VAR_TMPDIR "/var/tmp"
26 #define PORTAGE_TMPDIR "/var/tmp/portage"
27 #define SANDBOX_LOG_LOCATION "/var/log/sandbox"
28 #define LOG_FILE_PREFIX "/sandbox-"
29 #define DEBUG_LOG_FILE_PREFIX "/sandbox-debug-"
30 #define LOG_FILE_EXT ".log"
31
32 #define ENV_LD_PRELOAD "LD_PRELOAD"
33
34 #define ENV_EBUILD "EBUILD"
35 #define ENV_TMPDIR "TMPDIR"
36 #define ENV_PORTAGE_TMPDIR "PORTAGE_TMPDIR"
37
38 #define ENV_BASH_ENV "BASH_ENV"
39
40 #define ENV_NOCOLOR "NOCOLOR"
41
42 #define ENV_SANDBOX_VERBOSE "SANDBOX_VERBOSE"
43 #define ENV_SANDBOX_DEBUG "SANDBOX_DEBUG"
44
45 #define ENV_SANDBOX_LIB "SANDBOX_LIB"
46 #define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
47 #define ENV_SANDBOX_LOG "SANDBOX_LOG"
48 #define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
49 #define ENV_SANDBOX_WORKDIR "SANDBOX_WORKDIR"
50
51 #define ENV_SANDBOX_DENY "SANDBOX_DENY"
52 #define ENV_SANDBOX_READ "SANDBOX_READ"
53 #define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
54 #define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
55
56 #define ENV_SANDBOX_ON "SANDBOX_ON"
57 #define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
58
59 #define ENV_SANDBOX_PID "SANDBOX_PID"
60 #define ENV_SANDBOX_ABORT "SANDBOX_ABORT"
61 #define ENV_SANDBOX_INTRACTV "SANDBOX_INTRACTV"
62
63 #define ENV_SANDBOX_ACTIVE "SANDBOX_ACTIVE"
64 #define SANDBOX_ACTIVE "armedandready"
65
66 #define DEFAULT_BEEP_COUNT 3
67
68 #define SB_BUF_LEN 2048
69
70 /* Gentoo style e* printing macro's */
71 #define SB_EINFO(_color, _hilight, _args...) \
72 do { \
73 int old_errno = errno; \
74 if (_color) \
75 fprintf(stderr, "\033[32;01m" _hilight "\033[0m" _args); \
76 else \
77 fprintf(stderr, _hilight _args); \
78 errno = old_errno; \
79 } while (0)
80
81 #define SB_EWARN(_color, _hilight, _args...) \
82 do { \
83 int old_errno = errno; \
84 if (_color) \
85 fprintf(stderr, "\033[33;01m" _hilight "\033[0m" _args); \
86 else \
87 fprintf(stderr, _hilight _args); \
88 errno = old_errno; \
89 } while (0)
90
91 #define SB_EERROR(_color, _hilight, _args...) \
92 do { \
93 int old_errno = errno; \
94 if (_color) \
95 fprintf(stderr, "\033[31;01m" _hilight "\033[0m" _args); \
96 else \
97 fprintf(stderr, _hilight _args); \
98 errno = old_errno; \
99 } while (0)
100
101 void get_sandbox_lib(char *path);
102 #ifdef OUTSIDE_LIBSANDBOX
103 void get_sandbox_rc(char *path);
104 void get_sandbox_log(char *path);
105 void get_sandbox_debug_log(char *path);
106 int get_tmp_dir(char *path);
107 long file_length(int);
108 #endif /* OUTSIDE_LIBSANDBOX */
109 bool is_env_on (const char *);
110 bool is_env_off (const char *);
111
112 /* glibc modified realpath() function */
113 char *erealpath(const char *, char *);
114 #ifndef OUTSIDE_LIBSANDBOX
115 char *egetcwd(char *, size_t);
116 #endif /* !OUTSIDE_LIBSANDBOX */
117
118 #endif /* __SANDBOX_H__ */
119
120 // vim:noexpandtab noai:cindent ai

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20