diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-10-04 02:11:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-04 02:11:56 -0700 |
commit | 1fe955600979f54ada204afa6c357fd094d6f549 (patch) | |
tree | d22ee28ccf664986109f61c52a041aa803e2e505 /libpod | |
parent | 7af4074c6f96d0fabd2ab5dd6c5773053f80aa08 (diff) | |
parent | c5e26f8e40f3bc51ee7cdfce8eb4207105e4c4ba (diff) | |
download | podman-1fe955600979f54ada204afa6c357fd094d6f549.tar.gz podman-1fe955600979f54ada204afa6c357fd094d6f549.tar.bz2 podman-1fe955600979f54ada204afa6c357fd094d6f549.zip |
Merge pull request #4188 from Mrigank11/validate_network_name
podman network create: validate user input
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/options.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libpod/options.go b/libpod/options.go index d28cb3d8c..22ab22a95 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -20,8 +20,8 @@ import ( ) var ( - nameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$") - regexError = errors.Wrapf(define.ErrInvalidArg, "names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*") + NameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$") + RegexError = errors.Wrapf(define.ErrInvalidArg, "names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*") ) // Runtime Creation Options @@ -648,8 +648,8 @@ func WithName(name string) CtrCreateOption { } // Check the name against a regex - if !nameRegex.MatchString(name) { - return regexError + if !NameRegex.MatchString(name) { + return RegexError } ctr.config.Name = name @@ -1426,8 +1426,8 @@ func WithVolumeName(name string) VolumeCreateOption { } // Check the name against a regex - if !nameRegex.MatchString(name) { - return regexError + if !NameRegex.MatchString(name) { + return RegexError } volume.config.Name = name @@ -1532,8 +1532,8 @@ func WithPodName(name string) PodCreateOption { } // Check the name against a regex - if !nameRegex.MatchString(name) { - return regexError + if !NameRegex.MatchString(name) { + return RegexError } pod.config.Name = name @@ -1550,8 +1550,8 @@ func WithPodHostname(hostname string) PodCreateOption { } // Check the hostname against a regex - if !nameRegex.MatchString(hostname) { - return regexError + if !NameRegex.MatchString(hostname) { + return RegexError } pod.config.Hostname = hostname |