mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
+17
-16
@@ -3,20 +3,21 @@ package errors
|
|||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrBadConfig = errors.New("config: invalid config")
|
ErrBadConfig = errors.New("config: invalid config")
|
||||||
ErrRepoNotFound = errors.New("repository: not found")
|
ErrRepoNotFound = errors.New("repository: not found")
|
||||||
ErrRepoIsNotDir = errors.New("repository: not a directory")
|
ErrRepoIsNotDir = errors.New("repository: not a directory")
|
||||||
ErrRepoBadVersion = errors.New("repository: unsupported layout version")
|
ErrRepoBadVersion = errors.New("repository: unsupported layout version")
|
||||||
ErrManifestNotFound = errors.New("manifest: not found")
|
ErrManifestNotFound = errors.New("manifest: not found")
|
||||||
ErrBadManifest = errors.New("manifest: invalid contents")
|
ErrBadManifest = errors.New("manifest: invalid contents")
|
||||||
ErrUploadNotFound = errors.New("uploads: not found")
|
ErrUploadNotFound = errors.New("uploads: not found")
|
||||||
ErrBadUploadRange = errors.New("uploads: bad range")
|
ErrBadUploadRange = errors.New("uploads: bad range")
|
||||||
ErrBlobNotFound = errors.New("blob: not found")
|
ErrBlobNotFound = errors.New("blob: not found")
|
||||||
ErrBadBlob = errors.New("blob: bad blob")
|
ErrBadBlob = errors.New("blob: bad blob")
|
||||||
ErrBadBlobDigest = errors.New("blob: bad blob digest")
|
ErrBadBlobDigest = errors.New("blob: bad blob digest")
|
||||||
ErrUnknownCode = errors.New("error: unknown error code")
|
ErrUnknownCode = errors.New("error: unknown error code")
|
||||||
ErrBadCACert = errors.New("tls: invalid ca cert")
|
ErrBadCACert = errors.New("tls: invalid ca cert")
|
||||||
ErrBadUser = errors.New("ldap: non-existent user")
|
ErrBadUser = errors.New("ldap: non-existent user")
|
||||||
ErrEntriesExceeded = errors.New("ldap: too many entries returned")
|
ErrEntriesExceeded = errors.New("ldap: too many entries returned")
|
||||||
ErrLDAPConfig = errors.New("config: invalid LDAP configuration")
|
ErrLDAPEmptyPassphrase = errors.New("ldap: empty passphrase")
|
||||||
|
ErrLDAPConfig = errors.New("config: invalid LDAP configuration")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ func (lc *LDAPClient) Connect() error {
|
|||||||
|
|
||||||
// Authenticate authenticates the user against the ldap backend.
|
// Authenticate authenticates the user against the ldap backend.
|
||||||
func (lc *LDAPClient) Authenticate(username, password string) (bool, map[string]string, error) {
|
func (lc *LDAPClient) Authenticate(username, password string) (bool, map[string]string, error) {
|
||||||
|
if password == "" {
|
||||||
|
// RFC 4513 section 5.1.2
|
||||||
|
return false, nil, errors.ErrLDAPEmptyPassphrase
|
||||||
|
}
|
||||||
|
|
||||||
err := lc.Connect()
|
err := lc.Connect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user