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

Contents of /trunk/src/sandbox.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download) (as text)
Wed Jul 5 16:51:12 2006 UTC (8 years ago) by azarah
File MIME type: text/x-chdr
File size: 3613 byte(s)
Use librcutil.

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 LD_PRELOAD_EQ "LD_PRELOAD="
18 #define LD_PRELOAD_FILE "/etc/ld.so.preload"
19 #define LIB_NAME "libsandbox.so"
20 #define BASHRC_NAME "sandbox.bashrc"
21 #define TMPDIR "/tmp"
22 #define VAR_TMPDIR "/var/tmp"
23 #define PORTAGE_TMPDIR "/var/tmp/portage"
24 #define SANDBOX_LOG_LOCATION "/var/log/sandbox"
25 #define LOG_FILE_PREFIX "/sandbox-"
26 #define DEBUG_LOG_FILE_PREFIX "/sandbox-debug-"
27 #define LOG_FILE_EXT ".log"
28
29 #define ENV_LD_PRELOAD "LD_PRELOAD"
30
31 #define ENV_EBUILD "EBUILD"
32 #define ENV_TMPDIR "TMPDIR"
33 #define ENV_PORTAGE_TMPDIR "PORTAGE_TMPDIR"
34
35 #define ENV_BASH_ENV "BASH_ENV"
36
37 #define ENV_NOCOLOR "NOCOLOR"
38
39 #define ENV_SANDBOX_VERBOSE "SANDBOX_VERBOSE"
40 #define ENV_SANDBOX_DEBUG "SANDBOX_DEBUG"
41
42 #define ENV_SANDBOX_LIB "SANDBOX_LIB"
43 #define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
44 #define ENV_SANDBOX_LOG "SANDBOX_LOG"
45 #define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
46
47 #define ENV_SANDBOX_DENY "SANDBOX_DENY"
48 #define ENV_SANDBOX_READ "SANDBOX_READ"
49 #define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
50 #define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
51
52 #define ENV_SANDBOX_ON "SANDBOX_ON"
53 #define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
54
55 #define ENV_SANDBOX_PID "SANDBOX_PID"
56 #define ENV_SANDBOX_ABORT "SANDBOX_ABORT"
57 #define ENV_SANDBOX_INTRACTV "SANDBOX_INTRACTV"
58
59 #define ENV_SANDBOX_ACTIVE "SANDBOX_ACTIVE"
60 #define SANDBOX_ACTIVE "armedandready"
61
62 #define DEFAULT_BEEP_COUNT 3
63
64 #define SB_BUF_LEN 2048
65
66 /* Gentoo style e* printing macro's */
67 #define SB_EINFO(_color, _hilight, _args...) \
68 do { \
69 int old_errno = errno; \
70 if (_color) \
71 fprintf(stderr, "\033[32;01m" _hilight "\033[0m" _args); \
72 else \
73 fprintf(stderr, _hilight _args); \
74 errno = old_errno; \
75 } while (0)
76
77 #define SB_EWARN(_color, _hilight, _args...) \
78 do { \
79 int old_errno = errno; \
80 if (_color) \
81 fprintf(stderr, "\033[33;01m" _hilight "\033[0m" _args); \
82 else \
83 fprintf(stderr, _hilight _args); \
84 errno = old_errno; \
85 } while (0)
86
87 #define SB_EERROR(_color, _hilight, _args...) \
88 do { \
89 int old_errno = errno; \
90 if (_color) \
91 fprintf(stderr, "\033[31;01m" _hilight "\033[0m" _args); \
92 else \
93 fprintf(stderr, _hilight _args); \
94 errno = old_errno; \
95 } while (0)
96
97 void get_sandbox_lib(char *path);
98 #ifdef OUTSIDE_LIBSANDBOX
99 void get_sandbox_rc(char *path);
100 void get_sandbox_log(char *path);
101 void get_sandbox_debug_log(char *path);
102 int get_tmp_dir(char *path);
103 long file_length(int);
104 #endif /* OUTSIDE_LIBSANDBOX */
105 bool is_env_on (const char *);
106 bool is_env_off (const char *);
107
108 #ifndef OUTSIDE_LIBSANDBOX
109 /* Compat functions for GNU extensions */
110 char *gstrndup (const char *str, size_t size);
111 /* Same as basename(3), but do not modify path */
112 char *gbasename (const char *path);
113 #endif /* !OUTSIDE_LIBSANDBOX */
114
115 /* glibc modified realpath() function */
116 char *erealpath(const char *, char *);
117 #ifndef OUTSIDE_LIBSANDBOX
118 char *egetcwd(char *, size_t);
119 #endif /* !OUTSIDE_LIBSANDBOX */
120
121 #endif /* __SANDBOX_H__ */
122
123 // 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