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
ai3
accountserver
Commits
5e354f1e
Commit
5e354f1e
authored
Dec 05, 2021
by
ale
Browse files
Do not log LDAP write ops by default
parent
cd352f52
Pipeline
#24832
passed with stages
in 3 minutes and 25 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/ldap/tx.go
View file @
5e354f1e
...
...
@@ -8,6 +8,8 @@ import (
"github.com/go-ldap/ldap/v3"
)
var
debugLDAP
=
false
// Generic interface to LDAP - allows us to stub out the LDAP client while
// testing.
type
ldapConn
interface
{
...
...
@@ -132,14 +134,18 @@ func (tx *ldapTX) Commit(ctx context.Context) error {
if
isEmptyAddRequest
(
ar
)
{
continue
}
log
.
Printf
(
"issuing AddRequest: %+v"
,
ar
)
if
debugLDAP
{
log
.
Printf
(
"issuing AddRequest: %+v"
,
ar
)
}
err
=
tx
.
conn
.
Add
(
ctx
,
ar
)
}
else
{
mr
:=
mods
[
dn
]
if
isEmptyModifyRequest
(
mr
)
{
continue
}
log
.
Printf
(
"issuing ModifyRequest: %+v"
,
mr
)
if
debugLDAP
{
log
.
Printf
(
"issuing ModifyRequest: %+v"
,
mr
)
}
err
=
tx
.
conn
.
Modify
(
ctx
,
mr
)
}
if
err
!=
nil
{
...
...
@@ -190,7 +196,9 @@ func (tx *ldapTX) updateModifyRequest(ctx context.Context, mr *ldap.ModifyReques
// perform an Add or a Replace.
old
,
ok
:=
tx
.
rcache
[
cacheKey
(
attr
.
dn
,
attr
.
attr
)]
if
!
ok
{
log
.
Printf
(
"tx: pessimistic fallback for %s %s"
,
attr
.
dn
,
attr
.
attr
)
if
debugLDAP
{
log
.
Printf
(
"tx: pessimistic fallback for %s %s"
,
attr
.
dn
,
attr
.
attr
)
}
oldFromLDAP
:=
tx
.
readAttributeValuesNoCache
(
ctx
,
attr
.
dn
,
attr
.
attr
)
if
len
(
oldFromLDAP
)
>
0
{
ok
=
true
...
...
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