Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/5377#discussion_r28253379
--- 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 --
rather than setting `saslClient = null` in the `encrypt` block, and then
checking for null here, why not just use `if (!encrypt)` here? If there is not
another reason to `saslClient = null`, I think that would be clearer.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]