diff options
Diffstat (limited to 'src/nshd')
-rw-r--r-- | src/nshd/hackers_git/hackers.go | 1 | ||||
-rw-r--r-- | src/nshd/hackers_git/hackers_watch.go | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/nshd/hackers_git/hackers.go b/src/nshd/hackers_git/hackers.go index 814e921..60e6dd9 100644 --- a/src/nshd/hackers_git/hackers.go +++ b/src/nshd/hackers_git/hackers.go @@ -26,7 +26,6 @@ type Hackers struct { lock sync.RWMutex workers sync.WaitGroup users map[int32]user - passwords map[int32]string in_fd *inotify.Inotify in_wd_home inotify.Cint diff --git a/src/nshd/hackers_git/hackers_watch.go b/src/nshd/hackers_git/hackers_watch.go index 9592dab..f1c4018 100644 --- a/src/nshd/hackers_git/hackers_watch.go +++ b/src/nshd/hackers_git/hackers_watch.go @@ -31,7 +31,11 @@ func (o *Hackers) watchHomedir(uid int32) { delete(o.in_uid2wd, uid) logger.Info("could not watch: %s", o.users[uid].passwd.HomeDir) } + user := o.users[uid] + user.passwd.PwHash = load_user_password(user.passwd.HomeDir + "/.password") + o.users[uid] = user } + func (o *Hackers) unwatchHomedir(wd inotify.Cint) { err := o.in_fd.RmWatch(wd) if err != nil { @@ -41,6 +45,9 @@ func (o *Hackers) unwatchHomedir(wd inotify.Cint) { uid := o.in_wd2uid[wd] delete(o.in_wd2uid, wd) delete(o.in_uid2wd, uid) + user := o.users[uid] + user.passwd.PwHash = load_user_password(user.passwd.HomeDir + "/.password") + o.users[uid] = user } func (o *Hackers) close() { @@ -71,7 +78,6 @@ func (o *Hackers) reload() (err error) { o.users[user.passwd.UID] = user logger.Info("... success") o.watchHomedir(user.passwd.UID) - o.passwords[user.passwd.UID] = load_user_password(user.passwd.HomeDir + "/.password") } else { logger.Info("... error: %v", err) } @@ -87,7 +93,6 @@ func (o *Hackers) worker_handle_user_add(user user) { o.users[user.passwd.UID] = user o.watchHomedir(user.passwd.UID) - o.passwords[user.passwd.UID] = load_user_password(user.passwd.HomeDir + "/.password") } func (o *Hackers) worker_handle_user_del(uid int32) { @@ -111,7 +116,9 @@ func (o *Hackers) worker_handle_passwd(uid int32) { o.lock.Lock() defer o.lock.Unlock() - o.passwords[uid] = load_user_password(o.users[uid].passwd.HomeDir + "/.password") + user := o.users[uid] + user.passwd.PwHash = load_user_password(o.users[uid].passwd.HomeDir + "/.password") + o.users[uid] = user } func worker_error(format string, a ...interface{}) { |