diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-08-28 20:43:12 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-08-28 20:43:12 -0600 |
commit | b55355121e0ed259097254447f16739b0f3da61d (patch) | |
tree | 3149a5cfe50952e9a3ea6c9a9e888b3da72dbfff /src/nshd/hackers_git/hackers.go | |
parent | 3c237531f5067340e34b01c7f7ea45fa55c39657 (diff) |
implement hackers_watch
Diffstat (limited to 'src/nshd/hackers_git/hackers.go')
-rw-r--r-- | src/nshd/hackers_git/hackers.go | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/src/nshd/hackers_git/hackers.go b/src/nshd/hackers_git/hackers.go index b8ef949..f7c4573 100644 --- a/src/nshd/hackers_git/hackers.go +++ b/src/nshd/hackers_git/hackers.go @@ -2,39 +2,46 @@ package hackers_git import ( "inotify" - _ "gopkg.in/yaml.v2" p "nslcd_proto" "nslcd_systemd" + "sd_daemon/logger" "sync" ) +type Config struct { + Pam_password_prohibit_message string + Yamldir string +} + type Hackers struct { p.NullBackend - lock *sync.RWMutex - pam_password_prohibit_message string + cfg Config + lock sync.RWMutex + users map[int32]p.Passwd + passwords map[int32]string + + in_fd *inotify.Inotify + in_wd_home inotify.Cint + in_wd_yaml inotify.Cint + in_uid2wd map[int32]inotify.Cint + in_wd2uid map[inotify.Cint]int32 } var _ nslcd_systemd.Backend = &Hackers{} var _ p.Backend = &Hackers{} -func (o *Hackers) Reload() { +func (o *Hackers) Close() { + logger.Info("Closing hackers.git session") o.lock.Lock() defer o.lock.Unlock() - // TODO -} - -func NewHackers(yamlDir string) *Hackers { - // TODO - var hackers Hackers - - var lock sync.RWMutex - hackers.lock = &lock - go inotify_watcher(yamlDir) - - return &hackers + o.close() } -func inotify_watcher(yamlDir string) { - // TODO +func (o *Hackers) Reload() error { + logger.Info("Loading hackers.git session") + o.lock.Lock() + defer o.lock.Unlock() + + return o.reload() } |