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

    https://github.com/apache/drill/pull/950#discussion_r140333837
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java ---
    @@ -102,19 +115,78 @@
       // these are used for authentication
       private volatile List<String> serverAuthMechanisms = null;
       private volatile boolean authComplete = true;
    +  private SSLConfig sslConfig;
    +  private Channel sslChannel;
    +  private DrillbitEndpoint endpoint;
     
       public UserClient(String clientName, DrillConfig config, boolean 
supportComplexTypes,
    -      BufferAllocator allocator, EventLoopGroup eventLoopGroup, Executor 
eventExecutor) {
    -    super(
    -        UserRpcConfig.getMapping(config, eventExecutor),
    -        allocator.getAsByteBufAllocator(),
    -        eventLoopGroup,
    -        RpcType.HANDSHAKE,
    -        BitToUserHandshake.class,
    -        BitToUserHandshake.PARSER);
    +      BufferAllocator allocator, EventLoopGroup eventLoopGroup, Executor 
eventExecutor,
    +      DrillbitEndpoint endpoint) throws NonTransientRpcException {
    +    super(UserRpcConfig.getMapping(config, eventExecutor), 
allocator.getAsByteBufAllocator(),
    +        eventLoopGroup, RpcType.HANDSHAKE, BitToUserHandshake.class, 
BitToUserHandshake.PARSER);
    +    this.endpoint = endpoint; // save the endpoint; it might be needed by 
SSL init.
         this.clientName = clientName;
         this.allocator = allocator;
         this.supportComplexTypes = supportComplexTypes;
    +    this.sslChannel = null;
    +    try {
    +      this.sslConfig = new 
SSLConfigBuilder().config(config).mode(SSLFactory.Mode.CLIENT)
    +          .initializeSSLContext(true).validateKeyStore(false).build();
    +    } catch (DrillException e) {
    +      throw new NonTransientRpcException(e.getMessage());
    --- End diff --
    
    The exception will be thrown if there is any issue with passed parameters 
for SSL so it would be better if we change this exception to 
InvalidConnectionInfoException.


---

Reply via email to