summaryrefslogtreecommitdiff
path: root/libpod/runtime_ctr.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-10-29 10:28:38 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-11-08 13:33:30 +0100
commit6444f2402839330f977cfe1c701ca331a915047b (patch)
tree5ac9d000ab787608ddac3617977d3e84579a4dd3 /libpod/runtime_ctr.go
parent865653b661dd9dbc5d31f08cbf3f14ed32c82850 (diff)
downloadpodman-6444f2402839330f977cfe1c701ca331a915047b.tar.gz
podman-6444f2402839330f977cfe1c701ca331a915047b.tar.bz2
podman-6444f2402839330f977cfe1c701ca331a915047b.zip
pod/container create: resolve conflicts of generated names
Address the TOCTOU when generating random names by having at most 10 attempts to assign a random name when creating a pod or container. [NO TESTS NEEDED] since I do not know a way to force a conflict with randomly generated names in a reasonable time frame. Fixes: #11735 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r--libpod/runtime_ctr.go9
1 files changed, 0 insertions, 9 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 0a7db33f1..114bf9315 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -326,15 +326,6 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
}
}
- if ctr.config.Name == "" {
- name, err := r.generateName()
- if err != nil {
- return nil, err
- }
-
- ctr.config.Name = name
- }
-
// Check CGroup parent sanity, and set it if it was not set.
// Only if we're actually configuring CGroups.
if !ctr.config.NoCgroups {