bunpen: refactor: lift dbus_resources out of restrict/dbus_proxy -> resources
This commit is contained in:
@@ -7,6 +7,7 @@ export type resources = struct {
|
|||||||
// user has naturally.
|
// user has naturally.
|
||||||
paths: []path::buffer,
|
paths: []path::buffer,
|
||||||
caps: rt::ext::caps,
|
caps: rt::ext::caps,
|
||||||
|
dbus: dbus_resources,
|
||||||
// true to allow speaking to other processes in the same IPC namespace
|
// true to allow speaking to other processes in the same IPC namespace
|
||||||
ipc: bool,
|
ipc: bool,
|
||||||
net: net_resources,
|
net: net_resources,
|
||||||
@@ -18,6 +19,13 @@ export type resources = struct {
|
|||||||
try_users: bool,
|
try_users: bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type dbus_resources = struct {
|
||||||
|
// list of bus names to allow talking to
|
||||||
|
talk: []str,
|
||||||
|
// list of bus names to allow owning
|
||||||
|
own: []str,
|
||||||
|
};
|
||||||
|
|
||||||
export type net_subset = struct {
|
export type net_subset = struct {
|
||||||
// name of the network device through which traffic should be routed
|
// name of the network device through which traffic should be routed
|
||||||
dev: str,
|
dev: str,
|
||||||
|
@@ -65,18 +65,14 @@ use strings;
|
|||||||
use os;
|
use os;
|
||||||
use os::exec;
|
use os::exec;
|
||||||
use ps;
|
use ps;
|
||||||
|
use resources;
|
||||||
use rt::ext;
|
use rt::ext;
|
||||||
|
|
||||||
export type dbus_resources = struct {
|
|
||||||
talk: []str,
|
|
||||||
own: []str,
|
|
||||||
};
|
|
||||||
|
|
||||||
// given an existing, unfiltered bus at the fs path `upstream`,
|
// given an existing, unfiltered bus at the fs path `upstream`,
|
||||||
// proxy the bus into the fs path indicated by `downstream`.
|
// proxy the bus into the fs path indicated by `downstream`.
|
||||||
// clients attaching to the `downstream` path are provided access only to the
|
// clients attaching to the `downstream` path are provided access only to the
|
||||||
// resources indicated by `dbus`.
|
// resources indicated by `dbus`.
|
||||||
fn dbus_restrict(dbus: dbus_resources, upstream: str, downstream: str) void = {
|
fn dbus_restrict(dbus: resources::dbus_resources, upstream: str, downstream: str) void = {
|
||||||
match (ps::fork_and_die_with_parent()) {
|
match (ps::fork_and_die_with_parent()) {
|
||||||
case let child_pid: os::exec::process =>
|
case let child_pid: os::exec::process =>
|
||||||
let proxy_args: []str = [
|
let proxy_args: []str = [
|
||||||
|
Reference in New Issue
Block a user