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

    https://github.com/apache/drill/pull/773#discussion_r111676760
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserServer.java ---
    @@ -335,8 +350,27 @@ public BitToUserHandshake 
getHandshakeResponse(UserToBitHandshake inbound) throw
                 }
               }
     
    -          // mention server's authentication capabilities
    -          
respBuilder.addAllAuthenticationMechanisms(config.getAuthProvider().getAllFactoryNames());
    +          // We are checking in UserConnectionConfig that if SASL 
encryption is enabled then mechanisms other
    +          // than PLAIN are also configured otherwise throw exception
    +          final Set<String> configuredMech = 
config.getAuthProvider().getAllFactoryNames();
    +
    +          if (!config.isEncryptionEnabled()) {
    +
    +            respBuilder.addAllAuthenticationMechanisms(configuredMech);
    +          } else {
    +            final Set<String> saslEncryptMech = new HashSet<>();
    +
    +            for (String mechanism : configuredMech) {
    +              if 
(!mechanism.equals(PlainFactory.SIMPLE_NAME.toLowerCase())) {
    +                saslEncryptMech.add(mechanism);
    +              }
    +            }
    +            respBuilder.addAllAuthenticationMechanisms(saslEncryptMech);
    +          }
    +
    +          // set the encrypted flag in handshake message. For older 
clients this field is optional so will be ignored
    +          respBuilder.setEncrypted(connection.isEncrypted());
    --- End diff --
    
    if client is new which supports encryption and encryption is disabled on 
server side then server will set the `encrypted` flag to false so that client 
knows not to negotiate for encryption. Whereas wrapChunkSize parameter will be 
ignored.


---
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.
---

Reply via email to