You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/02/18 04:43:40 UTC
[3/4] hive git commit: HIVE-12981 : ThriftCLIService uses
incompatible getShortName() implementation (Bolke de Bruin,
reviewed by Sergey Shelukhin)
HIVE-12981 : ThriftCLIService uses incompatible getShortName() implementation (Bolke de Bruin, reviewed by Sergey Shelukhin)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/39285e5c
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/39285e5c
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/39285e5c
Branch: refs/heads/branch-1
Commit: 39285e5ccd4a6582e88cbb0efd1cf0efe9106726
Parents: f4ffd5d
Author: Sergey Shelukhin <se...@apache.org>
Authored: Wed Feb 17 19:36:22 2016 -0800
Committer: Sergey Shelukhin <se...@apache.org>
Committed: Wed Feb 17 19:36:22 2016 -0800
----------------------------------------------------------------------
.../hive/service/cli/thrift/ThriftCLIService.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/39285e5c/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
index 926f18f..1d5e504 100644
--- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
+++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
@@ -35,6 +35,8 @@ import org.apache.hadoop.hive.common.metrics.common.MetricsConstant;
import org.apache.hadoop.hive.common.metrics.common.MetricsFactory;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hadoop.hive.shims.HadoopShims.KerberosNameShim;
+import org.apache.hadoop.hive.shims.ShimLoader;
import org.apache.hive.service.AbstractService;
import org.apache.hive.service.ServiceException;
import org.apache.hive.service.ServiceUtils;
@@ -365,7 +367,7 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
* @return
* @throws HiveSQLException
*/
- private String getUserName(TOpenSessionReq req) throws HiveSQLException {
+ private String getUserName(TOpenSessionReq req) throws HiveSQLException, IOException {
String userName = null;
// Kerberos
if (isKerberosAuthMode()) {
@@ -391,12 +393,12 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
return effectiveClientUser;
}
- private String getShortName(String userName) {
+ private String getShortName(String userName) throws IOException {
String ret = null;
+
if (userName != null) {
- int indexOfDomainMatch = ServiceUtils.indexOfDomainMatch(userName);
- ret = (indexOfDomainMatch <= 0) ? userName :
- userName.substring(0, indexOfDomainMatch);
+ KerberosNameShim fullKerberosName = ShimLoader.getHadoopShims().getKerberosNameShim(userName);
+ ret = fullKerberosName.getShortName();
}
return ret;