Skip to content

Commit

Permalink
[bugfix] update account pointer within session on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
b1naryth1ef committed Jul 25, 2017
1 parent e99908a commit 4fe5e9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sshd.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ func (s *SSHDState) reloadAccounts() {
s.accounts = accounts
s.keys = keys

// Now, iterate over sessions and close any invalid ones
// Now, iterate over all active sessions and update them, closing any sessions
// that point to now-invalid accounts.
for _, session := range s.sessions {
if _, exists := accounts[session.Account.Username]; !exists {
session.Account = accounts[session.Account.Username]

if session.Account == nil {
s.log.Warn(
"Closing session for user that was deleted from accounts",
zap.String("username", session.Account.Username),
Expand Down

0 comments on commit 4fe5e9d

Please sign in to comment.