sijie commented on a change in pull request #183: BOOKKEEPER-588 SSL Support 
for Bookkeeper
URL: https://github.com/apache/bookkeeper/pull/183#discussion_r124879507
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AuthHandler.java
 ##########
 @@ -272,28 +264,37 @@ public void channelRead(ChannelHandlerContext ctx, 
Object msg) throws Exception
                 super.channelRead(ctx, msg);
             } else if (msg instanceof BookkeeperProtocol.Response) {
                 BookkeeperProtocol.Response resp = 
(BookkeeperProtocol.Response) msg;
-                if (resp.getHeader().getOperation() == 
BookkeeperProtocol.OperationType.AUTH) {
-                    if (resp.getStatus() != BookkeeperProtocol.StatusCode.EOK) 
{
-                        authenticationError(ctx, resp.getStatus().getNumber());
-                    } else {
-                        assert (resp.hasAuthResponse());
-                        BookkeeperProtocol.AuthMessage am = 
resp.getAuthResponse();
-                        if 
(AuthProviderFactoryFactory.authenticationDisabledPluginName.equals(am.getAuthPluginName())){
-                            SocketAddress remote  = 
ctx.channel().remoteAddress();
-                            LOG.info("Authentication is not enabled."
-                                + "Considering this client {0} authenticated", 
remote);
-                            AuthHandshakeCompleteCallback 
authHandshakeCompleteCallback
-                                = new AuthHandshakeCompleteCallback(ctx);
-                            
authHandshakeCompleteCallback.operationComplete(BKException.Code.OK, null);
-                            return;
-                        }
-                        byte[] payload = am.getPayload().toByteArray();
-                        authProvider.process(AuthToken.wrap(payload), new 
AuthRequestCallback(ctx,
-                            authProviderFactory.getPluginName()));
-                    }
-                } else {
-                    // else just drop the message,
-                    // we're not authenticated so nothing should be coming 
through
+                if (null == resp.getHeader().getOperation()) {
+                    LOG.info("dropping received malformed message {} from 
bookie {}", msg, ctx.channel());
+                    // drop the message without header
+                } else switch (resp.getHeader().getOperation()) {
 
 Review comment:
   else {
       switch (...) {
       }
   }
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to