Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
id
auth
Commits
a439f055
Commit
a439f055
authored
Jan 11, 2018
by
ale
Browse files
Update ai3/go-common
parent
e0d2b845
Changes
3
Hide whitespace changes
Inline
Side-by-side
vendor/git.autistici.org/ai3/go-common/ldap/pool.go
View file @
a439f055
...
...
@@ -40,10 +40,12 @@ func (p *ConnectionPool) connect(ctx context.Context) (*ldap.Conn, error) {
conn
:=
ldap
.
NewConn
(
c
,
false
)
conn
.
Start
()
conn
.
SetTimeout
(
time
.
Until
(
deadline
))
if
_
,
err
=
conn
.
SimpleBind
(
ldap
.
NewSimpleBindRequest
(
p
.
bindDN
,
p
.
bindPw
,
nil
));
err
!=
nil
{
conn
.
Close
()
return
nil
,
err
if
p
.
bindDN
!=
""
{
conn
.
SetTimeout
(
time
.
Until
(
deadline
))
if
_
,
err
=
conn
.
SimpleBind
(
ldap
.
NewSimpleBindRequest
(
p
.
bindDN
,
p
.
bindPw
,
nil
));
err
!=
nil
{
conn
.
Close
()
return
nil
,
err
}
}
return
conn
,
err
...
...
vendor/git.autistici.org/ai3/go-common/ldap/search.go
View file @
a439f055
...
...
@@ -10,16 +10,24 @@ import (
"git.autistici.org/ai3/go-common/clientutil"
)
// Treat all errors as potential network-level issues, except for a
// whitelist of LDAP protocol level errors that we know are benign.
// Interface matched by net.Error.
type
hasTemporary
interface
{
Temporary
()
bool
}
// Treat network errors as temporary. Other errors are permanent by
// default.
func
isTemporaryLDAPError
(
err
error
)
bool
{
ldapErr
,
ok
:=
err
.
(
*
ldap
.
Error
)
if
!
ok
{
return
true
}
switch
ldapErr
.
ResultCode
{
case
ldap
.
ErrorNetwork
:
return
true
switch
v
:=
err
.
(
type
)
{
case
*
ldap
.
Error
:
switch
v
.
ResultCode
{
case
ldap
.
ErrorNetwork
:
return
true
default
:
return
false
}
case
hasTemporary
:
return
v
.
Temporary
()
default
:
return
false
}
...
...
@@ -32,6 +40,7 @@ func (p *ConnectionPool) Search(ctx context.Context, searchRequest *ldap.SearchR
err
:=
clientutil
.
Retry
(
func
()
error
{
conn
,
err
:=
p
.
Get
(
ctx
)
if
err
!=
nil
{
// Here conn is nil, so we don't need to Release it.
if
isTemporaryLDAPError
(
err
)
{
return
clientutil
.
TempError
(
err
)
}
...
...
@@ -44,7 +53,7 @@ func (p *ConnectionPool) Search(ctx context.Context, searchRequest *ldap.SearchR
result
,
err
=
conn
.
Search
(
searchRequest
)
if
err
!=
nil
&&
isTemporaryLDAPError
(
err
)
{
p
.
Release
(
conn
,
nil
)
p
.
Release
(
conn
,
err
)
return
clientutil
.
TempError
(
err
)
}
p
.
Release
(
conn
,
err
)
...
...
vendor/vendor.json
View file @
a439f055
...
...
@@ -5,32 +5,32 @@
{
"checksumSHA1"
:
"raJx5BjBbVQG0ylGSjPpi+JvqjU="
,
"path"
:
"git.autistici.org/ai3/go-common"
,
"revision"
:
"
8cedcb1d73128f5566216cb3e39ad1ccea318213
"
,
"revisionTime"
:
"201
7-12-16T15:39:23
Z"
"revision"
:
"
3e38f41af368c36cd5d6642abcf1460cf4c65e78
"
,
"revisionTime"
:
"201
8-01-11T08:21:54
Z"
},
{
"checksumSHA1"
:
"o+rWKVQIDy79ZwrItwa5/whAL6g="
,
"path"
:
"git.autistici.org/ai3/go-common/clientutil"
,
"revision"
:
"
9b20acad90c411c48f7ddc837a35ef3d0d6f98d4
"
,
"revisionTime"
:
"201
7-12-17T20:32:41
Z"
"revision"
:
"
3e38f41af368c36cd5d6642abcf1460cf4c65e78
"
,
"revisionTime"
:
"201
8-01-11T08:21:54
Z"
},
{
"checksumSHA1"
:
"
mEnXMNziH82HFtGngHU19VHTVHs
="
,
"checksumSHA1"
:
"
jnfq/QeWcZCebhGuJ+t8nrd8POY
="
,
"path"
:
"git.autistici.org/ai3/go-common/ldap"
,
"revision"
:
"
86a36cf5da88919ee7d9ec12d1a92043b16fcc9c
"
,
"revisionTime"
:
"201
7-12-10T11:04:55
Z"
"revision"
:
"
3e38f41af368c36cd5d6642abcf1460cf4c65e78
"
,
"revisionTime"
:
"201
8-01-11T08:21:54
Z"
},
{
"checksumSHA1"
:
"z1034Bd8fOSLvtOP3VLf65YOQyA="
,
"path"
:
"git.autistici.org/ai3/go-common/pwhash"
,
"revision"
:
"
7eb77848e6d9507db2549ff853e968d1906dd8f4
"
,
"revisionTime"
:
"201
7-12-22T23:58
:5
5
Z"
"revision"
:
"
3e38f41af368c36cd5d6642abcf1460cf4c65e78
"
,
"revisionTime"
:
"201
8-01-11T08:21
:5
4
Z"
},
{
"checksumSHA1"
:
"T2vf4xzKRqoIjfXlofMgudKA8rA="
,
"path"
:
"git.autistici.org/ai3/go-common/unix"
,
"revision"
:
"
8cedcb1d73128f5566216cb3e39ad1ccea318213
"
,
"revisionTime"
:
"201
7-12-16T15:39:23
Z"
"revision"
:
"
3e38f41af368c36cd5d6642abcf1460cf4c65e78
"
,
"revisionTime"
:
"201
8-01-11T08:21:54
Z"
},
{
"checksumSHA1"
:
"7Kbb9vTjqcQhhxtSGpmp9rk6PUk="
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment