From f40b202750f68dc9b10d42a90b993bc28aaf50df Mon Sep 17 00:00:00 2001 From: zhouhao Date: Mon, 20 Feb 2017 17:12:20 +0800 Subject: [PATCH] validate: add rlimits's type judgment Signed-off-by: zhouhao --- validate/validate.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/validate/validate.go b/validate/validate.go index 53a6fc4f8..1d76b813b 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -257,6 +257,11 @@ func (v *Validator) CheckProcess() (msgs []string) { if process.Rlimits[index].Hard < process.Rlimits[index].Soft { msgs = append(msgs, fmt.Sprintf("hard limit of rlimit %s should not be less than soft limit.", process.Rlimits[index].Type)) } + for i := index + 1; i < len(process.Rlimits); i++ { + if process.Rlimits[index].Type == process.Rlimits[i].Type { + msgs = append(msgs, fmt.Sprintf("rlimit can not contain the same type %q.", process.Rlimits[index].Type)) + } + } } if len(process.ApparmorProfile) > 0 {