This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a5fea86d0a [fix][ldap] fix ldap password null pointer exception.
(#10284)
a5fea86d0a is described below
commit a5fea86d0aae229aa01d0f8b391cb69cbcf8722b
Author: luozenglin <[email protected]>
AuthorDate: Thu Jun 23 15:01:18 2022 +0800
[fix][ldap] fix ldap password null pointer exception. (#10284)
---
fe/fe-core/src/main/java/org/apache/doris/ldap/LdapClient.java | 4 ++--
fe/fe-core/src/main/java/org/apache/doris/persist/LdapInfo.java | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/ldap/LdapClient.java
b/fe/fe-core/src/main/java/org/apache/doris/ldap/LdapClient.java
index 053c10e348..b5e56bff40 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/ldap/LdapClient.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/ldap/LdapClient.java
@@ -100,13 +100,13 @@ public class LdapClient {
}
public boolean checkUpdate(String ldapPassword) {
- return !this.ldapPassword.equals(ldapPassword);
+ return this.ldapPassword == null ||
!this.ldapPassword.equals(ldapPassword);
}
}
private static void init() {
LdapInfo ldapInfo =
Catalog.getCurrentCatalog().getAuth().getLdapInfo();
- if (ldapInfo == null) {
+ if (ldapInfo == null || !ldapInfo.isValid()) {
LOG.error("info is null, maybe no ldap admin password is set.");
ErrorReport.report(ErrorCode.ERROR_LDAP_CONFIGURATION_ERR);
throw new RuntimeException("ldapTemplate is not initialized");
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/LdapInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/persist/LdapInfo.java
index f985ef91c4..7b447ad962 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/LdapInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/LdapInfo.java
@@ -46,6 +46,10 @@ public class LdapInfo implements Writable {
ldapPasswdEncrypted = SymmetricEncryption.encrypt(ldapPasswd,
secretKey, iv);
}
+ public boolean isValid() {
+ return ldapPasswdEncrypted != null && secretKey != null && iv != null;
+ }
+
public String getLdapPasswdEncrypted() {
return ldapPasswdEncrypted;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]