This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch dev-1.0.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 363ea2b267b6a676a73ba692b1bf09b63f860c5c 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 ede65287eb..8e7d893c61 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 @@ -102,13 +102,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]
