summaryrefslogtreecommitdiff
blob: 91f759f60d2f3cbe842034bc52d9a237fda1cf71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* 
 * Copyright (C) 2002 Brad House <brad@mainstreetsoftworks.com>,
 * Possibly based on code from Geert Bevin, Uwyn, http://www.uwyn.com
 * Distributed under the terms of the GNU General Public License, v2 or later 
 * Author: Brad House <brad@mainstreetsoftworks.com>
 *    
 * $Id: /var/cvsroot/gentoo-src/portage/src/sandbox-dev/Attic/sandbox.h,v 1.2 2002/12/04 18:11:32 azarah Exp $
 */

#ifndef __SANDBOX_H__
#define __SANDBOX_H__

/* Uncomment below to use flock instead of fcntl (POSIX way) to lock/unlock files */
/* #define USE_FLOCK */

/* Uncomment below to use system() to execute the shell rather than execv */
/* #define USE_SYSTEM_SHELL */

/* Uncomment below to use /etc/ld.so.preload (could be very intrusive!!) */
/* #define USE_LD_SO_PRELOAD */

/* Uncommend to not have the protected shell forked, just run in parent process */
/* ONLY FOR DEBUGGING PURPOSES!! (strace needs it like that) */
/* #define NO_FORK */


#define LD_PRELOAD_FILE		"/etc/ld.so.preload"
#define LIB_NAME		"libsandbox.so"
#define BASHRC_NAME		"sandbox.bashrc"
#define PIDS_FILE		"/tmp/sandboxpids.tmp"
#define LOG_FILE_PREFIX		"/tmp/sandbox-"
#define DEBUG_LOG_FILE_PREFIX	"/tmp/sandbox-debug-"
#define LOG_FILE_EXT		".log"

#define ENV_SANDBOX_DEBUG_LOG	"SANDBOX_DEBUG_LOG"
#define ENV_SANDBOX_LOG		"SANDBOX_LOG"
#define ENV_SANDBOX_DIR		"SANDBOX_DIR"
#define ENV_SANDBOX_LIB		"SANDBOX_LIB"

#define ENV_SANDBOX_DENY	"SANDBOX_DENY"
#define ENV_SANDBOX_READ	"SANDBOX_READ"
#define ENV_SANDBOX_WRITE	"SANDBOX_WRITE"
#define ENV_SANDBOX_PREDICT	"SANDBOX_PREDICT"

#define ENV_SANDBOX_ON		"SANDBOX_ON"
#define ENV_SANDBOX_BEEP	"SANDBOX_BEEP"

#define DEFAULT_BEEP_COUNT	3

char *get_sandbox_path(char *argv0);
char *get_sandbox_lib(char *sb_path);
char *get_sandbox_rc(char *sb_path);
char *get_sandbox_log();
char *sb_dirname(const char *path);
int file_getmode(char *mode);
long file_tell(int fp);
int file_lock(int fd, int lock, char *filename);
int file_unlock(int fd);
int file_locktype(char *mode);
int file_open(char *filename, char *mode, int perm_specified, ...);
void file_close(int fd);
long file_length(int fd);
int file_truncate(int fd);
int file_exist(char *filename, int checkmode);

#endif


// vim:expandtab noai:cindent ai