Repository: hive Updated Branches: refs/heads/branch-1 f4ffd5d5d -> 39285e5cc refs/heads/branch-1.2 194efa912 -> 2f8175bd4 refs/heads/master 0ac5e632f -> 185080477
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/98fe43d5 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/98fe43d5 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/98fe43d5 Branch: refs/heads/master Commit: 98fe43d59db681bb143cb047083a1b8c90473b03 Parents: 0ac5e63 Author: Sergey Shelukhin <[email protected]> Authored: Wed Feb 17 19:32:35 2016 -0800 Committer: Sergey Shelukhin <[email protected]> Committed: Wed Feb 17 19:32:35 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/98fe43d5/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 d9a9e3b..8dff264 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 @@ -34,6 +34,8 @@ 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.common.ServerUtils; +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; @@ -408,7 +410,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()) { @@ -434,12 +436,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;
