summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2022-05-14 15:03:10 -0400
committersiddharth <s@ricketyspace.net>2022-05-14 15:03:10 -0400
commit24bc976b0d06637a72b013f3443815bf4ef71bc1 (patch)
treecd82da13145794dda89dea0b42452375acfebcae
parent39f2d7613f8a9ee72d6bf555491b3fc043ceaf03 (diff)
lib: SRPServer: add GetUser
-rw-r--r--lib/srp.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/srp.go b/lib/srp.go
index 0c5843b..f6773d0 100644
--- a/lib/srp.go
+++ b/lib/srp.go
@@ -104,6 +104,15 @@ func (server *SRPServer) RegisterUser(user *SRPUser) error {
return nil
}
+func (server *SRPServer) GetUser(ident string) (*SRPUser, error) {
+ for _, u := range server.users {
+ if u.ident == ident {
+ return u, nil
+ }
+ }
+ return nil, CPError{"user not found"}
+}
+
func NewSRPUser(n, g, k, ident, pass string) (*SRPUser, error) {
var err error
var ok bool