summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/export.go3
-rw-r--r--cmd/podman/import.go4
-rw-r--r--cmd/podman/load.go3
-rw-r--r--cmd/podman/parse.go9
-rw-r--r--cmd/podman/save.go3
-rw-r--r--docs/podman-export.1.md1
-rw-r--r--docs/podman-import.1.md1
-rw-r--r--docs/podman-load.1.md1
-rw-r--r--docs/podman-save.1.md1
-rw-r--r--test/e2e/export_test.go13
-rw-r--r--test/e2e/save_test.go8
11 files changed, 46 insertions, 1 deletions
diff --git a/cmd/podman/export.go b/cmd/podman/export.go
index eaf1ab39f..16c1f5c9b 100644
--- a/cmd/podman/export.go
+++ b/cmd/podman/export.go
@@ -56,6 +56,9 @@ func exportCmd(c *cli.Context) error {
return errors.Errorf("refusing to export to terminal. Use -o flag or redirect")
}
}
+ if err := validateFileName(output); err != nil {
+ return err
+ }
ctr, err := runtime.LookupContainer(args[0])
if err != nil {
diff --git a/cmd/podman/import.go b/cmd/podman/import.go
index 5a4fa45d9..446516024 100644
--- a/cmd/podman/import.go
+++ b/cmd/podman/import.go
@@ -75,6 +75,10 @@ func importCmd(c *cli.Context) error {
return errors.Errorf("too many arguments. Usage TARBALL [REFERENCE]")
}
+ if err := validateFileName(source); err != nil {
+ return err
+ }
+
changes := v1.ImageConfig{}
if c.IsSet("change") {
changes, err = util.GetImageConfig(c.StringSlice("change"))
diff --git a/cmd/podman/load.go b/cmd/podman/load.go
index 8186f1cc2..2f66df7c8 100644
--- a/cmd/podman/load.go
+++ b/cmd/podman/load.go
@@ -93,6 +93,9 @@ func loadCmd(c *cli.Context) error {
input = outFile.Name()
}
}
+ if err := validateFileName(input); err != nil {
+ return err
+ }
var writer io.Writer
if !c.Bool("quiet") {
diff --git a/cmd/podman/parse.go b/cmd/podman/parse.go
index b70e0caf7..484b9723f 100644
--- a/cmd/podman/parse.go
+++ b/cmd/podman/parse.go
@@ -816,3 +816,12 @@ func getLoggingPath(opts []string) string {
}
return ""
}
+
+// validateFileName returns an error if filename contains ":"
+// as it is currently not supported
+func validateFileName(filename string) error {
+ if strings.Contains(filename, ":") {
+ return errors.Errorf("invalid filename (should not contain ':') %q", filename)
+ }
+ return nil
+}
diff --git a/cmd/podman/save.go b/cmd/podman/save.go
index e41e95f69..ce82b588a 100644
--- a/cmd/podman/save.go
+++ b/cmd/podman/save.go
@@ -87,6 +87,9 @@ func saveCmd(c *cli.Context) error {
return errors.Errorf("refusing to save to terminal. Use -o flag or redirect")
}
}
+ if err := validateFileName(output); err != nil {
+ return err
+ }
var dst, manifestType string
switch c.String("format") {
diff --git a/docs/podman-export.1.md b/docs/podman-export.1.md
index 142c45390..3cc1c7777 100644
--- a/docs/podman-export.1.md
+++ b/docs/podman-export.1.md
@@ -15,6 +15,7 @@ podman export - Export container's filesystem contents as a tar archive
**podman export** exports the filesystem of a container and saves it as a tarball
on the local machine. **podman export** writes to STDOUT by default and can be
redirected to a file using the **output flag**.
+Note: `:` is a restricted character and cannot be part of the file name.
**podman [GLOBAL OPTIONS]**
diff --git a/docs/podman-import.1.md b/docs/podman-import.1.md
index db0bbf559..4926fa4ec 100644
--- a/docs/podman-import.1.md
+++ b/docs/podman-import.1.md
@@ -18,6 +18,7 @@ podman\-import - Import a tarball and save it as a filesystem image
and saves it as a filesystem image. Remote tarballs can be specified using a URL.
Various image instructions can be configured with the **--change** flag and
a commit message can be set using the **--message** flag.
+Note: `:` is a restricted character and cannot be part of the file name.
**podman [GLOBAL OPTIONS]**
diff --git a/docs/podman-load.1.md b/docs/podman-load.1.md
index 0777059f1..7c1357503 100644
--- a/docs/podman-load.1.md
+++ b/docs/podman-load.1.md
@@ -16,6 +16,7 @@ podman\-load - Load an image from docker archive
**podman load** copies an image from either **docker-archive** or **oci-archive** stored
on the local machine. **podman load** reads from stdin by default or a file if the **input** flag is set.
The **quiet** flag suppresses the output when set.
+Note: `:` is a restricted character and cannot be part of the file name.
**podman [GLOBAL OPTIONS]**
diff --git a/docs/podman-save.1.md b/docs/podman-save.1.md
index 1b1efabf8..c88fc41ac 100644
--- a/docs/podman-save.1.md
+++ b/docs/podman-save.1.md
@@ -18,6 +18,7 @@ podman\-save - Save an image to docker-archive or oci-archive
with oci manifest type), or **docker-dir** (directory with v2s2 manifest type) on the local machine,
default is **docker-archive**. **podman save** writes to STDOUT by default and can be redirected to a
file using the **output** flag. The **quiet** flag suppresses the output when set.
+Note: `:` is a restricted character and cannot be part of the file name.
**podman [GLOBAL OPTIONS]**
diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go
index 6746ac769..3acb447f2 100644
--- a/test/e2e/export_test.go
+++ b/test/e2e/export_test.go
@@ -3,9 +3,10 @@ package integration
import (
"os"
+ "path/filepath"
+
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
- "path/filepath"
)
var _ = Describe("Podman export", func() {
@@ -43,4 +44,14 @@ var _ = Describe("Podman export", func() {
err = os.Remove(outfile)
Expect(err).To(BeNil())
})
+
+ It("podman export bad filename", func() {
+ _, ec, cid := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+
+ outfile := filepath.Join(podmanTest.TempDir, "container:with:colon.tar")
+ result := podmanTest.Podman([]string{"export", "-o", outfile, cid})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Not(Equal(0)))
+ })
})
diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go
index 351e57bf5..7009d5648 100644
--- a/test/e2e/save_test.go
+++ b/test/e2e/save_test.go
@@ -93,4 +93,12 @@ var _ = Describe("Podman save", func() {
Expect(save.ExitCode()).To(Equal(0))
})
+ It("podman save bad filename", func() {
+ outdir := filepath.Join(podmanTest.TempDir, "save:colon")
+
+ save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).To(Not(Equal(0)))
+ })
+
})