From 0bb792a0ea506e217254ffbaaceef7fe98c6d90f Mon Sep 17 00:00:00 2001 From: Nicolas Payart Date: Tue, 19 Oct 2021 09:11:31 +0200 Subject: [PATCH] Fix exclude-users-regex option When a session User matches the exclude-users-regex pattern, it is probably not found in exclude-users list. The current OR condition makes the user filtered. We expect a AND condition here (user not in exclude-users AND not in exclude-users-regex) Signed-off-by: Nicolas Payart --- terminator/terminator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminator/terminator.go b/terminator/terminator.go index 707a567..f5a6c87 100644 --- a/terminator/terminator.go +++ b/terminator/terminator.go @@ -81,7 +81,7 @@ func (t *Terminator) filterUsers(sessions []*base.Session) (filtered []*base.Ses for _, session := range sessions { if t.config.IncludeUsers == nil && includeRegex == nil { // append all sessions except excluded users - if !base.InSlice(session.User, excludeUsers) || (excludeRegex != nil && !excludeRegex.MatchString(session.User)) { + if !base.InSlice(session.User, excludeUsers) && (excludeRegex != nil && !excludeRegex.MatchString(session.User)) { filtered = append(filtered, session) } } else {