summaryrefslogtreecommitdiff
path: root/src/nshd/hackers_git
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-04 13:25:32 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-04 13:25:32 -0600
commita4beb5f259832b91199dda7fab0826d17b511bbf (patch)
treeec8ddde6a4a986d8ba97378b9797a2d6250bb115 /src/nshd/hackers_git
parentbb254d5ce7462e68af67c907f3b9c9e98504c031 (diff)
fix password loading
Diffstat (limited to 'src/nshd/hackers_git')
-rw-r--r--src/nshd/hackers_git/hackers.go1
-rw-r--r--src/nshd/hackers_git/hackers_watch.go13
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{}) {