Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5377#discussion_r28282594
  
    --- Diff: 
network/common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java
 ---
    @@ -62,13 +76,26 @@ public void doBootstrap(TransportClient client) {
             byte[] response = client.sendRpcSync(buf.array(), 
conf.saslRTTimeoutMs());
             payload = saslClient.response(response);
           }
    +
    +      if (encrypt) {
    +        if 
(!SparkSaslServer.QOP_AUTH_CONF.equals(saslClient.getNegotiatedProperty(Sasl.QOP)))
 {
    +          throw new RuntimeException(
    +            new SaslException("Encryption requests by negotiated 
non-encrypted connection."));
    +        }
    +        SaslEncryption.addToChannel(channel, saslClient, 
conf.maxSaslEncryptedBlockSize());
    +        saslClient = null;
    +        logger.debug("Channel {} configured for SASL encryption.", client);
    +      }
         } finally {
    -      try {
    -        // Once authentication is complete, the server will trust all 
remaining communication.
    -        saslClient.dispose();
    -      } catch (RuntimeException e) {
    -        logger.error("Error while disposing SASL client", e);
    +      if (saslClient != null) {
    --- End diff --
    
    Checking for `encrypt` wouldn't work because we still want to dispose of 
the client instance when some error is thrown.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to