Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A4931751B for ; Sat, 8 Nov 2014 19:19:26 +0000 (UTC) Received: (qmail 76771 invoked by uid 500); 8 Nov 2014 19:19:26 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 76719 invoked by uid 500); 8 Nov 2014 19:19:26 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 76708 invoked by uid 99); 8 Nov 2014 19:19:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Nov 2014 19:19:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Nov 2014 19:19:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9C37F23889D7; Sat, 8 Nov 2014 19:18:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1637588 - in /hive/trunk/service/src/java/org/apache/hive/service: auth/HiveAuthFactory.java cli/thrift/ThriftCLIService.java server/HiveServer2.java Date: Sat, 08 Nov 2014 19:18:01 -0000 To: commits@hive.apache.org From: vgumashta@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141108191801.9C37F23889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vgumashta Date: Sat Nov 8 19:18:01 2014 New Revision: 1637588 URL: http://svn.apache.org/r1637588 Log: HIVE-8764: Windows: HiveServer2 TCP SSL cannot recognize localhost (Vaibhav Gumashta reviewed by Thejas Nair) Modified: hive/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java hive/trunk/service/src/java/org/apache/hive/service/server/HiveServer2.java Modified: hive/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java?rev=1637588&r1=1637587&r2=1637588&view=diff ============================================================================== --- hive/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java (original) +++ hive/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java Sat Nov 8 19:18:01 2014 @@ -218,6 +218,7 @@ public class HiveAuthFactory { throws TTransportException { InetSocketAddress serverAddress; if (hiveHost == null || hiveHost.isEmpty()) { + // Wildcard bind serverAddress = new InetSocketAddress(portNum); } else { serverAddress = new InetSocketAddress(hiveHost, portNum); @@ -226,25 +227,26 @@ public class HiveAuthFactory { } public static TServerSocket getServerSSLSocket(String hiveHost, int portNum, String keyStorePath, - String keyStorePassWord, List sslVersionBlacklist) - throws TTransportException, UnknownHostException { + String keyStorePassWord, List sslVersionBlacklist) throws TTransportException, + UnknownHostException { TSSLTransportFactory.TSSLTransportParameters params = - new TSSLTransportFactory.TSSLTransportParameters(); + new TSSLTransportFactory.TSSLTransportParameters(); params.setKeyStore(keyStorePath, keyStorePassWord); - - InetAddress serverAddress; + InetSocketAddress serverAddress; if (hiveHost == null || hiveHost.isEmpty()) { - serverAddress = InetAddress.getLocalHost(); + // Wildcard bind + serverAddress = new InetSocketAddress(portNum); } else { - serverAddress = InetAddress.getByName(hiveHost); + serverAddress = new InetSocketAddress(hiveHost, portNum); } - TServerSocket thriftServerSocket = TSSLTransportFactory.getServerSocket(portNum, 0, serverAddress, params); + TServerSocket thriftServerSocket = + TSSLTransportFactory.getServerSocket(portNum, 0, serverAddress.getAddress(), params); if (thriftServerSocket.getServerSocket() instanceof SSLServerSocket) { List sslVersionBlacklistLocal = new ArrayList(); for (String sslVersion : sslVersionBlacklist) { sslVersionBlacklistLocal.add(sslVersion.trim().toLowerCase()); } - SSLServerSocket sslServerSocket = (SSLServerSocket)thriftServerSocket.getServerSocket(); + SSLServerSocket sslServerSocket = (SSLServerSocket) thriftServerSocket.getServerSocket(); List enabledProtocols = new ArrayList(); for (String protocol : sslServerSocket.getEnabledProtocols()) { if (sslVersionBlacklistLocal.contains(protocol.toLowerCase())) { @@ -254,7 +256,8 @@ public class HiveAuthFactory { } } sslServerSocket.setEnabledProtocols(enabledProtocols.toArray(new String[0])); - LOG.info("SSL Server Socket Enabled Protocols: " + Arrays.toString(sslServerSocket.getEnabledProtocols())); + LOG.info("SSL Server Socket Enabled Protocols: " + + Arrays.toString(sslServerSocket.getEnabledProtocols())); } return thriftServerSocket; } Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java?rev=1637588&r1=1637587&r2=1637588&view=diff ============================================================================== --- hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java (original) +++ hive/trunk/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java Sat Nov 8 19:18:01 2014 @@ -55,7 +55,7 @@ public abstract class ThriftCLIService e protected static HiveAuthFactory hiveAuthFactory; protected int portNum; - protected InetAddress serverAddress; + protected InetAddress serverIPAddress; protected String hiveHost; protected TServer server; protected org.eclipse.jetty.server.Server httpServer; @@ -85,9 +85,9 @@ public abstract class ThriftCLIService e } try { if (hiveHost != null && !hiveHost.isEmpty()) { - serverAddress = InetAddress.getByName(hiveHost); + serverIPAddress = InetAddress.getByName(hiveHost); } else { - serverAddress = InetAddress.getLocalHost(); + serverIPAddress = InetAddress.getLocalHost(); } } catch (UnknownHostException e) { throw new ServiceException(e); @@ -153,8 +153,8 @@ public abstract class ThriftCLIService e return portNum; } - public InetAddress getServerAddress() { - return serverAddress; + public InetAddress getServerIPAddress() { + return serverIPAddress; } @Override Modified: hive/trunk/service/src/java/org/apache/hive/service/server/HiveServer2.java URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/server/HiveServer2.java?rev=1637588&r1=1637587&r2=1637588&view=diff ============================================================================== --- hive/trunk/service/src/java/org/apache/hive/service/server/HiveServer2.java (original) +++ hive/trunk/service/src/java/org/apache/hive/service/server/HiveServer2.java Sat Nov 8 19:18:01 2014 @@ -249,10 +249,10 @@ public class HiveServer2 extends Composi } private String getServerInstanceURI(HiveConf hiveConf) throws Exception { - if ((thriftCLIService == null) || (thriftCLIService.getServerAddress() == null)) { + if ((thriftCLIService == null) || (thriftCLIService.getServerIPAddress() == null)) { throw new Exception("Unable to get the server address; it hasn't been initialized yet."); } - return thriftCLIService.getServerAddress().getHostName() + ":" + return thriftCLIService.getServerIPAddress().getHostName() + ":" + thriftCLIService.getPortNumber(); }