diff options
Diffstat (limited to 'sandbox.c')
-rw-r--r-- | sandbox.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/sandbox.c b/sandbox.c deleted file mode 100644 index 20fd57d16..000000000 --- a/sandbox.c +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* $Id$ */ | ||
2 | /* | ||
3 | * Copyright (c) 2012 Colin Watson <cjwatson@debian.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #include <sys/types.h> | ||
19 | |||
20 | #include <stdlib.h> | ||
21 | #include <stdarg.h> | ||
22 | |||
23 | #include "log.h" | ||
24 | #include "ssh-sandbox.h" | ||
25 | |||
26 | static Sandbox *sandboxes[] = { | ||
27 | &ssh_sandbox_systrace, | ||
28 | &ssh_sandbox_darwin, | ||
29 | &ssh_sandbox_seccomp_filter, | ||
30 | &ssh_sandbox_rlimit, | ||
31 | &ssh_sandbox_null, | ||
32 | NULL | ||
33 | }; | ||
34 | |||
35 | static Sandbox *selected; | ||
36 | |||
37 | static void | ||
38 | sandbox_select(void) | ||
39 | { | ||
40 | Sandbox **sandbox; | ||
41 | |||
42 | if (selected) | ||
43 | return; | ||
44 | |||
45 | for (sandbox = sandboxes; sandbox; sandbox++) { | ||
46 | if ((*sandbox)->probe && (*sandbox)->probe()) { | ||
47 | selected = *sandbox; | ||
48 | return; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /* should never happen, as ssh_sandbox_null always succeeds */ | ||
53 | fatal("no sandbox implementation found"); | ||
54 | } | ||
55 | |||
56 | void * | ||
57 | ssh_sandbox_init(void) | ||
58 | { | ||
59 | sandbox_select(); | ||
60 | return selected->init(); | ||
61 | } | ||
62 | |||
63 | void | ||
64 | ssh_sandbox_child(void *box) | ||
65 | { | ||
66 | sandbox_select(); | ||
67 | return selected->child(box); | ||
68 | } | ||
69 | |||
70 | void | ||
71 | ssh_sandbox_parent_finish(void *box) | ||
72 | { | ||
73 | sandbox_select(); | ||
74 | return selected->parent_finish(box); | ||
75 | } | ||
76 | |||
77 | void | ||
78 | ssh_sandbox_parent_preauth(void *box, pid_t child_pid) | ||
79 | { | ||
80 | sandbox_select(); | ||
81 | return selected->parent_preauth(box, child_pid); | ||
82 | } | ||