diff options
| author | Ophestra <cat@gensokyo.uk> | 2024-12-28 11:12:35 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2024-12-28 11:12:35 +0900 |
| commit | 0107620d8c174dcf9237c16d4b4b7b2f6955a214 (patch) | |
| tree | 3b082eafad73eaa971a59baf762260c89917831b /internal/app/share.dbus.go | |
| parent | fc26659ea11fea8f41fc2551d6d39d30fe3a49e7 (diff) | |
app: merge share methods
This significantly increases readability and makes order of ops more obvious.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/share.dbus.go')
| -rw-r--r-- | internal/app/share.dbus.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/internal/app/share.dbus.go b/internal/app/share.dbus.go deleted file mode 100644 index 4fd947d7..00000000 --- a/internal/app/share.dbus.go +++ /dev/null @@ -1,44 +0,0 @@ -package app - -import ( - "path" - - "git.gensokyo.uk/security/fortify/acl" - "git.gensokyo.uk/security/fortify/dbus" - "git.gensokyo.uk/security/fortify/internal/system" -) - -const ( - dbusSessionBusAddress = "DBUS_SESSION_BUS_ADDRESS" - dbusSystemBusAddress = "DBUS_SYSTEM_BUS_ADDRESS" -) - -func (seal *appSeal) shareDBus(config [2]*dbus.Config) error { - if !seal.et.Has(system.EDBus) { - return nil - } - - // downstream socket paths - sessionPath, systemPath := path.Join(seal.share, "bus"), path.Join(seal.share, "system_bus_socket") - - // configure dbus proxy - if f, err := seal.sys.ProxyDBus(config[0], config[1], sessionPath, systemPath); err != nil { - return err - } else { - seal.dbusMsg = f - } - - // share proxy sockets - sessionInner := path.Join(seal.sys.runtime, "bus") - seal.sys.bwrap.SetEnv[dbusSessionBusAddress] = "unix:path=" + sessionInner - seal.sys.bwrap.Bind(sessionPath, sessionInner) - seal.sys.UpdatePerm(sessionPath, acl.Read, acl.Write) - if config[1] != nil { - systemInner := "/run/dbus/system_bus_socket" - seal.sys.bwrap.SetEnv[dbusSystemBusAddress] = "unix:path=" + systemInner - seal.sys.bwrap.Bind(systemPath, systemInner) - seal.sys.UpdatePerm(systemPath, acl.Read, acl.Write) - } - - return nil -} |
