|
|
|
@ -8,11 +8,11 @@ package ldap
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"crypto/tls" |
|
|
|
|
"errors" |
|
|
|
|
"fmt" |
|
|
|
|
"strings" |
|
|
|
|
"net" |
|
|
|
|
"net/url" |
|
|
|
|
"errors" |
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
"gopkg.in/ldap.v2" |
|
|
|
|
|
|
|
|
@ -21,7 +21,6 @@ import (
|
|
|
|
|
|
|
|
|
|
type SecurityProtocol int |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Basic LDAP authentication service
|
|
|
|
|
type Source struct { |
|
|
|
|
Name string // canonical name (ie. corporate.ad)
|
|
|
|
@ -118,7 +117,7 @@ func dial(ls *Source) (*ldap.Conn, error) {
|
|
|
|
|
if strings.HasPrefix(ldapUrl, "ldapi://") { |
|
|
|
|
x := strings.IndexAny(ldapUrl[8:], "/?#") |
|
|
|
|
if x >= 0 { |
|
|
|
|
ldapiHost = ldapUrl[8:8+x] |
|
|
|
|
ldapiHost = ldapUrl[8 : 8+x] |
|
|
|
|
ldapUrl = "ldapi://" + ldapUrl[8+x:] |
|
|
|
|
} else { |
|
|
|
|
ldapiHost = ldapUrl[8:] |
|
|
|
@ -140,7 +139,6 @@ func dial(ls *Source) (*ldap.Conn, error) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if u.User != nil || u.Path != "" || u.Fragment != "" || u.RawQuery != "" || u.Opaque != "" { |
|
|
|
|
return nil, errors.New("LDAP URLs (for now) do not support pathes, fragments, querries or opaque form") |
|
|
|
|
} |
|
|
|
|