inspect conn
This commit is contained in:
@@ -86,7 +86,6 @@ func (cli *Client) Authenticate(ctx context.Context, username string, password s
|
|||||||
if username == "" || password == "" {
|
if username == "" || password == "" {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx, cancel = context.WithCancel(ctx)
|
ctx, cancel = context.WithCancel(ctx)
|
||||||
fmt.Println("Connect", ctx, username, password)
|
fmt.Println("Connect", ctx, username, password)
|
||||||
@@ -102,9 +101,12 @@ func (cli *Client) Authenticate(ctx context.Context, username string, password s
|
|||||||
if err != nil || details == nil {
|
if err != nil || details == nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
fmt.Println(details)
|
||||||
a := details["dn"]
|
a := details["dn"]
|
||||||
|
fmt.Println(a)
|
||||||
log.Println("Binding DN:", a[0], "with password:", password)
|
log.Println("Binding DN:", a[0], "with password:", password)
|
||||||
if err := cn.Bind(a[0], password); err != nil {
|
if err := cn.Bind(a[0], password); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
if err == errInvalidCredentials {
|
if err == errInvalidCredentials {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user