From 6f893138a3b593e6918c3dc1bd04d12f01d6c4a5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 13 Feb 2020 13:53:35 +0100 Subject: Make getAttribute return an empty array instead of nil when key not found --- main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 381c3b5..5e9811d 100644 --- a/main.go +++ b/main.go @@ -359,7 +359,7 @@ func (server *Server) getAttribute(dn string, attr string) ([]string, error) { } if pair == nil { - return nil, nil + return []string{}, nil } return parseValue(pair.Value) @@ -448,9 +448,6 @@ func (server *Server) handleBindInternal(state *State, r *message.BindRequest) ( if err != nil { return ldap.LDAPResultOperationsError, err } - if passwd == nil { - return ldap.LDAPResultNoSuchObject, fmt.Errorf("%s has no password", string(r.Name())) - } for _, hash := range passwd { valid := SSHAMatches(hash, []byte(r.AuthenticationSimple())) -- cgit v1.2.3