summaryrefslogtreecommitdiff
path: root/src/nshd/hackers_git/hackers.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/nshd/hackers_git/hackers.go')
-rw-r--r--src/nshd/hackers_git/hackers.go43
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()
}