mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 12:28:01 +08:00
Fixing all the issues with upgrading to golangci-lint 1.21.0
This commit is contained in:
@@ -637,21 +637,25 @@ func newTestLDAPServer() *testLDAPServer {
|
||||
server.SearchFunc("", l)
|
||||
l.server = server
|
||||
l.quitCh = quitCh
|
||||
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *testLDAPServer) Start() {
|
||||
addr := fmt.Sprintf("%s:%d", LDAPAddress, LDAPPort)
|
||||
|
||||
go func() {
|
||||
if err := l.server.ListenAndServe(addr); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}()
|
||||
|
||||
for {
|
||||
_, err := net.Dial("tcp", addr)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
@@ -664,10 +668,12 @@ func (l *testLDAPServer) Bind(bindDN, bindSimplePw string, conn net.Conn) (vldap
|
||||
if bindDN == "" || bindSimplePw == "" {
|
||||
return vldap.LDAPResultInappropriateAuthentication, errors.New("ldap: bind creds required")
|
||||
}
|
||||
|
||||
if (bindDN == LDAPBindDN && bindSimplePw == LDAPBindPassword) ||
|
||||
(bindDN == fmt.Sprintf("cn=%s,%s", username, LDAPBaseDN) && bindSimplePw == passphrase) {
|
||||
return vldap.LDAPResultSuccess, nil
|
||||
}
|
||||
|
||||
return vldap.LDAPResultInvalidCredentials, errors.New("ldap: invalid credentials")
|
||||
}
|
||||
|
||||
@@ -682,6 +688,7 @@ func (l *testLDAPServer) Search(boundDN string, req vldap.SearchRequest,
|
||||
ResultCode: vldap.LDAPResultSuccess,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return vldap.ServerSearchResult{}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user