feat: [OCISDEV-1032][stable-8.2] ldap config and retry policy (#12723)
* feat: ldap config and retry policy, bump reva # Conflicts: # go.mod # go.sum # services/graph/pkg/config/config.go # vendor/github.com/owncloud/reva/v2/pkg/utils/ldap/pool.go # vendor/github.com/owncloud/reva/v2/pkg/utils/ldap/reconnect.go # vendor/modules.txt * test: e2e ldap # Conflicts: # .github/workflows/acceptance-tests.yml * test: e2e ldap distributed # Conflicts: # .github/workflows/acceptance-tests.yml * fix: e2e test
This commit is contained in:
1 parent
3292b2efb7
commit
74acbb6b25
22 files changed
+1032
-182
No files matched your search
@@ -729,8 +729,70 @@ jobs:
|
||||
- name: Run WOPI validator (cs3)
|
||||
run: python3 tests/acceptance/run-wopi.py --type cs3
|
||||
|
||||
external-ldap-tests:
|
||||
name: external-ldap-smoke
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
# web/idp assets must be embedded for `ocis server` to come up (same as run-github.py)
|
||||
- name: Generate assets
|
||||
run: make ci-node-generate
|
||||
|
||||
- name: Build oCIS
|
||||
run: make -C ocis build
|
||||
|
||||
# Boots an external osixia LDAP + oCIS (embedded idm excluded) and runs the
|
||||
# smoke scope against the graph API — exercises the external-directory
|
||||
# read-after-write / retry path (OCISDEV-1030/1032/1033) that the embedded-idm
|
||||
# acceptance jobs never hit.
|
||||
- name: Run external-LDAP smoke
|
||||
run: tests/ldap-smoke/run.sh
|
||||
|
||||
external-ldap-distributed-tests:
|
||||
name: external-ldap-distributed-smoke
|
||||
needs: [build-and-test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
|
||||
|
||||
# web/idp assets must be embedded for `ocis server` to come up (same as run-github.py)
|
||||
- name: Generate assets
|
||||
run: make ci-node-generate
|
||||
|
||||
- name: Build oCIS
|
||||
run: make -C ocis build
|
||||
|
||||
# Distributed LDAP topology (proxy over an async syncrepl replica + write master);
|
||||
# the replication lag exercises the retry / read-after-write path (OCISDEV-1030/1032/1033).
|
||||
- name: Run external-LDAP distributed smoke
|
||||
run: tests/ldap-smoke-distributed/run.sh
|
||||
|
||||
all-acceptance-tests:
|
||||
needs: [detect-changes, local-api-tests, cli-tests, ldap-pool-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
|
||||
needs: [detect-changes, local-api-tests, cli-tests, ldap-pool-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests, external-ldap-tests, external-ldap-distributed-tests]
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
steps:
|
||||
|
||||
@@ -13,6 +13,7 @@ require (
|
||||
github.com/beevik/etree v1.7.0
|
||||
github.com/blevesearch/bleve/v2 v2.6.0
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible
|
||||
github.com/cenkalti/backoff/v5 v5.0.3
|
||||
github.com/coreos/go-oidc/v3 v3.20.0
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1
|
||||
github.com/davidbyttow/govips/v2 v2.18.0
|
||||
@@ -66,7 +67,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.18.2
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260731090835-a9c3ec9eef2b
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260804100559-3d6017309c36
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
@@ -154,7 +155,6 @@ require (
|
||||
github.com/blevesearch/zapx/v17 v17.1.2 // indirect
|
||||
github.com/bluele/gcache v0.0.2 // indirect
|
||||
github.com/bombsimon/logrusr/v3 v3.1.0 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/ceph/go-ceph v0.40.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cevaris/ordered_map v0.0.0-20190319150403-3adeae072e73 // indirect
|
||||
|
||||
@@ -739,8 +739,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260731090835-a9c3ec9eef2b h1:oPsT8F2IRvbD/ZsYB27HzJZwExdDPUAwo7sk9KBDDiU=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260731090835-a9c3ec9eef2b/go.mod h1:m2fGRZDsnNSBszbnwysuq7uhlitQ90+weX4FFQRdkak=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260804100559-3d6017309c36 h1:yXuG0tNLpm1jB4jfKxmiGsgslzzB+JA2di4J7K+KsA0=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260804100559-3d6017309c36/go.mod h1:zJV1uSPyjLXGhb3JwI0EuUx8GJaq1d/NCmpuqN0U4IE=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pablodz/inotifywaitgo v0.0.12 h1:DVJJTFMDlSAdO46yisPF2vzozs/r+4k6ih8MVghq78M=
|
||||
|
||||
@@ -63,16 +63,19 @@ type Spaces struct {
|
||||
}
|
||||
|
||||
type LDAP struct {
|
||||
URI string `yaml:"uri" env:"OCIS_LDAP_URI;GRAPH_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'" introductionVersion:"pre5.0"`
|
||||
CACert string `yaml:"cacert" env:"OCIS_LDAP_CACERT;GRAPH_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/idm." introductionVersion:"pre5.0"`
|
||||
Insecure bool `yaml:"insecure" env:"OCIS_LDAP_INSECURE;GRAPH_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments." introductionVersion:"pre5.0"`
|
||||
BindDN string `yaml:"bind_dn" env:"OCIS_LDAP_BIND_DN;GRAPH_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server." introductionVersion:"pre5.0"`
|
||||
BindPassword string `yaml:"bind_password" env:"OCIS_LDAP_BIND_PASSWORD;GRAPH_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'." introductionVersion:"pre5.0"`
|
||||
UseServerUUID bool `yaml:"use_server_uuid" env:"GRAPH_LDAP_SERVER_UUID" desc:"If set to true, rely on the LDAP Server to generate a unique ID for users and groups, like when using 'entryUUID' as the user ID attribute." introductionVersion:"pre5.0"`
|
||||
UsePasswordModExOp bool `yaml:"use_password_modify_exop" env:"GRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP" desc:"Use the 'Password Modify Extended Operation' for updating user passwords." introductionVersion:"pre5.0"`
|
||||
WriteEnabled bool `yaml:"write_enabled" env:"OCIS_LDAP_SERVER_WRITE_ENABLED;GRAPH_LDAP_SERVER_WRITE_ENABLED" desc:"Allow creating, modifying and deleting LDAP users via the GRAPH API. This can only be set to 'true' when keeping default settings for the LDAP user and group attribute types (the 'OCIS_LDAP_USER_SCHEMA_* and 'OCIS_LDAP_GROUP_SCHEMA_* variables)." introductionVersion:"pre5.0"`
|
||||
UpdateUserLastSignInDate bool `yaml:"update_user_last_sign_in_date" env:"OCIS_LDAP_UPDATE_LAST_SIGNIN_DATE;GRAPH_LDAP_UPDATE_LAST_SIGNIN_DATE" desc:"Update the 'oCLastSignInTimestamp' LDAP attribute of a user when the user signs in. The attribute is only persisted when 'OCIS_LDAP_SERVER_WRITE_ENABLED' is also enabled. Set this to 'false' to avoid an LDAP write on every sign-in, e.g. when the last sign-in timestamp is not needed or the LDAP write load should be reduced." introductionVersion:"8.2.0"`
|
||||
RefintEnabled bool `yaml:"refint_enabled" env:"GRAPH_LDAP_REFINT_ENABLED" desc:"Signals that the server has the refint plugin enabled, which makes some actions not needed." introductionVersion:"pre5.0"`
|
||||
URI string `yaml:"uri" env:"OCIS_LDAP_URI;GRAPH_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'" introductionVersion:"pre5.0"`
|
||||
CACert string `yaml:"cacert" env:"OCIS_LDAP_CACERT;GRAPH_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/idm." introductionVersion:"pre5.0"`
|
||||
Insecure bool `yaml:"insecure" env:"OCIS_LDAP_INSECURE;GRAPH_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments." introductionVersion:"pre5.0"`
|
||||
BindDN string `yaml:"bind_dn" env:"OCIS_LDAP_BIND_DN;GRAPH_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server." introductionVersion:"pre5.0"`
|
||||
BindPassword string `yaml:"bind_password" env:"OCIS_LDAP_BIND_PASSWORD;GRAPH_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'." introductionVersion:"pre5.0"`
|
||||
UseServerUUID bool `yaml:"use_server_uuid" env:"GRAPH_LDAP_SERVER_UUID" desc:"If set to true, rely on the LDAP Server to generate a unique ID for users and groups, like when using 'entryUUID' as the user ID attribute." introductionVersion:"pre5.0"`
|
||||
UsePasswordModExOp bool `yaml:"use_password_modify_exop" env:"GRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP" desc:"Use the 'Password Modify Extended Operation' for updating user passwords." introductionVersion:"pre5.0"`
|
||||
WriteEnabled bool `yaml:"write_enabled" env:"OCIS_LDAP_SERVER_WRITE_ENABLED;GRAPH_LDAP_SERVER_WRITE_ENABLED" desc:"Allow creating, modifying and deleting LDAP users via the GRAPH API. This can only be set to 'true' when keeping default settings for the LDAP user and group attribute types (the 'OCIS_LDAP_USER_SCHEMA_* and 'OCIS_LDAP_GROUP_SCHEMA_* variables)." introductionVersion:"pre5.0"`
|
||||
UpdateUserLastSignInDate bool `yaml:"update_user_last_sign_in_date" env:"OCIS_LDAP_UPDATE_LAST_SIGNIN_DATE;GRAPH_LDAP_UPDATE_LAST_SIGNIN_DATE" desc:"Update the 'oCLastSignInTimestamp' LDAP attribute of a user when the user signs in. The attribute is only persisted when 'OCIS_LDAP_SERVER_WRITE_ENABLED' is also enabled. Set this to 'false' to avoid an LDAP write on every sign-in, e.g. when the last sign-in timestamp is not needed or the LDAP write load should be reduced." introductionVersion:"8.2.0"`
|
||||
RetryMaxCount int `yaml:"retry_max_count" env:"OCIS_LDAP_RETRY_MAX_COUNT;GRAPH_LDAP_RETRY_MAX_COUNT" desc:"Maximum number of retries for failed LDAP operations. Reads retry on transient and network errors; writes retry only when the connection failed before the request was sent (e.g. a reused idle connection found closed), so the request provably never reached the server and cannot be double-applied. Default 1." introductionVersion:"8.2.0"`
|
||||
RetryBaseDelay time.Duration `yaml:"retry_base_delay" env:"OCIS_LDAP_RETRY_BASE_DELAY;GRAPH_LDAP_RETRY_BASE_DELAY" desc:"Base delay for exponential backoff between LDAP retries (e.g. '100ms'). Set to 0 to disable backoff." introductionVersion:"8.2.0"`
|
||||
RetryMaxDelay time.Duration `yaml:"retry_max_delay" env:"OCIS_LDAP_RETRY_MAX_DELAY;GRAPH_LDAP_RETRY_MAX_DELAY" desc:"Maximum delay cap for exponential backoff between LDAP retries (e.g. '5s'). 0 (default) uses the library default cap of 60s." introductionVersion:"8.2.0"`
|
||||
RefintEnabled bool `yaml:"refint_enabled" env:"GRAPH_LDAP_REFINT_ENABLED" desc:"Signals that the server has the refint plugin enabled, which makes some actions not needed." introductionVersion:"pre5.0"`
|
||||
|
||||
PoolEnabled bool `yaml:"pool_enabled" env:"OCIS_LDAP_POOL_ENABLED;GRAPH_LDAP_POOL_ENABLED" desc:"Instead of a single long-lived reconnecting connection, enable a bounded pool of LDAP connections. This means that concurrent requests will no longer be serialised on one connection." introductionVersion:"8.2.0"`
|
||||
PoolSize int `yaml:"pool_size" env:"OCIS_LDAP_POOL_SIZE;GRAPH_LDAP_POOL_SIZE" desc:"Maximum number of concurrently open LDAP connections when 'OCIS_LDAP_POOL_ENABLED' is 'true'. Defaults to 5 when unset or <= 0." introductionVersion:"8.2.0"`
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/CiscoM31/godata"
|
||||
backoff "github.com/cenkalti/backoff/v5"
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/google/uuid"
|
||||
"github.com/libregraph/idm/pkg/ldapdn"
|
||||
@@ -54,6 +55,11 @@ type LDAP struct {
|
||||
refintEnabled bool
|
||||
usePwModifyExOp bool
|
||||
|
||||
// bounds for the read-back retry in readBackAfterWrite
|
||||
retryMaxCount int
|
||||
retryBaseDelay time.Duration
|
||||
retryMaxDelay time.Duration
|
||||
|
||||
userBaseDN string
|
||||
userFilter string
|
||||
userObjectClass string
|
||||
@@ -64,14 +70,14 @@ type LDAP struct {
|
||||
disableUserMechanism DisableUserMechanismType
|
||||
localUserDisableGroupDN string
|
||||
|
||||
groupBaseDN string
|
||||
groupCreateBaseDN string
|
||||
groupFilter string
|
||||
groupObjectClass string
|
||||
groupAdditionalObjectClasses []string
|
||||
groupIDisOctetString bool
|
||||
groupScope int
|
||||
groupAttributeMap groupAttributeMap
|
||||
groupBaseDN string
|
||||
groupCreateBaseDN string
|
||||
groupFilter string
|
||||
groupObjectClass string
|
||||
groupAdditionalObjectClasses []string
|
||||
groupIDisOctetString bool
|
||||
groupScope int
|
||||
groupAttributeMap groupAttributeMap
|
||||
|
||||
educationConfig educationConfig
|
||||
|
||||
@@ -204,6 +210,9 @@ func NewLDAPBackend(lc ldap.Client, config config.LDAP, logger *log.Logger, inst
|
||||
return &LDAP{
|
||||
useServerUUID: config.UseServerUUID,
|
||||
usePwModifyExOp: config.UsePasswordModExOp,
|
||||
retryMaxCount: config.RetryMaxCount,
|
||||
retryBaseDelay: config.RetryBaseDelay,
|
||||
retryMaxDelay: config.RetryMaxDelay,
|
||||
userBaseDN: config.UserBaseDN,
|
||||
userFilter: config.UserFilter,
|
||||
userObjectClass: config.UserObjectClass,
|
||||
@@ -279,7 +288,9 @@ func (i *LDAP) CreateUser(ctx context.Context, user libregraph.User) (*libregrap
|
||||
if i.useServerUUID {
|
||||
// The directory assigns the ID and conn.Add cannot return it, so we must
|
||||
// read the entry back to recover the generated UUID.
|
||||
e, err = i.getUserByDN(ar.DN, "")
|
||||
e, err = i.readBackAfterWrite(func() (*ldap.Entry, error) {
|
||||
return i.getUserByDN(ar.DN, "")
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -542,6 +553,13 @@ func (i *LDAP) getEntryByDN(dn string, attrs []string, filter string) (*ldap.Ent
|
||||
Msg("getEntryByDN")
|
||||
res, err := i.conn.Search(searchRequest)
|
||||
if err != nil {
|
||||
// A lagging replica returns NoSuchObject(32) for a base search on a
|
||||
// not-yet-replicated DN; a slower one returns success with 0 entries. Both
|
||||
// mean "not there yet", so map to the same ErrNotFound that readBackAfterWrite
|
||||
// retries on.
|
||||
if ldap.IsErrorWithCode(err, ldap.LDAPResultNoSuchObject) {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
i.logger.Error().Err(err).Str("backend", "ldap").Str("dn", dn).Msg("Search ldap by DN failed")
|
||||
return nil, errorcode.New(errorcode.ItemNotFound, "user lookup failed")
|
||||
}
|
||||
@@ -552,6 +570,38 @@ func (i *LDAP) getEntryByDN(dn string, attrs []string, filter string) (*ldap.Ent
|
||||
return res.Entries[0], nil
|
||||
}
|
||||
|
||||
// readBackAfterWrite runs readFn, retrying on ErrNotFound with backoff. A 0-entry
|
||||
// read after a successful write means the read hit a replica lagging behind the
|
||||
// primary; the connection-level retry only sees error codes, not this empty result,
|
||||
// so the retry happens here. Bounds default to one immediate re-read (count=1,
|
||||
// delay=0) and are tunable via the shared LDAP retry config.
|
||||
func (i *LDAP) readBackAfterWrite(readFn func() (*ldap.Entry, error)) (*ldap.Entry, error) {
|
||||
maxRetries := i.retryMaxCount
|
||||
if maxRetries < 1 {
|
||||
maxRetries = 1
|
||||
}
|
||||
|
||||
var bo *backoff.ExponentialBackOff
|
||||
for try := 0; ; try++ {
|
||||
e, err := readFn()
|
||||
if !errors.Is(err, ErrNotFound) || try >= maxRetries {
|
||||
return e, err
|
||||
}
|
||||
|
||||
if i.retryBaseDelay > 0 {
|
||||
if bo == nil {
|
||||
bo = backoff.NewExponentialBackOff()
|
||||
bo.InitialInterval = i.retryBaseDelay
|
||||
if i.retryMaxDelay > 0 {
|
||||
bo.MaxInterval = i.retryMaxDelay
|
||||
}
|
||||
bo.Reset()
|
||||
}
|
||||
time.Sleep(bo.NextBackOff())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (i *LDAP) searchLDAPEntryByFilter(basedn string, attrs []string, filter string) (*ldap.Entry, error) {
|
||||
if filter == "" {
|
||||
filter = "(objectclass=*)"
|
||||
|
||||
@@ -93,7 +93,9 @@ func (i *LDAP) CreateEducationClass(ctx context.Context, class libregraph.Educat
|
||||
if i.useServerUUID {
|
||||
// The directory assigns the ID and conn.Add cannot return it, so we must
|
||||
// read the entry back to recover the generated UUID.
|
||||
e, err = i.getEducationClassByDN(ar.DN)
|
||||
e, err = i.readBackAfterWrite(func() (*ldap.Entry, error) {
|
||||
return i.getEducationClassByDN(ar.DN)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -164,7 +164,9 @@ func (i *LDAP) CreateEducationSchool(ctx context.Context, school libregraph.Educ
|
||||
if i.useServerUUID {
|
||||
// The directory assigns the ID and conn.Add cannot return it, so we must
|
||||
// read the entry back to recover the generated UUID.
|
||||
e, err = i.getSchoolByDN(ar.DN)
|
||||
e, err = i.readBackAfterWrite(func() (*ldap.Entry, error) {
|
||||
return i.getSchoolByDN(ar.DN)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -48,7 +48,9 @@ func (i *LDAP) CreateEducationUser(ctx context.Context, user libregraph.Educatio
|
||||
if i.useServerUUID {
|
||||
// The directory assigns the ID and conn.Add cannot return it, so we must
|
||||
// read the entry back to recover the generated UUID.
|
||||
e, err = i.getEducationUserByDN(ar.DN)
|
||||
e, err = i.readBackAfterWrite(func() (*ldap.Entry, error) {
|
||||
return i.getEducationUserByDN(ar.DN)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -224,7 +224,9 @@ func (i *LDAP) CreateGroup(ctx context.Context, group libregraph.Group) (*libreg
|
||||
if i.useServerUUID {
|
||||
// The directory assigns the ID and conn.Add cannot return it, so we must
|
||||
// read the entry back to recover the generated UUID.
|
||||
e, err = i.getGroupByDN(ar.DN)
|
||||
e, err = i.readBackAfterWrite(func() (*ldap.Entry, error) {
|
||||
return i.getGroupByDN(ar.DN)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# syncprov overlay on the data DB so consumers can pull via refreshAndPersist.
|
||||
# Applied to cn=config (osixia runs changetype LDIF with ldapmodify -Y EXTERNAL).
|
||||
# osixia's 05-index.ldif already indexes entryCSN/entryUUID eq; re-adding them here
|
||||
# fails "value already exists" and aborts the file, so no olcDbIndex changes.
|
||||
|
||||
# 1. load the syncprov module (back_mdb is preloaded as {0})
|
||||
dn: cn=module{0},cn=config
|
||||
changetype: modify
|
||||
add: olcModuleLoad
|
||||
olcModuleLoad: syncprov.la
|
||||
|
||||
# 2. syncprov overlay on the data DB (index auto-assigned after memberof/refint)
|
||||
dn: olcOverlay=syncprov,olcDatabase={1}mdb,cn=config
|
||||
changetype: add
|
||||
objectClass: olcOverlayConfig
|
||||
objectClass: olcSyncProvConfig
|
||||
olcOverlay: syncprov
|
||||
olcSpCheckpoint: 100 10
|
||||
olcSpSessionLog: 100
|
||||
@@ -0,0 +1,22 @@
|
||||
# proxy-ldap read path: its own syncrepl consumer feed from write-ldap, so reads are
|
||||
# served from the proxy's local mdb (kept current by replication). olcUpdateRef turns
|
||||
# writes into a referral to write-ldap; the chain overlay (51_chain.ldif) catches that
|
||||
# referral and proxies the write.
|
||||
|
||||
dn: olcDatabase={1}mdb,cn=config
|
||||
changetype: modify
|
||||
add: olcSyncrepl
|
||||
olcSyncrepl: rid=002
|
||||
provider=ldap://write-ldap:389
|
||||
bindmethod=simple
|
||||
binddn="cn=admin,dc=owncloud,dc=com"
|
||||
credentials="admin"
|
||||
searchbase="dc=owncloud,dc=com"
|
||||
scope=sub
|
||||
schemachecking=on
|
||||
type=refreshAndPersist
|
||||
retry="5 +"
|
||||
interval=00:00:00:10
|
||||
-
|
||||
add: olcUpdateRef
|
||||
olcUpdateRef: ldap://write-ldap:389
|
||||
@@ -0,0 +1,36 @@
|
||||
# proxy-ldap write path: the chain overlay on the frontend catches the referral
|
||||
# emitted by olcUpdateRef (50_syncrepl.ldif) and proxies the write to write-ldap.
|
||||
# The chain overlay is compiled into back_ldap.la (no separate chain module); loading
|
||||
# back_ldap.la registers both the ldap backend and the chain overlay.
|
||||
|
||||
# 1. load back-ldap (registers the chain overlay too)
|
||||
dn: cn=module{0},cn=config
|
||||
changetype: modify
|
||||
add: olcModuleLoad
|
||||
olcModuleLoad: back_ldap.la
|
||||
|
||||
# 2. chain overlay on the frontend DB. slapd normalizes the RDN to olcOverlay={0}chain
|
||||
# (first overlay on the frontend); the nested DB below must reference that {0} form.
|
||||
dn: olcOverlay=chain,olcDatabase={-1}frontend,cn=config
|
||||
changetype: add
|
||||
objectClass: olcOverlayConfig
|
||||
objectClass: olcChainConfig
|
||||
# olcChainingBehavior omitted: maps to slapd "chain-chaining" (RFC 4370), rejected by
|
||||
# this build. back-ldap chases via olcDbChaseReferrals on the nested DB regardless.
|
||||
olcOverlay: chain
|
||||
olcChainCacheURI: FALSE
|
||||
olcChainMaxReferralDepth: 1
|
||||
olcChainReturnError: TRUE
|
||||
|
||||
# 3. nested back-ldap DB for the upstream master. Required, else the referral is chased
|
||||
# anonymously and the master rejects the write. oCIS binds as cn=admin (master rootdn);
|
||||
# mode=self self-asserts that identity, so no proxyAuthz rule is needed upstream.
|
||||
dn: olcDatabase=ldap,olcOverlay={0}chain,olcDatabase={-1}frontend,cn=config
|
||||
changetype: add
|
||||
objectClass: olcLDAPConfig
|
||||
objectClass: olcChainDatabase
|
||||
olcDbStartTLS: none
|
||||
olcDbURI: ldap://write-ldap:389
|
||||
olcDbChaseReferrals: TRUE
|
||||
olcDbIDAssertBind: bindmethod=simple binddn="cn=admin,dc=owncloud,dc=com" credentials="admin" mode=self flags=prescriptive
|
||||
olcDbRebindAsUser: TRUE
|
||||
@@ -0,0 +1,21 @@
|
||||
# read-ldap (syncrepl consumer). One-way refreshAndPersist feed from write-ldap.
|
||||
# olcUpdateRef makes any write received here return a referral to write-ldap (the
|
||||
# read node is not itself writable).
|
||||
|
||||
dn: olcDatabase={1}mdb,cn=config
|
||||
changetype: modify
|
||||
add: olcSyncrepl
|
||||
olcSyncrepl: rid=001
|
||||
provider=ldap://write-ldap:389
|
||||
bindmethod=simple
|
||||
binddn="cn=admin,dc=owncloud,dc=com"
|
||||
credentials="admin"
|
||||
searchbase="dc=owncloud,dc=com"
|
||||
scope=sub
|
||||
schemachecking=on
|
||||
type=refreshAndPersist
|
||||
retry="5 +"
|
||||
interval=00:00:00:10
|
||||
-
|
||||
add: olcUpdateRef
|
||||
olcUpdateRef: ldap://write-ldap:389
|
||||
@@ -0,0 +1,76 @@
|
||||
# Proxy/write/read LDAP topology (one-way async syncrepl) for the replication smoke test.
|
||||
# oCIS is NOT a service here — run.sh starts it as a host binary against proxy-ldap:389.
|
||||
# write-ldap = syncrepl provider (only seeded node); read-ldap/proxy-ldap = consumers.
|
||||
# Seed + schema reused from deployments/examples/ocis_ldap (../../ paths resolve from here);
|
||||
# only the syncrepl/chain overlays are local to this dir.
|
||||
services:
|
||||
# write-ldap: syncrepl provider (master); only node seeded with demo data.
|
||||
write-ldap:
|
||||
image: osixia/openldap:1.5.0
|
||||
command: ["--copy-service", "--loglevel", "info"]
|
||||
hostname: write-ldap
|
||||
environment:
|
||||
LDAP_TLS: "false"
|
||||
LDAP_ORGANISATION: owncloud
|
||||
LDAP_DOMAIN: owncloud.com
|
||||
LDAP_ROOT: "dc=owncloud,dc=com"
|
||||
LDAP_ADMIN_PASSWORD: ${LDAP_ADMIN_PASSWORD:-admin}
|
||||
LDAP_SEED_INTERNAL_LDIF_PATH: /ldifs
|
||||
LDAP_SEED_INTERNAL_SCHEMA_PATH: /schemas
|
||||
volumes:
|
||||
# example seed + memberof/refint, then local syncprov overlay.
|
||||
# 00-/10- prefixes order the osixia subdir walk.
|
||||
- ../../deployments/examples/ocis_ldap/config/ldap/ldif:/ldifs/00-data:ro
|
||||
- ./config/ldap/provider:/ldifs/10-provider:ro
|
||||
- ../../deployments/examples/ocis_ldap/config/ldap/schemas:/schemas:ro
|
||||
networks: [ocis-net]
|
||||
|
||||
# read-ldap: syncrepl consumer (replica). No data seed; filled by replication.
|
||||
# Not on oCIS's data path (oCIS reads via proxy-ldap's own feed) — present to model
|
||||
# the write/read/proxy topology shape.
|
||||
read-ldap:
|
||||
image: osixia/openldap:1.5.0
|
||||
command: ["--copy-service", "--loglevel", "info"]
|
||||
hostname: read-ldap
|
||||
depends_on:
|
||||
- write-ldap
|
||||
environment:
|
||||
LDAP_TLS: "false"
|
||||
LDAP_ORGANISATION: owncloud
|
||||
LDAP_DOMAIN: owncloud.com
|
||||
LDAP_ROOT: "dc=owncloud,dc=com"
|
||||
LDAP_ADMIN_PASSWORD: ${LDAP_ADMIN_PASSWORD:-admin}
|
||||
LDAP_SEED_INTERNAL_LDIF_PATH: /ldifs
|
||||
LDAP_SEED_INTERNAL_SCHEMA_PATH: /schemas
|
||||
volumes:
|
||||
# schema must exist locally (syncrepl does not replicate schema) + syncrepl consumer
|
||||
- ./config/ldap/replica:/ldifs/10-replica:ro
|
||||
- ../../deployments/examples/ocis_ldap/config/ldap/schemas:/schemas:ro
|
||||
networks: [ocis-net]
|
||||
|
||||
# proxy-ldap: the endpoint oCIS uses. Local reads (own syncrepl feed), writes chained
|
||||
# to write-ldap. Publishes 389 to the host for the host-built oCIS binary.
|
||||
proxy-ldap:
|
||||
image: osixia/openldap:1.5.0
|
||||
command: ["--copy-service", "--loglevel", "info"]
|
||||
hostname: proxy-ldap
|
||||
depends_on:
|
||||
- write-ldap
|
||||
environment:
|
||||
LDAP_TLS: "false"
|
||||
LDAP_ORGANISATION: owncloud
|
||||
LDAP_DOMAIN: owncloud.com
|
||||
LDAP_ROOT: "dc=owncloud,dc=com"
|
||||
LDAP_ADMIN_PASSWORD: ${LDAP_ADMIN_PASSWORD:-admin}
|
||||
LDAP_SEED_INTERNAL_LDIF_PATH: /ldifs
|
||||
LDAP_SEED_INTERNAL_SCHEMA_PATH: /schemas
|
||||
volumes:
|
||||
# schema + syncrepl consumer feed + chain overlay (write forwarding)
|
||||
- ./config/ldap/proxy:/ldifs/10-proxy:ro
|
||||
- ../../deployments/examples/ocis_ldap/config/ldap/schemas:/schemas:ro
|
||||
ports:
|
||||
- "127.0.0.1:389:389"
|
||||
networks: [ocis-net]
|
||||
|
||||
networks:
|
||||
ocis-net:
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env bash
|
||||
# Proxy/write/read LDAP topology (one-way async syncrepl) + oCIS, run through the proxy.
|
||||
# oCIS talks only to proxy-ldap: reads served from a local syncrepl replica, writes chained
|
||||
# to write-ldap. Async lag exercises the reva retry / readBackAfterWrite paths
|
||||
# (OCISDEV-1030/1032/1033). oCIS runs as a host binary against the proxy's published port.
|
||||
# id = entryUUID (server-assigned), so admin id is only known after seed+replication.
|
||||
#
|
||||
# Start order:
|
||||
# 1. write-ldap seeds demo data; read admin entryUUID from it.
|
||||
# 2. read-ldap + proxy-ldap pull via syncrepl; wait until admin is visible through
|
||||
# proxy-ldap (replication converged before oCIS reads via it).
|
||||
# 3. oCIS starts with OCIS_ADMIN_USER_ID pinned to that entryUUID, else role
|
||||
# assignment / login break.
|
||||
#
|
||||
# Needs: docker (compose plugin), curl, jq, and ocis/bin/ocis (make -C ocis build).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
DIR="$(pwd)"
|
||||
REPO_ROOT="$(cd ../.. && pwd)"
|
||||
|
||||
OCIS_BIN="${OCIS_BIN:-$REPO_ROOT/ocis/bin/ocis}"
|
||||
ADMIN_DN="uid=admin,ou=users,dc=owncloud,dc=com"
|
||||
LDAP_ADMIN_PASSWORD="${LDAP_ADMIN_PASSWORD:-admin}"
|
||||
export OCIS_URL="${OCIS_URL:-https://localhost:9200}"
|
||||
|
||||
[ -x "$OCIS_BIN" ] || { echo "ERROR: ocis binary not found at $OCIS_BIN (run: make -C ocis build)"; exit 1; }
|
||||
|
||||
OCIS_PID=""
|
||||
cleanup() {
|
||||
set +e
|
||||
[ -n "$OCIS_PID" ] && kill "$OCIS_PID" 2>/dev/null
|
||||
docker compose down -v >/dev/null 2>&1
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# read_admin_uuid SERVICE -> admin entryUUID seen by that service (empty if absent).
|
||||
# `|| true`: ldapsearch returns 32 (no such object) while seeding/replicating; set -e +
|
||||
# pipefail would kill the poll on the first iteration.
|
||||
read_admin_uuid() {
|
||||
local svc=$1
|
||||
{ docker compose exec -T "$svc" ldapsearch -LLL -o ldif-wrap=no -x \
|
||||
-H ldap://localhost:389 -D "cn=admin,dc=owncloud,dc=com" -w "$LDAP_ADMIN_PASSWORD" \
|
||||
-b "$ADMIN_DN" -s base entryUUID 2>/dev/null || true; } \
|
||||
| awk '/^entryUUID:/ {print $2; exit}'
|
||||
}
|
||||
|
||||
# Fresh volumes each run; the seed only runs on first init.
|
||||
docker compose down -v >/dev/null 2>&1 || true
|
||||
|
||||
echo "[*] Starting write-ldap (provider) ..."
|
||||
docker compose up -d write-ldap
|
||||
|
||||
echo -n "[*] Waiting for write-ldap seed "
|
||||
UUID=""
|
||||
for _ in $(seq 1 60); do
|
||||
UUID=$(read_admin_uuid write-ldap)
|
||||
if [ -n "$UUID" ]; then echo " ok"; break; fi
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
[ -n "$UUID" ] || { echo " FAILED (no admin entryUUID on write-ldap)"; docker compose logs --tail=40 write-ldap; exit 1; }
|
||||
echo "[*] admin entryUUID = $UUID"
|
||||
|
||||
echo "[*] Starting read-ldap + proxy-ldap (syncrepl consumers) ..."
|
||||
docker compose up -d read-ldap proxy-ldap
|
||||
|
||||
echo -n "[*] Waiting for syncrepl to converge on proxy-ldap "
|
||||
PUUID=""
|
||||
for _ in $(seq 1 60); do
|
||||
PUUID=$(read_admin_uuid proxy-ldap)
|
||||
# Must match the provider's UUID; entryUUID is preserved across replication.
|
||||
if [ "$PUUID" = "$UUID" ]; then echo " ok"; break; fi
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
[ "$PUUID" = "$UUID" ] || { echo " FAILED (admin not replicated to proxy-ldap; got '$PUUID')"; docker compose logs --tail=40 proxy-ldap; exit 1; }
|
||||
|
||||
echo "[*] ocis init ..."
|
||||
export OCIS_CONFIG_DIR="${OCIS_CONFIG_DIR:-$HOME/.ocis/config}"
|
||||
"$OCIS_BIN" init --insecure true || true
|
||||
|
||||
echo "[*] Starting oCIS (OCIS_ADMIN_USER_ID=$UUID) ..."
|
||||
env \
|
||||
OCIS_LDAP_URI="ldap://localhost:389" \
|
||||
OCIS_LDAP_INSECURE="true" \
|
||||
OCIS_LDAP_BIND_DN="cn=admin,dc=owncloud,dc=com" \
|
||||
OCIS_LDAP_BIND_PASSWORD="$LDAP_ADMIN_PASSWORD" \
|
||||
OCIS_LDAP_GROUP_BASE_DN="ou=groups,dc=owncloud,dc=com" \
|
||||
OCIS_LDAP_GROUP_FILTER="(objectclass=owncloud)" \
|
||||
OCIS_LDAP_GROUP_OBJECTCLASS="groupOfNames" \
|
||||
OCIS_LDAP_GROUP_ADDITIONAL_OBJECTCLASSES="owncloud" \
|
||||
OCIS_LDAP_USER_BASE_DN="ou=users,dc=owncloud,dc=com" \
|
||||
OCIS_LDAP_USER_FILTER="(objectclass=owncloud)" \
|
||||
OCIS_LDAP_USER_OBJECTCLASS="inetOrgPerson" \
|
||||
LDAP_LOGIN_ATTRIBUTES="uid" \
|
||||
OCIS_LDAP_USER_SCHEMA_ID="entryUUID" \
|
||||
OCIS_LDAP_GROUP_SCHEMA_ID="entryUUID" \
|
||||
OCIS_ADMIN_USER_ID="$UUID" \
|
||||
IDP_LDAP_LOGIN_ATTRIBUTE="uid" \
|
||||
IDP_LDAP_UUID_ATTRIBUTE="entryUUID" \
|
||||
IDP_LDAP_UUID_ATTRIBUTE_TYPE="text" \
|
||||
GRAPH_LDAP_SERVER_WRITE_ENABLED="true" \
|
||||
GRAPH_LDAP_REFINT_ENABLED="true" \
|
||||
GRAPH_LDAP_SERVER_UUID="true" \
|
||||
GRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP="false" \
|
||||
OCIS_LDAP_RETRY_MAX_COUNT="10" \
|
||||
OCIS_LDAP_RETRY_BASE_DELAY="200ms" \
|
||||
OCIS_LDAP_RETRY_MAX_DELAY="2s" \
|
||||
OCIS_EXCLUDE_RUN_SERVICES="idm" \
|
||||
OCIS_URL="$OCIS_URL" \
|
||||
OCIS_LOG_LEVEL="${OCIS_LOG_LEVEL:-error}" \
|
||||
OCIS_LOG_COLOR="false" \
|
||||
OCIS_INSECURE="true" \
|
||||
PROXY_ENABLE_BASIC_AUTH="true" \
|
||||
"$OCIS_BIN" server &
|
||||
OCIS_PID=$!
|
||||
|
||||
echo -n "[*] Waiting for oCIS "
|
||||
# Gate on GET /graph/v1.0/users/admin -> 200 (like run-github.py), not .well-known:
|
||||
# this needs the full proxy -> settings -> graph -> LDAP path incl. admin role assignment.
|
||||
ready=""
|
||||
for _ in $(seq 1 180); do
|
||||
code=$(curl -sk -o /dev/null -w "%{http_code}" -u "admin:admin" \
|
||||
"$OCIS_URL/graph/v1.0/users/admin" 2>/dev/null || true)
|
||||
if [ "$code" = "200" ]; then echo " ready"; ready=1; break; fi
|
||||
# bail early if the server process died
|
||||
kill -0 "$OCIS_PID" 2>/dev/null || { echo " FAILED (ocis exited)"; exit 1; }
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
[ -n "$ready" ] || { echo " FAILED (timeout)"; exit 1; }
|
||||
|
||||
echo "[*] Running smoke.sh ..."
|
||||
# smoke.sh is topology-agnostic (graph API via OCIS_URL only); reused from ldap-smoke.
|
||||
../ldap-smoke/smoke.sh
|
||||
Executable
+129
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bootstrap an external osixia LDAP + oCIS and run the LDAP smoke test.
|
||||
#
|
||||
# oCIS talks to a real external LDAP (no embedded idm), with server-assigned entryUUID
|
||||
# as the id attribute. This exercises the OCISDEV-1030/1032/1033 LDAP client changes
|
||||
# (configurable read/write-aware retry + read-after-write) against an external
|
||||
# directory — the path CI otherwise never covers (run-github.py always uses idm).
|
||||
#
|
||||
# Two-phase start: the id attribute is entryUUID (server-assigned), so the admin's id
|
||||
# is only known after LDAP seeds. Start LDAP, read the admin entryUUID, then start oCIS
|
||||
# with OCIS_ADMIN_USER_ID pinned to it — otherwise the admin can't be resolved and role
|
||||
# assignment / login break.
|
||||
#
|
||||
# Needs: docker, curl, jq, and a built binary at ocis/bin/ocis (make -C ocis build).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
DIR="$(pwd)"
|
||||
REPO_ROOT="$(cd ../.. && pwd)"
|
||||
|
||||
# Reuse the osixia seed/schema from the ocis_ldap deployment example (same demo users,
|
||||
# ou structure and memberof/refint overlays) instead of duplicating the LDIFs here.
|
||||
# The entryUUID / plaintext specifics that this smoke needs live in the oCIS env below,
|
||||
# not in the seed, so the example's LDIFs are topology-agnostic and reused as-is.
|
||||
LDAP_CONFIG="$REPO_ROOT/deployments/examples/ocis_ldap/config/ldap"
|
||||
|
||||
OCIS_BIN="${OCIS_BIN:-$REPO_ROOT/ocis/bin/ocis}"
|
||||
CONTAINER="ldap-smoke"
|
||||
ADMIN_DN="uid=admin,ou=users,dc=owncloud,dc=com"
|
||||
LDAP_ADMIN_PASSWORD="${LDAP_ADMIN_PASSWORD:-admin}"
|
||||
export OCIS_URL="${OCIS_URL:-https://localhost:9200}"
|
||||
|
||||
[ -x "$OCIS_BIN" ] || { echo "ERROR: ocis binary not found at $OCIS_BIN (run: make -C ocis build)"; exit 1; }
|
||||
|
||||
OCIS_PID=""
|
||||
cleanup() {
|
||||
set +e
|
||||
[ -n "$OCIS_PID" ] && kill "$OCIS_PID" 2>/dev/null
|
||||
docker rm -f "$CONTAINER" >/dev/null 2>&1
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# Fresh LDAP each run so the seed (which runs only on first init) always applies.
|
||||
docker rm -f "$CONTAINER" >/dev/null 2>&1 || true
|
||||
|
||||
echo "[*] Starting external LDAP ($CONTAINER) ..."
|
||||
docker run -d --name "$CONTAINER" -p 127.0.0.1:389:389 \
|
||||
-e LDAP_TLS=false \
|
||||
-e LDAP_ORGANISATION=owncloud \
|
||||
-e LDAP_DOMAIN=owncloud.com \
|
||||
-e LDAP_ROOT="dc=owncloud,dc=com" \
|
||||
-e LDAP_ADMIN_PASSWORD="$LDAP_ADMIN_PASSWORD" \
|
||||
-e LDAP_SEED_INTERNAL_LDIF_PATH=/ldifs \
|
||||
-e LDAP_SEED_INTERNAL_SCHEMA_PATH=/schemas \
|
||||
-v "$LDAP_CONFIG/ldif:/ldifs:ro" \
|
||||
-v "$LDAP_CONFIG/schemas:/schemas:ro" \
|
||||
osixia/openldap:1.5.0 --copy-service --loglevel info >/dev/null
|
||||
|
||||
echo -n "[*] Waiting for LDAP seed "
|
||||
UUID=""
|
||||
for _ in $(seq 1 60); do
|
||||
# `|| true`: while LDAP is still seeding, ldapsearch returns non-zero (no such
|
||||
# object); with set -e + pipefail that would kill the poll on the first iteration.
|
||||
UUID=$( { docker exec "$CONTAINER" ldapsearch -LLL -o ldif-wrap=no -x \
|
||||
-H ldap://localhost:389 -D "cn=admin,dc=owncloud,dc=com" -w "$LDAP_ADMIN_PASSWORD" \
|
||||
-b "$ADMIN_DN" -s base entryUUID 2>/dev/null || true; } \
|
||||
| awk '/^entryUUID:/ {print $2; exit}')
|
||||
if [ -n "$UUID" ]; then echo " ok"; break; fi
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
[ -n "$UUID" ] || { echo " FAILED (no admin entryUUID)"; docker logs --tail=40 "$CONTAINER"; exit 1; }
|
||||
echo "[*] admin entryUUID = $UUID"
|
||||
|
||||
echo "[*] ocis init ..."
|
||||
export OCIS_CONFIG_DIR="${OCIS_CONFIG_DIR:-$HOME/.ocis/config}"
|
||||
"$OCIS_BIN" init --insecure true || true
|
||||
|
||||
echo "[*] Starting oCIS (OCIS_ADMIN_USER_ID=$UUID) ..."
|
||||
env \
|
||||
OCIS_LDAP_URI="ldap://localhost:389" \
|
||||
OCIS_LDAP_INSECURE="true" \
|
||||
OCIS_LDAP_BIND_DN="cn=admin,dc=owncloud,dc=com" \
|
||||
OCIS_LDAP_BIND_PASSWORD="$LDAP_ADMIN_PASSWORD" \
|
||||
OCIS_LDAP_GROUP_BASE_DN="ou=groups,dc=owncloud,dc=com" \
|
||||
OCIS_LDAP_GROUP_FILTER="(objectclass=owncloud)" \
|
||||
OCIS_LDAP_GROUP_OBJECTCLASS="groupOfNames" \
|
||||
OCIS_LDAP_GROUP_ADDITIONAL_OBJECTCLASSES="owncloud" \
|
||||
OCIS_LDAP_USER_BASE_DN="ou=users,dc=owncloud,dc=com" \
|
||||
OCIS_LDAP_USER_FILTER="(objectclass=owncloud)" \
|
||||
OCIS_LDAP_USER_OBJECTCLASS="inetOrgPerson" \
|
||||
LDAP_LOGIN_ATTRIBUTES="uid" \
|
||||
OCIS_LDAP_USER_SCHEMA_ID="entryUUID" \
|
||||
OCIS_LDAP_GROUP_SCHEMA_ID="entryUUID" \
|
||||
OCIS_ADMIN_USER_ID="$UUID" \
|
||||
IDP_LDAP_LOGIN_ATTRIBUTE="uid" \
|
||||
IDP_LDAP_UUID_ATTRIBUTE="entryUUID" \
|
||||
IDP_LDAP_UUID_ATTRIBUTE_TYPE="text" \
|
||||
GRAPH_LDAP_SERVER_WRITE_ENABLED="true" \
|
||||
GRAPH_LDAP_REFINT_ENABLED="true" \
|
||||
GRAPH_LDAP_SERVER_UUID="true" \
|
||||
GRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP="false" \
|
||||
OCIS_EXCLUDE_RUN_SERVICES="idm" \
|
||||
OCIS_URL="$OCIS_URL" \
|
||||
OCIS_LOG_LEVEL="${OCIS_LOG_LEVEL:-error}" \
|
||||
OCIS_LOG_COLOR="false" \
|
||||
OCIS_INSECURE="true" \
|
||||
PROXY_ENABLE_BASIC_AUTH="true" \
|
||||
"$OCIS_BIN" server &
|
||||
OCIS_PID=$!
|
||||
|
||||
echo -n "[*] Waiting for oCIS "
|
||||
# Gate on GET /graph/v1.0/users/admin -> 200 (as run-github.py does), not on
|
||||
# .well-known: the latter only proves the IDP is up, while the graph admin lookup
|
||||
# exercises the full proxy -> settings (roles) -> graph -> LDAP path, so it only
|
||||
# succeeds once the stack — including admin role assignment — is actually ready.
|
||||
ready=""
|
||||
for _ in $(seq 1 180); do
|
||||
code=$(curl -sk -o /dev/null -w "%{http_code}" -u "admin:admin" \
|
||||
"$OCIS_URL/graph/v1.0/users/admin" 2>/dev/null || true)
|
||||
if [ "$code" = "200" ]; then echo " ready"; ready=1; break; fi
|
||||
# bail early if the server process died
|
||||
kill -0 "$OCIS_PID" 2>/dev/null || { echo " FAILED (ocis exited)"; exit 1; }
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
[ -n "$ready" ] || { echo " FAILED (timeout)"; exit 1; }
|
||||
|
||||
echo "[*] Running smoke.sh ..."
|
||||
./smoke.sh
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env bash
|
||||
# CRUD + login + group ops e2e against a single external LDAP, via the oCIS graph API
|
||||
# with basic auth. Green = create + server-UUID read-back + login + group Modify/refint
|
||||
# + member remove + delete all work with the OCISDEV-1030/1032/1033 LDAP client changes
|
||||
# (configurable read/write-aware retry + read-after-write) in the binary.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
BASE="${OCIS_URL:-https://localhost:9200}"
|
||||
|
||||
pass() { echo "[PASS] $1"; }
|
||||
fail() { echo "[FAIL] $1"; [ -n "${2:-}" ] && echo "$2"; exit 1; }
|
||||
|
||||
# reqas USER:PASS METHOD PATH [extra curl args...] -> sets $code and $json.
|
||||
reqas() {
|
||||
local cred=$1 method=$2 path=$3; shift 3
|
||||
local out
|
||||
out=$(curl -sk -u "$cred" -H "Accept: application/json" -X "$method" "$@" \
|
||||
-w $'\n%{http_code}' "$BASE$path")
|
||||
code=$(printf '%s' "$out" | tail -n1)
|
||||
json=$(printf '%s' "$out" | sed '$d')
|
||||
}
|
||||
|
||||
# req METHOD PATH [extra curl args...] -> as reqas, authed as admin.
|
||||
req() { reqas "admin:admin" "$@"; }
|
||||
|
||||
# 1. list users -> 200 + seeded demo users
|
||||
echo "[*] GET /graph/v1.0/users"
|
||||
req GET /graph/v1.0/users
|
||||
[ "$code" = "200" ] || fail "list users returned $code" "$json"
|
||||
count=$(printf '%s' "$json" | jq '.value | length')
|
||||
printf '%s' "$json" | jq -e '.value[] | select(.onPremisesSamAccountName=="einstein")' >/dev/null \
|
||||
|| fail "seeded user einstein not listed" "$json"
|
||||
pass "list users -> 200 ($count users, einstein present)"
|
||||
|
||||
# 2. create a user -> 201 with a server-assigned id (the read-back result)
|
||||
NEWUSER="ldapsmoke"
|
||||
echo "[*] POST /graph/v1.0/users ($NEWUSER)"
|
||||
payload=$(jq -n --arg u "$NEWUSER" '{
|
||||
displayName: "LDAP Smoke",
|
||||
onPremisesSamAccountName: $u,
|
||||
mail: ($u + "@example.org"),
|
||||
accountEnabled: true,
|
||||
passwordProfile: { password: "Secret123!" }
|
||||
}')
|
||||
req POST /graph/v1.0/users -H "Content-Type: application/json" -d "$payload"
|
||||
[ "$code" = "201" ] || fail "create user returned $code (expected 201)" "$json"
|
||||
ID=$(printf '%s' "$json" | jq -r '.id // empty')
|
||||
[ -n "$ID" ] || fail "create returned no id" "$json"
|
||||
pass "create user -> 201, server id=$ID"
|
||||
|
||||
# 3. read it back -> 200
|
||||
echo "[*] GET /graph/v1.0/users/$ID"
|
||||
req GET "/graph/v1.0/users/$ID"
|
||||
[ "$code" = "200" ] || fail "read-back returned $code" "$json"
|
||||
got=$(printf '%s' "$json" | jq -r '.onPremisesSamAccountName')
|
||||
[ "$got" = "$NEWUSER" ] || fail "read-back sam mismatch: $got" "$json"
|
||||
pass "read back user -> 200 ($got)"
|
||||
|
||||
# 4. log in as the created user -> 200 (proves the LDAP account + password work)
|
||||
echo "[*] GET /graph/v1.0/me (as $NEWUSER)"
|
||||
reqas "$NEWUSER:Secret123!" GET /graph/v1.0/me
|
||||
[ "$code" = "200" ] || fail "login as $NEWUSER returned $code" "$json"
|
||||
me=$(printf '%s' "$json" | jq -r '.onPremisesSamAccountName')
|
||||
[ "$me" = "$NEWUSER" ] || fail "login identity mismatch: $me" "$json"
|
||||
pass "login as $NEWUSER -> 200 (/me = $me)"
|
||||
|
||||
# 5. create a group -> 201 with a server-assigned id
|
||||
GRP="ldapsmoke-grp"
|
||||
echo "[*] POST /graph/v1.0/groups ($GRP)"
|
||||
req POST /graph/v1.0/groups -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg n "$GRP" '{displayName: $n}')"
|
||||
[ "$code" = "201" ] || fail "create group returned $code (expected 201)" "$json"
|
||||
GID=$(printf '%s' "$json" | jq -r '.id // empty')
|
||||
[ -n "$GID" ] || fail "create group returned no id" "$json"
|
||||
pass "create group -> 201, server id=$GID"
|
||||
|
||||
# 6. add the user as a member -> 204 (LDAP Modify + refint overlay)
|
||||
echo "[*] POST /graph/v1.0/groups/$GID/members/\$ref ($NEWUSER)"
|
||||
req POST "/graph/v1.0/groups/$GID/members/\$ref" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg u "$BASE/graph/v1.0/users/$ID" '{"@odata.id": $u}')"
|
||||
[ "$code" = "204" ] || fail "add member returned $code (expected 204)" "$json"
|
||||
pass "add member -> 204"
|
||||
|
||||
# 7. list members -> 200, the user is present
|
||||
echo "[*] GET /graph/v1.0/groups/$GID/members"
|
||||
req GET "/graph/v1.0/groups/$GID/members"
|
||||
[ "$code" = "200" ] || fail "list members returned $code" "$json"
|
||||
printf '%s' "$json" | jq -e --arg id "$ID" '.[] | select(.id==$id)' >/dev/null \
|
||||
|| fail "added member $ID not listed" "$json"
|
||||
pass "list members -> 200 ($NEWUSER present)"
|
||||
|
||||
# 8. remove the member -> 204, then re-list -> gone
|
||||
echo "[*] DELETE /graph/v1.0/groups/$GID/members/$ID/\$ref"
|
||||
req DELETE "/graph/v1.0/groups/$GID/members/$ID/\$ref"
|
||||
[ "$code" = "204" ] || fail "remove member returned $code (expected 204)" "$json"
|
||||
req GET "/graph/v1.0/groups/$GID/members"
|
||||
printf '%s' "$json" | jq -e --arg id "$ID" '.[] | select(.id==$id)' >/dev/null \
|
||||
&& fail "removed member $ID still listed" "$json"
|
||||
pass "remove member -> 204, member gone"
|
||||
|
||||
# 9. delete the group -> 204
|
||||
echo "[*] DELETE /graph/v1.0/groups/$GID"
|
||||
req DELETE "/graph/v1.0/groups/$GID"
|
||||
[ "$code" = "204" ] || fail "delete group returned $code (expected 204)" "$json"
|
||||
pass "delete group -> 204"
|
||||
|
||||
# 10. delete the user -> 204, then re-GET -> 404
|
||||
echo "[*] DELETE /graph/v1.0/users/$ID"
|
||||
req DELETE "/graph/v1.0/users/$ID"
|
||||
[ "$code" = "204" ] || fail "delete returned $code (expected 204)"
|
||||
req GET "/graph/v1.0/users/$ID"
|
||||
[ "$code" = "404" ] || fail "read-after-delete returned $code (expected 404)"
|
||||
pass "delete user -> 204, read-after-delete -> 404"
|
||||
|
||||
echo
|
||||
echo "[✓] LDAP smoke green: CRUD + login + group add/list/remove + delete works against a real external LDAP"
|
||||
+16
-6
@@ -24,9 +24,9 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/owncloud/reva/v2/pkg/logger"
|
||||
ldapReconnect "github.com/owncloud/reva/v2/pkg/utils/ldap"
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -39,7 +39,11 @@ type LDAPConn struct {
|
||||
BindDN string `mapstructure:"bind_username"`
|
||||
BindPassword string `mapstructure:"bind_password"`
|
||||
|
||||
// PoolEnabled switches GetLDAPClientWithPool callers to a bounded connection pool instead of
|
||||
RetryMaxCount int `mapstructure:"retry_max_count"`
|
||||
RetryBaseDelay time.Duration `mapstructure:"retry_base_delay"`
|
||||
RetryMaxDelay time.Duration `mapstructure:"retry_max_delay"`
|
||||
|
||||
// PoolEnabled switches GetLDAPClientFromConfig to a bounded connection pool instead of
|
||||
// the single long-lived reconnecting connection. Off by default.
|
||||
PoolEnabled bool `mapstructure:"pool_enabled"`
|
||||
// PoolSize caps the number of concurrently open pooled connections. Defaults to 5 when unset.
|
||||
@@ -87,10 +91,13 @@ func GetLDAPClientWithReconnect(c *LDAPConn) (ldap.Client, error) {
|
||||
|
||||
conn := ldapReconnect.NewLDAPWithReconnect(
|
||||
ldapReconnect.Config{
|
||||
URI: c.URI,
|
||||
BindDN: c.BindDN,
|
||||
BindPassword: c.BindPassword,
|
||||
TLSConfig: tlsConf,
|
||||
URI: c.URI,
|
||||
BindDN: c.BindDN,
|
||||
BindPassword: c.BindPassword,
|
||||
TLSConfig: tlsConf,
|
||||
RetryMaxCount: c.RetryMaxCount,
|
||||
RetryBaseDelay: c.RetryBaseDelay,
|
||||
RetryMaxDelay: c.RetryMaxDelay,
|
||||
},
|
||||
)
|
||||
return conn, nil
|
||||
@@ -111,6 +118,9 @@ func GetLDAPClientWithPool(c *LDAPConn) (ldap.Client, error) {
|
||||
BindDN: c.BindDN,
|
||||
BindPassword: c.BindPassword,
|
||||
TLSConfig: tlsConf,
|
||||
RetryMaxCount: c.RetryMaxCount,
|
||||
RetryBaseDelay: c.RetryBaseDelay,
|
||||
RetryMaxDelay: c.RetryMaxDelay,
|
||||
PoolSize: c.PoolSize,
|
||||
PoolCheckoutTimeout: c.PoolCheckoutTimeout,
|
||||
},
|
||||
|
||||
+4
-18
@@ -1,21 +1,3 @@
|
||||
// Copyright 2022 CERN
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// In applying this license, CERN does not waive the privileges and immunities
|
||||
// granted to it by virtue of its status as an Intergovernmental Organization
|
||||
// or submit itself to any jurisdiction.
|
||||
|
||||
package ldap
|
||||
|
||||
import (
|
||||
@@ -30,6 +12,10 @@ type Config struct {
|
||||
BindPassword string
|
||||
TLSConfig *tls.Config
|
||||
|
||||
RetryMaxCount int
|
||||
RetryBaseDelay time.Duration
|
||||
RetryMaxDelay time.Duration
|
||||
|
||||
// PoolSize caps the number of concurrently open connections in the pool. Only used by
|
||||
// NewLDAPPool; NewLDAPWithReconnect ignores it. Defaults to defaultPoolSize (5) when <= 0.
|
||||
PoolSize int
|
||||
|
||||
+57
-38
@@ -1,21 +1,3 @@
|
||||
// Copyright 2022 CERN
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// In applying this license, CERN does not waive the privileges and immunities
|
||||
// granted to it by virtue of its status as an Intergovernmental Organization
|
||||
// or submit itself to any jurisdiction.
|
||||
|
||||
package ldap
|
||||
|
||||
import (
|
||||
@@ -26,6 +8,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
backoff "github.com/cenkalti/backoff/v5"
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/rs/zerolog"
|
||||
"golang.org/x/sync/semaphore"
|
||||
@@ -62,6 +45,15 @@ type ConnPool struct {
|
||||
dial clientFactory
|
||||
logger *zerolog.Logger
|
||||
|
||||
// read/write are the retry policies for read and write operations, shared with
|
||||
// ConnWithReconnect: reads retry any ErrorNetwork, writes retry only pre-send network errors.
|
||||
// The pool ignores their needsReconnect (a failed connection is evicted by release and re-dialed
|
||||
// on the next checkout) and uses only MaxRetries, the backoff bounds, and isRetryable.
|
||||
read RetryPolicy
|
||||
write RetryPolicy
|
||||
// sleepFn backs off between retries; overridable in tests. Defaults to time.Sleep.
|
||||
sleepFn func(time.Duration)
|
||||
|
||||
// sem bounds the number of connections checked out at once: checkout acquires it (blocking with
|
||||
// p.timeout until a slot is free), release releases it to free the slot. Its weight is the pool
|
||||
// size.
|
||||
@@ -93,6 +85,9 @@ func NewLDAPPool(config Config, logger *zerolog.Logger) *ConnPool {
|
||||
timeout: timeout,
|
||||
dial: dialLDAP,
|
||||
logger: logger,
|
||||
read: NewReadPolicy(config.RetryMaxCount, config.RetryBaseDelay, config.RetryMaxDelay),
|
||||
write: NewWritePolicy(config.RetryMaxCount, config.RetryBaseDelay, config.RetryMaxDelay),
|
||||
sleepFn: time.Sleep,
|
||||
sem: semaphore.NewWeighted(int64(size)),
|
||||
idle: make(chan ldap.Client, size),
|
||||
}
|
||||
@@ -144,10 +139,14 @@ func (p *ConnPool) checkout() (ldap.Client, error) {
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
// release returns conn to the pool, or closes and discards it if opErr is a network error (or the
|
||||
// pool has since been closed), and frees the slot reserved by checkout.
|
||||
// release returns conn to the pool, or closes and discards it if opErr indicates the connection is
|
||||
// no longer usable (or the pool has since been closed), and frees the slot reserved by checkout.
|
||||
//
|
||||
// A failed conn.Write (isSendFailedErr) is evicted as well as ErrorNetwork: it is a plain error
|
||||
// carrying no result code, so an IsErrorWithCode check alone would return the dead connection to the
|
||||
// idle pool and fail the next checkout that picks it up.
|
||||
func (p *ConnPool) release(conn ldap.Client, opErr error) {
|
||||
if p.IsClosing() || (opErr != nil && ldap.IsErrorWithCode(opErr, ldap.ErrorNetwork)) {
|
||||
if p.IsClosing() || (opErr != nil && (ldap.IsErrorWithCode(opErr, ldap.ErrorNetwork) || isSendFailedErr(opErr))) {
|
||||
if err := conn.Close(); err != nil {
|
||||
p.logger.Error().Err(err).Msg("error closing pooled LDAP connection")
|
||||
}
|
||||
@@ -157,25 +156,45 @@ func (p *ConnPool) release(conn ldap.Client, opErr error) {
|
||||
p.sem.Release(1)
|
||||
}
|
||||
|
||||
// do checks out a connection, runs fn, and releases the connection. Checked-out idle connections
|
||||
// are not health-checked before use, so a connection that went stale while idle (server-side idle
|
||||
// timeout, LB/firewall reaping) is expected to fail the first op after being idle; on a network
|
||||
// error, do retries once more with a freshly checked-out connection (the failed one was evicted by
|
||||
// release) instead of surfacing the failure to the caller, mirroring ConnWithReconnect's retry.
|
||||
func (p *ConnPool) do(fn func(conn ldap.Client) error) error {
|
||||
// do checks out a connection, runs fn under the given retry policy, and releases the connection.
|
||||
// Checked-out idle connections are not health-checked before use, so a connection that went stale
|
||||
// while idle (server-side idle timeout, LB/firewall reaping) is expected to fail the first op after
|
||||
// being idle; when policy.isRetryable matches, do retries with a freshly checked-out connection (the
|
||||
// failed one was evicted by release) instead of surfacing the failure, mirroring ConnWithReconnect.
|
||||
//
|
||||
// Pass the read policy for reads and the write policy for writes: reads retry any ErrorNetwork,
|
||||
// writes retry only pre-send network errors (a drop while reading the response may have applied the
|
||||
// write, so it must not be retried). Retries honor policy.MaxRetries and back off between attempts;
|
||||
// the failed connection is evicted by release either way.
|
||||
func (p *ConnPool) do(policy RetryPolicy, fn func(conn ldap.Client) error) error {
|
||||
maxRetries := policy.MaxRetries
|
||||
if maxRetries < 1 {
|
||||
maxRetries = 1
|
||||
}
|
||||
var opErr error
|
||||
for try := 0; try <= defaultRetries; try++ {
|
||||
var bo *backoff.ExponentialBackOff
|
||||
for try := 0; ; try++ {
|
||||
conn, err := p.checkout()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opErr = fn(conn)
|
||||
p.release(conn, opErr)
|
||||
if opErr == nil || !ldap.IsErrorWithCode(opErr, ldap.ErrorNetwork) {
|
||||
if opErr == nil || !policy.isRetryable(opErr) || try >= maxRetries {
|
||||
return opErr
|
||||
}
|
||||
if policy.BaseDelay > 0 {
|
||||
if bo == nil {
|
||||
bo = backoff.NewExponentialBackOff()
|
||||
bo.InitialInterval = policy.BaseDelay
|
||||
if policy.MaxDelay > 0 {
|
||||
bo.MaxInterval = policy.MaxDelay
|
||||
}
|
||||
bo.Reset()
|
||||
}
|
||||
p.sleepFn(bo.NextBackOff())
|
||||
}
|
||||
}
|
||||
return ldap.NewError(ldap.ErrorNetwork, errMaxRetries)
|
||||
}
|
||||
|
||||
// Close closes the pool: currently idle connections are closed immediately, further checkouts are
|
||||
@@ -200,7 +219,7 @@ func (p *ConnPool) Close() error {
|
||||
// Search implements the ldap.Client interface
|
||||
func (p *ConnPool) Search(sr *ldap.SearchRequest) (*ldap.SearchResult, error) {
|
||||
var res *ldap.SearchResult
|
||||
err := p.do(func(conn ldap.Client) error {
|
||||
err := p.do(p.read, func(conn ldap.Client) error {
|
||||
var err error
|
||||
res, err = conn.Search(sr)
|
||||
return err
|
||||
@@ -210,28 +229,28 @@ func (p *ConnPool) Search(sr *ldap.SearchRequest) (*ldap.SearchResult, error) {
|
||||
|
||||
// Add implements the ldap.Client interface
|
||||
func (p *ConnPool) Add(a *ldap.AddRequest) error {
|
||||
return p.do(func(conn ldap.Client) error {
|
||||
return p.do(p.write, func(conn ldap.Client) error {
|
||||
return conn.Add(a)
|
||||
})
|
||||
}
|
||||
|
||||
// Del implements the ldap.Client interface
|
||||
func (p *ConnPool) Del(d *ldap.DelRequest) error {
|
||||
return p.do(func(conn ldap.Client) error {
|
||||
return p.do(p.write, func(conn ldap.Client) error {
|
||||
return conn.Del(d)
|
||||
})
|
||||
}
|
||||
|
||||
// Modify implements the ldap.Client interface
|
||||
func (p *ConnPool) Modify(m *ldap.ModifyRequest) error {
|
||||
return p.do(func(conn ldap.Client) error {
|
||||
return p.do(p.write, func(conn ldap.Client) error {
|
||||
return conn.Modify(m)
|
||||
})
|
||||
}
|
||||
|
||||
// ModifyDN implements the ldap.Client interface
|
||||
func (p *ConnPool) ModifyDN(m *ldap.ModifyDNRequest) error {
|
||||
return p.do(func(conn ldap.Client) error {
|
||||
return p.do(p.write, func(conn ldap.Client) error {
|
||||
return conn.ModifyDN(m)
|
||||
})
|
||||
}
|
||||
@@ -239,7 +258,7 @@ func (p *ConnPool) ModifyDN(m *ldap.ModifyDNRequest) error {
|
||||
// Extended implements the ldap.Client interface
|
||||
func (p *ConnPool) Extended(request *ldap.ExtendedRequest) (*ldap.ExtendedResponse, error) {
|
||||
var res *ldap.ExtendedResponse
|
||||
err := p.do(func(conn ldap.Client) error {
|
||||
err := p.do(p.write, func(conn ldap.Client) error {
|
||||
var err error
|
||||
res, err = conn.Extended(request)
|
||||
return err
|
||||
@@ -304,7 +323,7 @@ func (p *ConnPool) Unbind() error {
|
||||
// ModifyWithResult implements the ldap.Client interface
|
||||
func (p *ConnPool) ModifyWithResult(m *ldap.ModifyRequest) (*ldap.ModifyResult, error) {
|
||||
var res *ldap.ModifyResult
|
||||
err := p.do(func(conn ldap.Client) error {
|
||||
err := p.do(p.write, func(conn ldap.Client) error {
|
||||
var err error
|
||||
res, err = conn.ModifyWithResult(m)
|
||||
return err
|
||||
@@ -320,7 +339,7 @@ func (p *ConnPool) Compare(dn, attribute, value string) (bool, error) {
|
||||
// PasswordModify implements the ldap.Client interface
|
||||
func (p *ConnPool) PasswordModify(m *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) {
|
||||
var res *ldap.PasswordModifyResult
|
||||
err := p.do(func(conn ldap.Client) error {
|
||||
err := p.do(p.write, func(conn ldap.Client) error {
|
||||
var err error
|
||||
res, err = conn.PasswordModify(m)
|
||||
return err
|
||||
|
||||
+248
-91
@@ -26,16 +26,98 @@ import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
backoff "github.com/cenkalti/backoff/v5"
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultRetries = 1
|
||||
errMaxRetries = errors.New("max retries")
|
||||
)
|
||||
// RetryPolicy controls retry behaviour for one class of LDAP operations.
|
||||
//
|
||||
// The predicates take the error rather than a bare result code because go-ldap raises every
|
||||
// connection failure as ErrorNetwork(200) and distinguishes the pre-transmit case (safe to
|
||||
// retry a write) from the post-transmit case only by the wrapped message string — and because a
|
||||
// failed conn.Write arrives as a plain error with no result code at all (see sendFailedErrMsg).
|
||||
// Both policies inspect the message: the write policy to decide retryability at all
|
||||
// (isPreSendNetworkErr), the read policy only to catch the codeless failed-write case.
|
||||
type RetryPolicy struct {
|
||||
MaxRetries int
|
||||
BaseDelay time.Duration
|
||||
MaxDelay time.Duration
|
||||
isRetryable func(err error) bool
|
||||
needsReconnect func(err error) bool
|
||||
}
|
||||
|
||||
// NewReadPolicy returns a RetryPolicy for read operations (Search).
|
||||
// Tier 1 (ErrorNetwork/ServerDown/ConnectError/Timeout/LocalError): reconnect + backoff.
|
||||
// Tier 2 (Busy/Unavailable): backoff only, no reconnect (server signals transient overload).
|
||||
//
|
||||
// Deliberately excluded:
|
||||
// - LDAPResultTimeLimitExceeded (3): usually a too-broad query, not transient load;
|
||||
// retrying re-runs the expensive query and worsens a struggling server.
|
||||
// - LDAPResultReferral (10): a routing signal, not a transient error.
|
||||
//
|
||||
// A failed conn.Write (isSendFailedErr) is retried too. It carries no result code, so the switches
|
||||
// below cannot match it on their own.
|
||||
func NewReadPolicy(maxRetries int, baseDelay, maxDelay time.Duration) RetryPolicy {
|
||||
return RetryPolicy{
|
||||
MaxRetries: maxRetries,
|
||||
BaseDelay: baseDelay,
|
||||
MaxDelay: maxDelay,
|
||||
isRetryable: func(err error) bool {
|
||||
if isSendFailedErr(err) {
|
||||
return true
|
||||
}
|
||||
switch ldapErrCode(err) {
|
||||
case ldap.ErrorNetwork,
|
||||
ldap.LDAPResultServerDown,
|
||||
ldap.LDAPResultConnectError,
|
||||
ldap.LDAPResultTimeout,
|
||||
ldap.LDAPResultLocalError,
|
||||
ldap.LDAPResultBusy,
|
||||
ldap.LDAPResultUnavailable:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
needsReconnect: func(err error) bool {
|
||||
if isSendFailedErr(err) {
|
||||
return true
|
||||
}
|
||||
switch ldapErrCode(err) {
|
||||
case ldap.ErrorNetwork,
|
||||
ldap.LDAPResultServerDown,
|
||||
ldap.LDAPResultConnectError,
|
||||
ldap.LDAPResultTimeout,
|
||||
ldap.LDAPResultLocalError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewWritePolicy returns a RetryPolicy for write operations.
|
||||
//
|
||||
// A write is retried only when the connection was known-unusable before the request packet was
|
||||
// sent, so the mutation provably never reached the server (isPreSendNetworkErr). Every other
|
||||
// error — including a network drop while reading the response — may have applied the write, so
|
||||
// retrying it could double-apply.
|
||||
//
|
||||
// This intentionally does not key on result codes: go-ldap raises all connection failures as
|
||||
// ErrorNetwork(200) and never emits LDAPResultServerDown(81)/ConnectError(91), so a code-based
|
||||
// write allowlist would match nothing and never retry.
|
||||
func NewWritePolicy(maxRetries int, baseDelay, maxDelay time.Duration) RetryPolicy {
|
||||
return RetryPolicy{
|
||||
MaxRetries: maxRetries,
|
||||
BaseDelay: baseDelay,
|
||||
MaxDelay: maxDelay,
|
||||
isRetryable: isPreSendNetworkErr,
|
||||
needsReconnect: func(error) bool { return true }, // a pre-send network error always needs a fresh connection
|
||||
}
|
||||
}
|
||||
|
||||
type ldapConnection struct {
|
||||
Conn *ldap.Conn
|
||||
@@ -46,7 +128,10 @@ type ldapConnection struct {
|
||||
type ConnWithReconnect struct {
|
||||
conn chan ldapConnection
|
||||
reset chan *ldap.Conn
|
||||
retries int
|
||||
read RetryPolicy
|
||||
write RetryPolicy
|
||||
sleepFn func(time.Duration)
|
||||
dialFn func(Config) (*ldap.Conn, error)
|
||||
logger *zerolog.Logger
|
||||
}
|
||||
|
||||
@@ -55,10 +140,13 @@ func NewLDAPWithReconnect(config Config) *ConnWithReconnect {
|
||||
conn := ConnWithReconnect{
|
||||
conn: make(chan ldapConnection),
|
||||
reset: make(chan *ldap.Conn),
|
||||
retries: defaultRetries,
|
||||
read: NewReadPolicy(config.RetryMaxCount, config.RetryBaseDelay, config.RetryMaxDelay),
|
||||
write: NewWritePolicy(config.RetryMaxCount, config.RetryBaseDelay, config.RetryMaxDelay),
|
||||
sleepFn: time.Sleep,
|
||||
}
|
||||
logger := zerolog.Nop()
|
||||
conn.logger = &logger
|
||||
conn.dialFn = conn.ldapConnect
|
||||
go conn.ldapAutoConnect(config)
|
||||
return &conn
|
||||
}
|
||||
@@ -68,82 +156,196 @@ func (c *ConnWithReconnect) SetLogger(logger *zerolog.Logger) {
|
||||
c.logger = logger
|
||||
}
|
||||
|
||||
func (c *ConnWithReconnect) retry(fn func(c ldap.Client) error) error {
|
||||
conn, err := c.getConnection()
|
||||
|
||||
// ldapErrCode extracts the LDAP result code from an error. Errors that are not an *ldap.Error carry
|
||||
// no result code and map to LDAPResultOther, which neither policy's switch treats as retryable —
|
||||
// so a codeless error that IS safe to retry must be matched on its message instead
|
||||
// (see sendFailedErrMsg).
|
||||
func ldapErrCode(err error) uint16 {
|
||||
if err == nil {
|
||||
return 0
|
||||
}
|
||||
var lerr *ldap.Error
|
||||
if errors.As(err, &lerr) {
|
||||
return lerr.ResultCode
|
||||
}
|
||||
// Unknown error type: map to a non-retryable code.
|
||||
return ldap.LDAPResultOther
|
||||
}
|
||||
|
||||
// preSendNetworkErrMsgs are the substrings go-ldap uses for ErrorNetwork(200) failures raised in
|
||||
// Conn.sendMessageWithFlags, before the request packet is handed to the write loop: the IsClosing
|
||||
// check, and the "could not send" fallback. Matching one proves the request never left the client,
|
||||
// so retrying a write cannot double-apply.
|
||||
//
|
||||
// go-ldap has no distinct result code for pre- vs post-transmit network errors — both are 200 — so
|
||||
// this whitelist keys on its internal message strings. It is deliberately fail-closed: if go-ldap
|
||||
// renames a message, isPreSendNetworkErr returns false and the write is surfaced to the caller
|
||||
// rather than retried. Revisit this list on every go-ldap upgrade (see TestWritePolicyMatchesEmittableCode).
|
||||
//
|
||||
// Note these cover only the case where the reader goroutine has already noticed the drop and set
|
||||
// closing; when an operation beats the reader to it the failure surfaces from the write loop
|
||||
// instead — see sendFailedErrMsg.
|
||||
var preSendNetworkErrMsgs = []string{
|
||||
"ldap: connection closed",
|
||||
"ldap: could not send message for unknown reason",
|
||||
}
|
||||
|
||||
// sendFailedErrMsg is the message go-ldap's processMessages loop wraps a failed conn.Write in
|
||||
// (fmt.Errorf("unable to send request: %s", err)). Unlike every other failure in the send path this
|
||||
// is a plain error, not an *ldap.Error, so it carries no result code and ldapErrCode maps it to
|
||||
// LDAPResultOther — meaning a code-keyed policy cannot match it.
|
||||
//
|
||||
// Matching it proves the request never reached the server: go-ldap adds the message to
|
||||
// messageContexts only after a successful write, so an operation that failed here can never be
|
||||
// matched to a response and cannot have applied a mutation. Retrying it is therefore safe even for
|
||||
// a write.
|
||||
//
|
||||
// This is the race window a reaped idle connection hits when the operation beats the reader
|
||||
// goroutine to noticing the drop: IsClosing() is still false, so the preSendNetworkErrMsgs checks
|
||||
// pass, the packet reaches the write loop, and conn.Write fails with EPIPE/ECONNRESET.
|
||||
const sendFailedErrMsg = "unable to send request:"
|
||||
|
||||
// isSendFailedErr reports whether err is go-ldap's failed-conn.Write error. See sendFailedErrMsg.
|
||||
func isSendFailedErr(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), sendFailedErrMsg)
|
||||
}
|
||||
|
||||
// isPreSendNetworkErr reports whether err was raised before the request was transmitted, and is
|
||||
// therefore safe to retry even for a write. See preSendNetworkErrMsgs and sendFailedErrMsg.
|
||||
func isPreSendNetworkErr(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
// A failed conn.Write carries no result code, so check it before the code-keyed cases.
|
||||
if isSendFailedErr(err) {
|
||||
return true
|
||||
}
|
||||
var lerr *ldap.Error
|
||||
if !errors.As(err, &lerr) || lerr.ResultCode != ldap.ErrorNetwork {
|
||||
return false
|
||||
}
|
||||
msg := err.Error()
|
||||
for _, m := range preSendNetworkErrMsgs {
|
||||
if strings.Contains(msg, m) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// RetryOp executes fn under the given retry policy.
|
||||
func (c *ConnWithReconnect) RetryOp(policy RetryPolicy, fn func(*ldap.Conn) error) error {
|
||||
if policy.MaxRetries < 1 {
|
||||
policy.MaxRetries = 1
|
||||
}
|
||||
conn, err := c.getConnection()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for try := 0; try <= c.retries; try++ {
|
||||
if try > 0 {
|
||||
c.logger.Debug().Msgf("retrying attempt %d", try)
|
||||
var bo *backoff.ExponentialBackOff
|
||||
for try := 0; ; try++ {
|
||||
err = fn(conn)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if !policy.isRetryable(err) || try >= policy.MaxRetries {
|
||||
break
|
||||
}
|
||||
|
||||
if policy.BaseDelay > 0 {
|
||||
if bo == nil {
|
||||
bo = backoff.NewExponentialBackOff()
|
||||
bo.InitialInterval = policy.BaseDelay
|
||||
if policy.MaxDelay > 0 {
|
||||
bo.MaxInterval = policy.MaxDelay
|
||||
}
|
||||
bo.Reset()
|
||||
}
|
||||
c.sleepFn(bo.NextBackOff())
|
||||
}
|
||||
|
||||
if policy.needsReconnect(err) {
|
||||
conn, err = c.reconnect(conn)
|
||||
if err != nil {
|
||||
// reconnection failed stop this attempt
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err = fn(conn); err == nil {
|
||||
// function succeed no need to retry
|
||||
return nil
|
||||
}
|
||||
if !ldap.IsErrorWithCode(err, ldap.ErrorNetwork) {
|
||||
// non network error, stop retrying
|
||||
return err
|
||||
}
|
||||
}
|
||||
return ldap.NewError(ldap.ErrorNetwork, errMaxRetries)
|
||||
return err
|
||||
}
|
||||
|
||||
// Search implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Search(sr *ldap.SearchRequest) (*ldap.SearchResult, error) {
|
||||
var err error
|
||||
var res *ldap.SearchResult
|
||||
|
||||
retryErr := c.retry(func(c ldap.Client) error {
|
||||
res, err = c.Search(sr)
|
||||
return err
|
||||
err := c.RetryOp(c.read, func(conn *ldap.Conn) error {
|
||||
var e error
|
||||
res, e = conn.Search(sr)
|
||||
return e
|
||||
})
|
||||
|
||||
return res, retryErr
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
// Add implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Add(a *ldap.AddRequest) error {
|
||||
err := c.retry(func(c ldap.Client) error {
|
||||
return c.Add(a)
|
||||
return c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
return conn.Add(a)
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Del implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Del(d *ldap.DelRequest) error {
|
||||
err := c.retry(func(c ldap.Client) error {
|
||||
return c.Del(d)
|
||||
return c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
return conn.Del(d)
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Modify implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Modify(m *ldap.ModifyRequest) error {
|
||||
err := c.retry(func(c ldap.Client) error {
|
||||
return c.Modify(m)
|
||||
return c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
return conn.Modify(m)
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// ModifyDN implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) ModifyDN(m *ldap.ModifyDNRequest) error {
|
||||
err := c.retry(func(c ldap.Client) error {
|
||||
return c.ModifyDN(m)
|
||||
return c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
return conn.ModifyDN(m)
|
||||
})
|
||||
}
|
||||
|
||||
return err
|
||||
// Extended implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Extended(request *ldap.ExtendedRequest) (*ldap.ExtendedResponse, error) {
|
||||
var res *ldap.ExtendedResponse
|
||||
err := c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
var e error
|
||||
res, e = conn.Extended(request)
|
||||
return e
|
||||
})
|
||||
return res, err
|
||||
}
|
||||
|
||||
// ModifyWithResult implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) ModifyWithResult(m *ldap.ModifyRequest) (*ldap.ModifyResult, error) {
|
||||
var res *ldap.ModifyResult
|
||||
err := c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
var e error
|
||||
res, e = conn.ModifyWithResult(m)
|
||||
return e
|
||||
})
|
||||
return res, err
|
||||
}
|
||||
|
||||
// PasswordModify implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) PasswordModify(m *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) {
|
||||
var res *ldap.PasswordModifyResult
|
||||
err := c.RetryOp(c.write, func(conn *ldap.Conn) error {
|
||||
var e error
|
||||
res, e = conn.PasswordModify(m)
|
||||
return e
|
||||
})
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *ConnWithReconnect) getConnection() (*ldap.Conn, error) {
|
||||
@@ -170,14 +372,14 @@ func (c *ConnWithReconnect) ldapAutoConnect(config Config) {
|
||||
switch {
|
||||
case l == nil:
|
||||
c.logger.Debug().Msg("reconnecting to LDAP")
|
||||
l, err = c.ldapConnect(config)
|
||||
l, err = c.dialFn(config)
|
||||
case l != resConn:
|
||||
c.logger.Debug().Msg("already reconnected")
|
||||
continue
|
||||
default:
|
||||
c.logger.Debug().Msg("closing and reconnecting to LDAP")
|
||||
l.Close()
|
||||
l, err = c.ldapConnect(config)
|
||||
l, err = c.dialFn(config)
|
||||
}
|
||||
case c.conn <- ldapConnection{l, err}:
|
||||
}
|
||||
@@ -201,10 +403,8 @@ func (c *ConnWithReconnect) ldapConnect(config Config) (*ldap.Conn, error) {
|
||||
l.Close()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
}
|
||||
return l, err
|
||||
|
||||
}
|
||||
|
||||
func (c *ConnWithReconnect) reconnect(resetConn *ldap.Conn) (*ldap.Conn, error) {
|
||||
@@ -228,7 +428,6 @@ func (c *ConnWithReconnect) StartTLS(*tls.Config) error {
|
||||
// Close implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Close() (err error) {
|
||||
conn, err := c.getConnection()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -237,7 +436,6 @@ func (c *ConnWithReconnect) Close() (err error) {
|
||||
|
||||
func (c *ConnWithReconnect) GetLastError() error {
|
||||
conn, err := c.getConnection()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -249,18 +447,6 @@ func (c *ConnWithReconnect) IsClosing() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Extended implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Extended(request *ldap.ExtendedRequest) (*ldap.ExtendedResponse, error) {
|
||||
var err error
|
||||
var res *ldap.ExtendedResponse
|
||||
|
||||
retryErr := c.retry(func(c ldap.Client) error {
|
||||
res, err = c.Extended(request)
|
||||
return err
|
||||
})
|
||||
return res, retryErr
|
||||
}
|
||||
|
||||
// SetTimeout implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) SetTimeout(time.Duration) {}
|
||||
|
||||
@@ -284,37 +470,11 @@ func (c *ConnWithReconnect) ExternalBind() error {
|
||||
return ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
// ModifyWithResult implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) ModifyWithResult(m *ldap.ModifyRequest) (*ldap.ModifyResult, error) {
|
||||
var err error
|
||||
var res *ldap.ModifyResult
|
||||
|
||||
retryErr := c.retry(func(c ldap.Client) error {
|
||||
res, err = c.ModifyWithResult(m)
|
||||
return err
|
||||
})
|
||||
|
||||
return res, retryErr
|
||||
}
|
||||
|
||||
// Compare implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Compare(dn, attribute, value string) (bool, error) {
|
||||
return false, ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented"))
|
||||
}
|
||||
|
||||
// PasswordModify implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) PasswordModify(m *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) {
|
||||
var err error
|
||||
var res *ldap.PasswordModifyResult
|
||||
|
||||
retryErr := c.retry(func(c ldap.Client) error {
|
||||
res, err = c.PasswordModify(m)
|
||||
return err
|
||||
})
|
||||
|
||||
return res, retryErr
|
||||
}
|
||||
|
||||
// SearchWithPaging implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) {
|
||||
return nil, ldap.NewError(ldap.LDAPResultNotSupported, fmt.Errorf("not implemented"))
|
||||
@@ -322,7 +482,6 @@ func (c *ConnWithReconnect) SearchWithPaging(searchRequest *ldap.SearchRequest,
|
||||
|
||||
// SearchAsync implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) SearchAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int) ldap.Response {
|
||||
// unimplemented
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -348,12 +507,10 @@ func (c *ConnWithReconnect) DirSync(searchRequest *ldap.SearchRequest, flags, ma
|
||||
|
||||
// DirSyncAsync implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags, maxAttrCount int64, cookie []byte) ldap.Response {
|
||||
// unimplemented
|
||||
return nil
|
||||
}
|
||||
|
||||
// Syncrepl implements the ldap.Client interface
|
||||
func (c *ConnWithReconnect) Syncrepl(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool) ldap.Response {
|
||||
// unimplemented
|
||||
return nil
|
||||
}
|
||||
Vendored
+1
-1
@@ -1321,7 +1321,7 @@ github.com/orcaman/concurrent-map
|
||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
|
||||
## explicit; go 1.18
|
||||
github.com/owncloud/libre-graph-api-go
|
||||
# github.com/owncloud/reva/v2 v2.0.0-20260731090835-a9c3ec9eef2b
|
||||
# github.com/owncloud/reva/v2 v2.0.0-20260804100559-3d6017309c36
|
||||
## explicit; go 1.25.8
|
||||
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
||||
github.com/owncloud/reva/v2/cmd/revad/runtime
|
||||
|
||||
Reference in new issue
Block a user