| 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 |
|
| 16 |
/* Uncomment below to use flock instead of fcntl (POSIX way) to lock/unlock files */
|
| 17 |
/* #define USE_FLOCK */
|
| 18 |
|
| 19 |
#define LD_PRELOAD_EQ "LD_PRELOAD="
|
| 20 |
#define LD_PRELOAD_FILE "/etc/ld.so.preload"
|
| 21 |
#define LIB_NAME "libsandbox.so"
|
| 22 |
#define BASHRC_NAME "sandbox.bashrc"
|
| 23 |
#define TMPDIR "/tmp"
|
| 24 |
#define VAR_TMPDIR "/var/tmp"
|
| 25 |
#define PORTAGE_TMPDIR "/var/tmp/portage"
|
| 26 |
#define SANDBOX_LOG_LOCATION "/var/log/sandbox"
|
| 27 |
#define LOG_FILE_PREFIX "/sandbox-"
|
| 28 |
#define DEBUG_LOG_FILE_PREFIX "/sandbox-debug-"
|
| 29 |
#define LOG_FILE_EXT ".log"
|
| 30 |
|
| 31 |
#define ENV_LD_PRELOAD "LD_PRELOAD"
|
| 32 |
|
| 33 |
#define ENV_TMPDIR "TMPDIR"
|
| 34 |
#define ENV_PORTAGE_TMPDIR "PORTAGE_TMPDIR"
|
| 35 |
|
| 36 |
#define ENV_SANDBOX_DEBUG_LOG "SANDBOX_DEBUG_LOG"
|
| 37 |
#define ENV_SANDBOX_LOG "SANDBOX_LOG"
|
| 38 |
#define ENV_SANDBOX_DIR "SANDBOX_DIR"
|
| 39 |
#define ENV_SANDBOX_LIB "SANDBOX_LIB"
|
| 40 |
#define ENV_SANDBOX_BASHRC "SANDBOX_BASHRC"
|
| 41 |
|
| 42 |
#define ENV_SANDBOX_DENY "SANDBOX_DENY"
|
| 43 |
#define ENV_SANDBOX_READ "SANDBOX_READ"
|
| 44 |
#define ENV_SANDBOX_WRITE "SANDBOX_WRITE"
|
| 45 |
#define ENV_SANDBOX_PREDICT "SANDBOX_PREDICT"
|
| 46 |
|
| 47 |
#define ENV_SANDBOX_ON "SANDBOX_ON"
|
| 48 |
#define ENV_SANDBOX_BEEP "SANDBOX_BEEP"
|
| 49 |
|
| 50 |
#define DEFAULT_BEEP_COUNT 3
|
| 51 |
|
| 52 |
#define SB_BUF_LEN 2048
|
| 53 |
|
| 54 |
#if !HAVE_DLVSYM
|
| 55 |
# define dlvsym(lib, sym, ver) dlsym(lib, sym)
|
| 56 |
#endif
|
| 57 |
|
| 58 |
SB_STATIC char *get_sandbox_path(char *argv0);
|
| 59 |
SB_STATIC char *get_sandbox_lib(char *sb_path);
|
| 60 |
SB_STATIC char *get_sandbox_rc(char *sb_path);
|
| 61 |
SB_STATIC char *get_sandbox_log(const char *tmp_dir);
|
| 62 |
SB_STATIC char *get_sandbox_debug_log(const char *tmp_dir);
|
| 63 |
SB_STATIC int get_tmp_dir(char *tmp_dir);
|
| 64 |
SB_STATIC char *sb_dirname(const char *path);
|
| 65 |
SB_STATIC int file_getmode(char *mode);
|
| 66 |
SB_STATIC long file_tell(int fp);
|
| 67 |
SB_STATIC int file_lock(int fd, int lock, char *filename);
|
| 68 |
SB_STATIC int file_unlock(int fd);
|
| 69 |
SB_STATIC int file_locktype(char *mode);
|
| 70 |
SB_STATIC int file_open(char *filename, char *mode, int perm_specified, ...);
|
| 71 |
SB_STATIC void file_close(int fd);
|
| 72 |
SB_STATIC long file_length(int fd);
|
| 73 |
SB_STATIC int file_truncate(int fd);
|
| 74 |
SB_STATIC int file_exist(char *filename, int checkmode);
|
| 75 |
|
| 76 |
#endif
|
| 77 |
|
| 78 |
// vim:noexpandtab noai:cindent ai
|