You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2022/12/05 23:43:46 UTC

[GitHub] [james-project] ouvtam commented on a diff in pull request #1344: JAMES-3788 Prevent NPE upon data-races when receiving PROXY command

ouvtam commented on code in PR #1344:
URL: https://github.com/apache/james-project/pull/1344#discussion_r1038874505


##########
protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java:
##########
@@ -145,12 +150,25 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
     }
 
 
+    private static String retrieveIp(ChannelHandlerContext ctx) {
+        SocketAddress remoteAddress = ctx.channel().remoteAddress();
+        if (remoteAddress instanceof InetSocketAddress) {
+            InetSocketAddress address = (InetSocketAddress) remoteAddress;
+            return address.getAddress().getHostAddress();
+        }
+        return remoteAddress.toString();
+    }
+
     /**
      * Call the {@link LineHandler} 
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+        if (msg instanceof HAProxyMessage) {

Review Comment:
   Should this block not come after the next one (i.e. behaviourOverrides).
   
   For instance, when we are in SMTP DATA command (no STARTTLS) and receive a line that matches the HAProxy plain protocol line "PROXY TCP4 ..." then this gets triggered before the `behaviourOverrides`? I might be wrong, but just to confirm.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org