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 <npayart@gmail.com>
This commit is contained in:
parent
d402c3bea7
commit
0bb792a0ea
1 changed files with 1 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue