You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/08/26 07:22:03 UTC
[incubator-kyuubi] branch branch-1.6 updated: [KYUUBI #3355] Backport HIVE-20583 - Use canonical hostname only for kerberos auth in HiveConnection
This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/branch-1.6 by this push:
new 340893f10 [KYUUBI #3355] Backport HIVE-20583 - Use canonical hostname only for kerberos auth in HiveConnection
340893f10 is described below
commit 340893f1076211fc9ab5fb9b22d7be733a4c6e06
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Fri Aug 26 15:21:25 2022 +0800
[KYUUBI #3355] Backport HIVE-20583 - Use canonical hostname only for kerberos auth in HiveConnection
### _Why are the changes needed?_
Fix #3352
[HIVE-17218](https://issues.apache.org/jira/browse/HIVE-17218): Canonical-ize hostnames for Hive metastore, and HS2 servers
This may have the problem mentioned by JIRA
[HIVE-20583](https://issues.apache.org/jira/browse/HIVE-20583): Use canonical hostname only for kerberos auth in HiveConnection
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #3355 from pan3793/HIVE-20583.
Closes #3355
6e2ffa49 [Cheng Pan] Fix NPE
f09b8e6c [Cheng Pan] Backport HIVE-20583
Authored-by: Cheng Pan <ch...@apache.org>
Signed-off-by: Cheng Pan <ch...@apache.org>
(cherry picked from commit 1163a76eb38e261ab30437dc85c105a0187a89c3)
Signed-off-by: Cheng Pan <ch...@apache.org>
---
.../org/apache/kyuubi/jdbc/hive/KyuubiConnection.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
index b87bbd04d..8076f9588 100644
--- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
+++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
@@ -130,14 +130,18 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
throw new KyuubiSQLException(e);
}
jdbcUriString = connParams.getJdbcUriString();
+ sessConfMap = connParams.getSessionVars();
// JDBC URL: jdbc:hive2://<host>:<port>/dbName;sess_var_list?hive_conf_list#hive_var_list
// each list: <key1>=<val1>;<key2>=<val2> and so on
// sess_var_list -> sessConfMap
// hive_conf_list -> hiveConfMap
// hive_var_list -> hiveVarMap
- host = Utils.getCanonicalHostName(connParams.getHost());
+ if (isKerberosAuthMode()) {
+ host = Utils.getCanonicalHostName(connParams.getHost());
+ } else {
+ host = connParams.getHost();
+ }
port = connParams.getPort();
- sessConfMap = connParams.getSessionVars();
setupTimeout();
@@ -200,7 +204,11 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
}
// Update with new values
jdbcUriString = connParams.getJdbcUriString();
- host = Utils.getCanonicalHostName(connParams.getHost());
+ if (isKerberosAuthMode()) {
+ host = Utils.getCanonicalHostName(connParams.getHost());
+ } else {
+ host = connParams.getHost();
+ }
port = connParams.getPort();
} else {
errMsg = warnMsg;
@@ -816,6 +824,10 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
return isSaslAuthMode() && !hasSessionValue(AUTH_PRINCIPAL);
}
+ private boolean isKerberosAuthMode() {
+ return isSaslAuthMode() && hasSessionValue(AUTH_PRINCIPAL);
+ }
+
private Subject createSubject() {
if (isFromSubjectAuthMode()) {
AccessControlContext context = AccessController.getContext();