diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/export.go | 3 | ||||
-rw-r--r-- | cmd/podman/import.go | 4 | ||||
-rw-r--r-- | cmd/podman/load.go | 3 | ||||
-rw-r--r-- | cmd/podman/parse.go | 9 | ||||
-rw-r--r-- | cmd/podman/save.go | 3 |
5 files changed, 22 insertions, 0 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") { |