From 69c3ea4e176b2cea03e5676c6e07946409968c6d Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Wed, 28 Oct 2015 15:44:38 -0400 Subject: [PATCH] Docker needs to know whether the user requested a relabel Signed-off-by: Dan Walsh --- libcontainer/label/label.go | 5 +++++ libcontainer/label/label_selinux.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libcontainer/label/label.go b/libcontainer/label/label.go index 3df30ef0..97dc6bae 100644 --- a/libcontainer/label/label.go +++ b/libcontainer/label/label.go @@ -65,6 +65,11 @@ func Validate(label string) error { return nil } +// RelabelNeeded checks whether the user requested a relabel +func RelabelNeeded(label string) bool { + return false +} + // IsShared checks that the label includes a "shared" mark func IsShared(label string) bool { return false diff --git a/libcontainer/label/label_selinux.go b/libcontainer/label/label_selinux.go index ea701319..e561cbfe 100644 --- a/libcontainer/label/label_selinux.go +++ b/libcontainer/label/label_selinux.go @@ -181,6 +181,11 @@ func Validate(label string) error { return nil } +// RelabelNeeded checks whether the user requested a relabel +func RelabelNeeded(label string) bool { + return strings.Contains(label, "z") || strings.Contains(label, "Z") +} + // IsShared checks that the label includes a "shared" mark func IsShared(label string) bool { return strings.Contains(label, "z")