diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-11 23:28:54 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-11 23:28:54 -0600 |
commit | 2130c2ab56eb130c2fb6112098ea8ccb1fa235b0 (patch) | |
tree | d3329cc7a02e848035c6c6c5a800482c52f11995 /src/nshd | |
parent | 7374395eb39700cd71f77be4f218eadb2712d19d (diff) |
fix several all*Enumerator initializers
Diffstat (limited to 'src/nshd')
-rw-r--r-- | src/nshd/hackers_git/db_group.go | 1 | ||||
-rw-r--r-- | src/nshd/hackers_git/db_passwd.go | 1 | ||||
-rw-r--r-- | src/nshd/hackers_git/db_shadow.go | 16 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/nshd/hackers_git/db_group.go b/src/nshd/hackers_git/db_group.go index 58115f8..63a9fe4 100644 --- a/src/nshd/hackers_git/db_group.go +++ b/src/nshd/hackers_git/db_group.go @@ -129,6 +129,7 @@ func (o *Hackers) Group_All(cred p.Ucred, req p.Request_Group_All) p.Group_Enume i := uint(0) for group, _ := range o.groups { e.groups[i] = group + i++ } return &e } diff --git a/src/nshd/hackers_git/db_passwd.go b/src/nshd/hackers_git/db_passwd.go index 750e458..32570fb 100644 --- a/src/nshd/hackers_git/db_passwd.go +++ b/src/nshd/hackers_git/db_passwd.go @@ -78,6 +78,7 @@ func (o *Hackers) Passwd_All(cred p.Ucred, req p.Request_Passwd_All) p.Passwd_En i := uint(0) for uid, _ := range o.users { e.uids[i] = uid + i++ } return &e } diff --git a/src/nshd/hackers_git/db_shadow.go b/src/nshd/hackers_git/db_shadow.go index 97af6e9..fecb9f8 100644 --- a/src/nshd/hackers_git/db_shadow.go +++ b/src/nshd/hackers_git/db_shadow.go @@ -68,22 +68,20 @@ func (o *allShadowEnumerator) GenericGetNext() (n *interface{}, err error) { return } -func (o *Hackers) newAllShadowEnumerator() *allShadowEnumerator { +func (o *Hackers) Shadow_All(cred p.Ucred, req p.Request_Shadow_All) p.Shadow_Enumerator { + if cred.Uid != 0 { + return util.Shadow_Ø{} + } o.lock.RLock() e := allShadowEnumerator{ uids: make([]int32, len(o.users)), backend: o, done: false, } + i := uint(0) for uid, _ := range o.users { - e.uids = append(e.uids, uid) + e.uids[i] = uid + i++ } return &e } - -func (o *Hackers) Shadow_All(cred p.Ucred, req p.Request_Shadow_All) p.Shadow_Enumerator { - if cred.Uid != 0 { - return util.Shadow_Ø{} - } - return o.newAllShadowEnumerator() -} |