From 345460db06bf3cc19575c5538bce0064d34dd6f5 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Wed, 23 Mar 2016 15:05:19 -0400 Subject: [PATCH 1/2] Vendor engine-api 0.3.1. Signed-off-by: David Calavera Upstream-commit: 58385bc8a51e538f64a0d91c3259f20c6c289c86 Component: engine --- components/engine/hack/vendor.sh | 2 +- .../src/github.com/docker/engine-api/client/client.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/engine/hack/vendor.sh b/components/engine/hack/vendor.sh index dfb76edad5..c94d38ed71 100755 --- a/components/engine/hack/vendor.sh +++ b/components/engine/hack/vendor.sh @@ -24,7 +24,7 @@ clone git golang.org/x/net 47990a1ba55743e6ef1affd3a14e5bac8553615d https://gith clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 clone git github.com/docker/go-connections v0.2.0 -clone git github.com/docker/engine-api v0.3.0 +clone git github.com/docker/engine-api v0.3.1 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 clone git github.com/imdario/mergo 0.2.1 diff --git a/components/engine/vendor/src/github.com/docker/engine-api/client/client.go b/components/engine/vendor/src/github.com/docker/engine-api/client/client.go index 13aecc1be7..0716667b3a 100644 --- a/components/engine/vendor/src/github.com/docker/engine-api/client/client.go +++ b/components/engine/vendor/src/github.com/docker/engine-api/client/client.go @@ -97,10 +97,14 @@ func (cli *Client) getAPIPath(p string, query url.Values) string { } else { apiPath = fmt.Sprintf("%s%s", cli.basePath, p) } - if len(query) > 0 { - apiPath += "?" + query.Encode() + + u := &url.URL{ + Path: apiPath, } - return apiPath + if len(query) > 0 { + u.RawQuery = query.Encode() + } + return u.String() } // ClientVersion returns the version string associated with this From 676dd1beed266434905f4a4fd84367ccff49ec2e Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Wed, 23 Mar 2016 04:12:22 +0000 Subject: [PATCH 2/2] Fix Docker core dumps when removing network with special characters (#21401). This fix tries to fix Docker core dumps when removing network with special characters. The issue is from the fact that when docker client tries to pass the command to API, the networkID is not escaped in case of special characters. This also means other commands (not just `docker network rm`) may face the same issue (e.g., `docker network connect`). This fix adds the URL path escape to properly handle it. In addition, an integration test for network create and delete is added to cover the cases in #21401. This fix fixes #21401. Signed-off-by: Yong Tang (cherry picked from commit f8dc5562d0a74792c46b9382181ddf97e5d7cdac) Signed-off-by: David Calavera Upstream-commit: f1542276081aa91396495059638d3ea30d4e5a10 Component: engine --- .../integration-cli/docker_cli_network_unix_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/engine/integration-cli/docker_cli_network_unix_test.go b/components/engine/integration-cli/docker_cli_network_unix_test.go index 6675cf1d26..2ee2092c69 100644 --- a/components/engine/integration-cli/docker_cli_network_unix_test.go +++ b/components/engine/integration-cli/docker_cli_network_unix_test.go @@ -1452,3 +1452,16 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *check.C) { _, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first") c.Assert(err, check.IsNil) } + +// Test for #21401 +func (s *DockerNetworkSuite) TestDockerNetworkCreateDeleteSpecialCharacters(c *check.C) { + dockerCmd(c, "network", "create", "test@#$") + assertNwIsAvailable(c, "test@#$") + dockerCmd(c, "network", "rm", "test@#$") + assertNwNotAvailable(c, "test@#$") + + dockerCmd(c, "network", "create", "kiwl$%^") + assertNwIsAvailable(c, "kiwl$%^") + dockerCmd(c, "network", "rm", "kiwl$%^") + assertNwNotAvailable(c, "kiwl$%^") +}