diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-10 12:44:08 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-10 12:44:08 +0900 |
| commit | 86cb5ac1dbd581078b10f5ec1eb723549c662a1b (patch) | |
| tree | 9198789d0a47ebeda49b4e000013cfbf009b1b45 /internal/app/share.pulse.go | |
| parent | 2220055e26bff8b426ebf086d09ba242e5180e76 (diff) | |
app: hardlink sockets to process-specific share local to XDG_RUNTIME_DIR
This avoids adding ACLs to the PulseAudio directory.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app/share.pulse.go')
| -rw-r--r-- | internal/app/share.pulse.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/app/share.pulse.go b/internal/app/share.pulse.go index 633b859d..b432345f 100644 --- a/internal/app/share.pulse.go +++ b/internal/app/share.pulse.go @@ -7,7 +7,6 @@ import ( "os" "path" - "git.ophivana.moe/cat/fortify/acl" "git.ophivana.moe/cat/fortify/internal/state" ) @@ -35,7 +34,7 @@ func (seal *appSeal) sharePulse() error { return nil } - // ensure PulseAudio directory ACL (e.g. `/run/user/%d/pulse`) + // check PulseAudio directory presence (e.g. `/run/user/%d/pulse`) pd := path.Join(seal.RuntimePath, "pulse") ps := path.Join(pd, "native") if _, err := os.Stat(pd); err != nil { @@ -47,10 +46,7 @@ func (seal *appSeal) sharePulse() error { fmt.Sprintf("PulseAudio directory '%s' not found", pd))) } - seal.appendEnv(pulseServer, "unix:"+ps) - seal.sys.updatePerm(pd, acl.Execute) - - // ensure PulseAudio socket permission (e.g. `/run/user/%d/pulse/native`) + // check PulseAudio socket permission (e.g. `/run/user/%d/pulse/native`) if s, err := os.Stat(ps); err != nil { if !errors.Is(err, fs.ErrNotExist) { return (*PulseSocketAccessError)(wrapError(err, @@ -65,6 +61,11 @@ func (seal *appSeal) sharePulse() error { } } + // hard link pulse socket into target-executable share + psi := path.Join(seal.shareLocal, "pulse") + seal.sys.link(ps, psi) + seal.appendEnv(pulseServer, "unix:"+psi) + // publish current user's pulse cookie for target user if src, err := discoverPulseCookie(); err != nil { return err |
