FAQ
Author: brock
Date: Tue Dec 17 15:19:31 2013
New Revision: 1551568

URL: http://svn.apache.org/r1551568
Log:
HIVE-5812 - HiveServer2 SSL connection transport binds to loopback address by default (Prasad Mujumdar via Brock Noland)

Modified:
     hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
     hive/trunk/service/src/java/org/apache/hive/service/auth/HiveAuthFactory.java

Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java?rev=1551568&r1=1551567&r2=1551568&view=diff
==============================================================================
--- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java (original)
+++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java Tue Dec 17 15:19:31 2013
@@ -42,6 +42,7 @@ import java.util.Map;
  import java.util.Map.Entry;
  import java.util.Properties;
  import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;

  import javax.security.sasl.Sasl;
  import javax.security.sasl.SaslException;
@@ -100,7 +101,7 @@ public class HiveConnection implements j
    private int loginTimeout = 0;

    public HiveConnection(String uri, Properties info) throws SQLException {
- loginTimeout = DriverManager.getLoginTimeout();
+ setupLoginTimeout();
      jdbcURI = uri;
      // parse the connection uri
      Utils.JdbcConnectionParams connParams = Utils.parseURL(jdbcURI);
@@ -326,6 +327,16 @@ public class HiveConnection implements j
      return varValue;
    }

+ // copy loginTimeout from driver manager. Thrift timeout needs to be in millis
+ private void setupLoginTimeout() {
+ long timeOut = TimeUnit.SECONDS.toMillis(DriverManager.getLoginTimeout());
+ if (timeOut > Integer.MAX_VALUE) {
+ loginTimeout = Integer.MAX_VALUE;
+ } else {
+ loginTimeout = (int) timeOut;
+ }
+ }
+
    public void abort(Executor executor) throws SQLException {
      // JDK 1.7
      throw new SQLException("Method not supported");

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=1551568&r1=1551567&r2=1551568&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 Tue Dec 17 15:19:31 2013
@@ -195,8 +195,13 @@ public class HiveAuthFactory {
          new TSSLTransportFactory.TSSLTransportParameters();
      params.setKeyStore(keyStorePath, keyStorePassWord);

- return TSSLTransportFactory.getServerSocket(portNum, 10000,
- InetAddress.getByName(hiveHost), params);
+ InetAddress serverAddress;
+ if (hiveHost == null || hiveHost.isEmpty()) {
+ serverAddress = InetAddress.getLocalHost();
+ } else {
+ serverAddress = InetAddress.getByName(hiveHost);
+ }
+ return TSSLTransportFactory.getServerSocket(portNum, 10000, serverAddress, params);
    }

  }

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedDec 17, '13 at 3:20p
activeDec 17, '13 at 3:20p
posts1
users1
websitehive.apache.org

1 user in discussion

Brock: 1 post

People

Translate

site design / logo © 2021 Grokbase