Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 🥅 Catch all LdapException when using mono connection #876

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,18 @@
try {
searchResult = ldapMonoConnection.search(searchRequest);
} catch (LDAPException e) {
if (e.getResultCode().intValue() == ResultCode.SERVER_DOWN_INT_VALUE) {
try {
if (Boolean.TRUE.equals(
Boolean.valueOf(config.get(LdapConfigKeys.READ_CONNECTION_AUTHENTICATED)))) {
ldapMonoConnection = LdapFactory.getSingleConnectionAuthenticated(config, true);
} else {
ldapMonoConnection = LdapFactory.getSingleConnection(config, true);
}
} catch (LDAPException e1) {
throw new StoreException("Search failed", e1);
try {
logger.info("Retry connection for error code " + e.getResultCode().intValue());
if (Boolean.TRUE.equals(
Boolean.valueOf(config.get(LdapConfigKeys.READ_CONNECTION_AUTHENTICATED)))) {
ldapMonoConnection = LdapFactory.getSingleConnectionAuthenticated(config, true);
} else {
ldapMonoConnection = LdapFactory.getSingleConnection(config, true);
}
searchResult = ldapMonoConnection.search(searchRequest);
} else {
throw new StoreException("search failed", e);
} catch (LDAPException e1) {
throw new StoreException("Failed to reopen connection", e1);
}
searchResult = ldapMonoConnection.search(searchRequest);

Check failure

Code scanning / CodeQL

LDAP query built from user-controlled sources Critical

This LDAP query depends on a
user-provided value
.
This LDAP query depends on a
user-provided value
.
This LDAP query depends on a
user-provided value
.
This LDAP query depends on a
user-provided value
.
This LDAP query depends on a
user-provided value
.
This LDAP query depends on a
user-provided value
.
}
PageResult<R> pageResult = new PageResult<>();
pageResult.setResults(
Expand Down
Loading