summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-05 00:43:54 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-05 00:43:54 -0600
commit955e8e2dc4bd7865f2b21139d61424a168e5a041 (patch)
tree89c135b5531d5562b84d250c78dc1422e4c0becf /src
parent79f7c721b7275208bb2bef0fec87e1a732353b74 (diff)
The way nslcd_proto's GenericGetNext was designed, nil checks didn't work
Diffstat (limited to 'src')
-rw-r--r--src/nshd/hackers_git/db_passwd.go9
-rw-r--r--src/nshd/hackers_git/db_shadow.go9
-rw-r--r--src/nslcd_proto/enumerator@T.got2
-rwxr-xr-xsrc/nslcd_proto/func_handlerequest.go.sh6
-rw-r--r--src/nslcd_proto/util/enumerator@T.got11
5 files changed, 26 insertions, 11 deletions
diff --git a/src/nshd/hackers_git/db_passwd.go b/src/nshd/hackers_git/db_passwd.go
index 8aad45e..2cfaccd 100644
--- a/src/nshd/hackers_git/db_passwd.go
+++ b/src/nshd/hackers_git/db_passwd.go
@@ -60,8 +60,13 @@ func (e *allPasswdEnumerator) GetNext() (*p.Passwd, error) {
return nil, nil
}
-func (e *allPasswdEnumerator) GenericGetNext() (interface{}, error) {
- return e.GetNext()
+func (o *allPasswdEnumerator) GenericGetNext() (n *interface{}, err error) {
+ a, err := o.GetNext()
+ if a != nil {
+ b := (interface{})(*a)
+ n = &b
+ }
+ return
}
func (o *Hackers) newAllPasswdEnumerator() *allPasswdEnumerator {
diff --git a/src/nshd/hackers_git/db_shadow.go b/src/nshd/hackers_git/db_shadow.go
index 468f79d..97af6e9 100644
--- a/src/nshd/hackers_git/db_shadow.go
+++ b/src/nshd/hackers_git/db_shadow.go
@@ -59,8 +59,13 @@ func (e *allShadowEnumerator) GetNext() (*p.Shadow, error) {
return nil, nil
}
-func (e *allShadowEnumerator) GenericGetNext() (interface{}, error) {
- return e.GetNext()
+func (o *allShadowEnumerator) GenericGetNext() (n *interface{}, err error) {
+ a, err := o.GetNext()
+ if a != nil {
+ b := (interface{})(*a)
+ n = &b
+ }
+ return
}
func (o *Hackers) newAllShadowEnumerator() *allShadowEnumerator {
diff --git a/src/nslcd_proto/enumerator@T.got b/src/nslcd_proto/enumerator@T.got
index 023c774..cad54fa 100644
--- a/src/nslcd_proto/enumerator@T.got
+++ b/src/nslcd_proto/enumerator@T.got
@@ -2,7 +2,7 @@ package nslcd_proto
type <T>_Enumerator interface {
GetNext() (n *<T>, err error)
- GenericGetNext() (n interface{}, err error)
+ GenericGetNext() (n *interface{}, err error)
}
// -*- Mode: Go -*-
diff --git a/src/nslcd_proto/func_handlerequest.go.sh b/src/nslcd_proto/func_handlerequest.go.sh
index 8034594..45e0ed6 100755
--- a/src/nslcd_proto/func_handlerequest.go.sh
+++ b/src/nslcd_proto/func_handlerequest.go.sh
@@ -10,7 +10,7 @@ import (
)
type enumerator interface {
- GenericGetNext() (n interface{}, err error)
+ GenericGetNext() (n *interface{}, err error)
}
func handleRequest(backend Backend, in io.Reader, out io.Writer, cred Ucred) {
@@ -44,11 +44,11 @@ done < "$requests"
write(out, NSLCD_VERSION)
write(out, action)
- var result interface{}
+ var result *interface{}
var err error
for result, err = res.GenericGetNext(); (result != nil) && (err == nil); result, err = res.GenericGetNext() {
write(out, NSLCD_RESULT_BEGIN)
- write(out, result)
+ write(out, *result)
}
if err != nil {
panic(err)
diff --git a/src/nslcd_proto/util/enumerator@T.got b/src/nslcd_proto/util/enumerator@T.got
index e1dd2ae..5ce5cb5 100644
--- a/src/nslcd_proto/util/enumerator@T.got
+++ b/src/nslcd_proto/util/enumerator@T.got
@@ -22,8 +22,13 @@ func (o *<T>_List) GetNext() (n *nslcd_proto.<T>, err error) {
return
}
-func (o *<T>_List) GenericGetNext() (n interface{}, err error) {
- return o.GetNext()
+func (o *<T>_List) GenericGetNext() (n *interface{}, err error) {
+ a, err := o.GetNext()
+ if a != nil {
+ b := (interface{})(*a)
+ n = &b
+ }
+ return
}
type <T>_Ø struct{}
@@ -33,7 +38,7 @@ var _ nslcd_proto.<T>_Enumerator = <T>_Ø{}
func (o <T>_Ø) GetNext() (*nslcd_proto.<T>, error) {
return nil, nil
}
-func (o <T>_Ø) GenericGetNext() (interface{}, error) {
+func (o <T>_Ø) GenericGetNext() (*interface{}, error) {
return nil, nil
}