summaryrefslogtreecommitdiff
path: root/src/nshd/hackers_git/db_config.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-12 10:35:52 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-12 10:35:52 -0600
commite8199ec88c7ca8107c4fb9238e383a4a9eb981ee (patch)
tree250c514c0cb4ec2b8bd442f4e80e916fb8ad6f2c /src/nshd/hackers_git/db_config.go
parentf0302e1ac1a12711a9f49c3d7a62bcdfcaca7eed (diff)
Derp, channels and goroutines are enumerators
Diffstat (limited to 'src/nshd/hackers_git/db_config.go')
-rw-r--r--src/nshd/hackers_git/db_config.go32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/nshd/hackers_git/db_config.go b/src/nshd/hackers_git/db_config.go
index fde16b3..7e96059 100644
--- a/src/nshd/hackers_git/db_config.go
+++ b/src/nshd/hackers_git/db_config.go
@@ -1,26 +1,20 @@
package hackers_git
-import (
- p "nslcd_proto"
- "nslcd_proto/util"
-)
+import p "nslcd_proto"
-func (o *Hackers) Config_Get(cred p.Ucred, req p.Request_Config_Get) p.Config_Enumerator {
+func (o *Hackers) Config_Get(cred p.Ucred, req p.Request_Config_Get) <-chan p.Config {
o.lock.RLock()
- defer o.lock.RUnlock()
+ ret := make(chan p.Config)
+ go func() {
+ defer o.lock.RUnlock()
+ defer close(ret)
- var val *string = nil
-
- switch req.Key {
- case p.NSLCD_CONFIG_PAM_PASSWORD_PROHIBIT_MESSAGE:
- if o.Cfg.Pam_password_prohibit_message != "" {
- val = &o.Cfg.Pam_password_prohibit_message
+ switch req.Key {
+ case p.NSLCD_CONFIG_PAM_PASSWORD_PROHIBIT_MESSAGE:
+ if o.Cfg.Pam_password_prohibit_message != "" {
+ ret <- p.Config{Value: o.Cfg.Pam_password_prohibit_message}
+ }
}
- }
-
- if val != nil {
- return util.New_Config_List([]p.Config{p.Config{Value: *val}})
- } else {
- return util.Config_Ø{}
- }
+ }()
+ return ret
}