From 234aecaaa6e302e4e2e5e3e2e24db79ffb90f7f5 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 8 Nov 2016 11:05:56 -0800 Subject: [PATCH] Windows: Plumb through user Signed-off-by: John Howard Upstream-commit: 5207ff7202327bd06fa7e8df4c58d6a944899b60 Component: engine --- components/engine/daemon/exec_windows.go | 1 + components/engine/libcontainerd/client_windows.go | 1 + components/engine/libcontainerd/container_windows.go | 1 + 3 files changed, 3 insertions(+) diff --git a/components/engine/daemon/exec_windows.go b/components/engine/daemon/exec_windows.go index a6ac1db42d..1d6974cda9 100644 --- a/components/engine/daemon/exec_windows.go +++ b/components/engine/daemon/exec_windows.go @@ -9,5 +9,6 @@ import ( func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error { // Process arguments need to be escaped before sending to OCI. p.Args = escapeArgs(p.Args) + p.User.Username = ec.User return nil } diff --git a/components/engine/libcontainerd/client_windows.go b/components/engine/libcontainerd/client_windows.go index 16abec3bca..23e5b0dcbe 100644 --- a/components/engine/libcontainerd/client_windows.go +++ b/components/engine/libcontainerd/client_windows.go @@ -301,6 +301,7 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly // Configure the environment for the process createProcessParms.Environment = setupEnvironmentVariables(procToAdd.Env) createProcessParms.CommandLine = strings.Join(procToAdd.Args, " ") + createProcessParms.User = procToAdd.User.Username logrus.Debugf("libcontainerd: commandLine: %s", createProcessParms.CommandLine) diff --git a/components/engine/libcontainerd/container_windows.go b/components/engine/libcontainerd/container_windows.go index 21fb6ac835..9b1965099a 100644 --- a/components/engine/libcontainerd/container_windows.go +++ b/components/engine/libcontainerd/container_windows.go @@ -81,6 +81,7 @@ func (ctr *container) start(attachStdio StdioCallback) error { // Configure the environment for the process createProcessParms.Environment = setupEnvironmentVariables(ctr.ociSpec.Process.Env) createProcessParms.CommandLine = strings.Join(ctr.ociSpec.Process.Args, " ") + createProcessParms.User = ctr.ociSpec.Process.User.Username // Start the command running in the container. newProcess, err := ctr.hcsContainer.CreateProcess(createProcessParms)