Pass full environment to Xpra client

master
xSmurf 9 years ago
parent 58a045784d
commit f86611af82

@ -102,6 +102,8 @@ func initialize() *daemonState {
d.log.Fatalf("Failed to create sockets directory: %v", err) d.log.Fatalf("Failed to create sockets directory: %v", err)
} }
os.Clearenv()
go d.processSignals(sigs) go d.processSignals(sigs)
return d return d
@ -246,8 +248,9 @@ func (d *daemonState) handleLaunch(msg *LaunchMsg, m *ipc.Message) error {
} }
} else { } else {
d.Debug("Would launch %s", p.Name) d.Debug("Would launch %s", p.Name)
msg.Env = d.sanitizeEnvironment(p, msg.Env) rawEnv := msg.Env
_, err = d.launch(p, msg, m.Ucred.Uid, m.Ucred.Gid, d.log) msg.Env = d.sanitizeEnvironment(p, rawEnv)
_, err = d.launch(p, msg, rawEnv, m.Ucred.Uid, m.Ucred.Gid, d.log)
if err != nil { if err != nil {
d.Warning("Launch of %s failed: %v", p.Name, err) d.Warning("Launch of %s failed: %v", p.Name, err)
return m.Respond(&ErrorMsg{err.Error()}) return m.Respond(&ErrorMsg{err.Error()})

@ -42,6 +42,7 @@ type Sandbox struct {
ready sync.WaitGroup ready sync.WaitGroup
network *network.SandboxNetwork network *network.SandboxNetwork
mountedFiles []string mountedFiles []string
rawEnv []string
} }
func createSocketPath(base string) (string, error) { func createSocketPath(base string) (string, error) {
@ -71,11 +72,13 @@ func createInitCommand(initPath string, cloneNet bool) *exec.Cmd {
//Chroot: chroot, //Chroot: chroot,
Cloneflags: cloneFlags, Cloneflags: cloneFlags,
} }
cmd.Env = []string{}
return cmd return cmd
} }
func (d *daemonState) launch(p *oz.Profile, msg *LaunchMsg, uid, gid uint32, log *logging.Logger) (*Sandbox, error) { func (d *daemonState) launch(p *oz.Profile, msg *LaunchMsg, rawEnv []string, uid, gid uint32, log *logging.Logger) (*Sandbox, error) {
/* /*
u, err := user.LookupId(fmt.Sprintf("%d", uid)) u, err := user.LookupId(fmt.Sprintf("%d", uid))
@ -166,6 +169,7 @@ func (d *daemonState) launch(p *oz.Profile, msg *LaunchMsg, uid, gid uint32, log
addr: socketPath, addr: socketPath,
stderr: pp, stderr: pp,
network: stn, network: stn,
rawEnv: rawEnv,
} }
if p.Networking.Nettype == network.TYPE_BRIDGE { if p.Networking.Nettype == network.TYPE_BRIDGE {
@ -406,6 +410,8 @@ func (sbox *Sandbox) startXpraClient() {
sbox.profile.Name, sbox.profile.Name,
sbox.daemon.log) sbox.daemon.log)
sbox.xpra.Process.Env = append(sbox.rawEnv, sbox.xpra.Process.Env...)
if sbox.daemon.config.LogXpra { if sbox.daemon.config.LogXpra {
sbox.setupXpraLogging() sbox.setupXpraLogging()
} }

Loading…
Cancel
Save