| 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 |
/* Uncomment below to use flock instead of fcntl (POSIX way) to lock/unlock files */
|
| 14 |
/* #define USE_FLOCK */
|
| 15 |
|
| 16 |
/* Uncomment below to use system() to execute the shell rather than execv */
|
| 17 |
/* #define USE_SYSTEM_SHELL */
|
| 18 |
|
| 19 |
/* Uncomment below to use /etc/ld.so.preload (could be very intrusive!!) */
|
| 20 |
/* #define USE_LD_SO_PRELOAD */
|
| 21 |
|
| 22 |
/* Uncommend to not have the protected shell forked, just run in parent process */
|
| 23 |
/* ONLY FOR DEBUGGING PURPOSES!! (strace needs it like that) */
|
| 24 |
/* #define NO_FORK */
|
| 25 |
|
| 26 |
#define LD_PRELOAD_FILE "/etc/ld.so.preload"
|
| 27 |
#define LIB_NAME "libsandbox.so"
|
| 28 |
#define BASHRC_NAME "sandbox.bashrc"
|
| 29 |
#define PIDS_FILE "/tmp/sandboxpids.tmp"
|
| 30 |
#define LOG_FILE_PREFIX "/tmp/sandbox-"
|
| 31 |
#define DEBUG_LOG_FILE_PREFIX "/tmp/sandbox-debug-"
|
| 32 |
#define LOG_FILE_EXT ".log"
|
| 33 |
|
| 34 |
#define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
|
| 35 |
#define ENV_SANDBOX_LOG "SANDBOX_LOG"
|
| 36 |
#define ENV_SANDBOX_DIR "SANDBOX_DIR"
|
| 37 |
#define ENV_SANDBOX_LIB "SANDBOX_LIB"
|
| 38 |
|
| 39 |
#define ENV_SANDBOX_DENY "SANDBOX_DENY"
|
| 40 |
#define ENV_SANDBOX_READ "SANDBOX_READ"
|
| 41 |
#define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
|
| 42 |
#define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
|
| 43 |
|
| 44 |
#define ENV_SANDBOX_ON "SANDBOX_ON"
|
| 45 |
#define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
|
| 46 |
|
| 47 |
#define DEFAULT_BEEP_COUNT 3
|
| 48 |
|
| 49 |
char *get_sandbox_path(char *argv0);
|
| 50 |
char *get_sandbox_lib(char *sb_path);
|
| 51 |
char *get_sandbox_pids_file(void);
|
| 52 |
char *get_sandbox_rc(char *sb_path);
|
| 53 |
char *get_sandbox_log();
|
| 54 |
char *sb_dirname(const char *path);
|
| 55 |
int file_getmode(char *mode);
|
| 56 |
long file_tell(int fp);
|
| 57 |
int file_lock(int fd, int lock, char *filename);
|
| 58 |
int file_unlock(int fd);
|
| 59 |
int file_locktype(char *mode);
|
| 60 |
int file_open(char *filename, char *mode, int perm_specified, ...);
|
| 61 |
void file_close(int fd);
|
| 62 |
long file_length(int fd);
|
| 63 |
int file_truncate(int fd);
|
| 64 |
int file_exist(char *filename, int checkmode);
|
| 65 |
|
| 66 |
#endif
|
| 67 |
|
| 68 |
// vim:noexpandtab noai:cindent ai
|