James Server
  1. James Server
  2. JAMES-1061

NPE when connect to smtpserver with ipv6 ipaddress

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.0-M1, 3.0.0, Trunk
    • Fix Version/s: 3.0-M1
    • Component/s: None
    • Labels:
      None

      Description

      See below:

      java.lang.NullPointerException
      at org.apache.james.util.inetnetwork.model.Inet4Network.maskIP(Inet4Network.java:91)
      at org.apache.james.util.inetnetwork.model.Inet4Network.contains(Inet4Network.java:58)
      at org.apache.james.util.netmatcher.NetMatcher.matchInetNetwork(NetMatcher.java:105)
      at org.apache.james.util.netmatcher.NetMatcher.matchInetNetwork(NetMatcher.java:88)
      at org.apache.james.smtpserver.netty.NioSMTPServer$SMTPHandlerConfigurationDataImpl.isRelayingAllowed(NioSMTPServer.java:241)
      at org.apache.james.smtpserver.netty.SMTPNettySession.<init>(SMTPNettySession.java:62)
      at org.apache.james.smtpserver.netty.SMTPNettySession.<init>(SMTPNettySession.java:66)
      at org.apache.james.smtpserver.netty.SMTPChannelUpstreamHandler.createSession(SMTPChannelUpstreamHandler.java:67)
      at org.apache.james.protocols.impl.AbstractChannelUpstreamHandler.channelBound(AbstractChannelUpstreamHandler.java:56)
      at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:144)
      at org.jboss.netty.channel.Channels.fireChannelBound(Channels.java:205)
      at org.jboss.netty.channel.socket.nio.NioAcceptedSocketChannel.<init>(NioAcceptedSocketChannel.java:50)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.registerAcceptedChannel(NioServerSocketPipelineSink.java:279)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:247)
      at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:637)
      DEBUG 12:12:51,117 | james.smtpserver | Unable to process request
      java.nio.channels.ClosedChannelException
      at org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:648)
      at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:604)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:119)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:76)
      at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60)
      at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleDownstream(ChunkedWriteHandler.java:114)
      at org.jboss.netty.channel.Channels.close(Channels.java:720)
      at org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:207)
      at org.apache.james.smtpserver.netty.SMTPChannelUpstreamHandler.exceptionCaught(SMTPChannelUpstreamHandler.java:90)
      at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:144)
      at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:238)
      at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:432)
      at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:52)
      at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:144)
      at org.jboss.netty.channel.Channels.fireChannelBound(Channels.java:205)
      at org.jboss.netty.channel.socket.nio.NioAcceptedSocketChannel.<init>(NioAcceptedSocketChannel.java:50)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.registerAcceptedChannel(NioServerSocketPipelineSink.java:279)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:247)
      at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:637)
      DEBUG 12:12:51,122 | james.smtpserver | Dispose objects while closing channel 1654545953
      DEBUG 12:12:51,123 | james.smtpserver | Unable to process request
      java.lang.NullPointerException
      at org.apache.james.protocols.smtp.core.WelcomeMessageHandler.onConnect(WelcomeMessageHandler.java:45)
      at org.apache.james.protocols.smtp.core.WelcomeMessageHandler.onConnect(WelcomeMessageHandler.java:34)
      at org.apache.james.protocols.impl.AbstractChannelUpstreamHandler.channelConnected(AbstractChannelUpstreamHandler.java:72)
      at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:144)
      at org.jboss.netty.channel.Channels.fireChannelConnected(Channels.java:233)
      at org.jboss.netty.channel.socket.nio.NioAcceptedSocketChannel.<init>(NioAcceptedSocketChannel.java:51)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.registerAcceptedChannel(NioServerSocketPipelineSink.java:279)
      at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.run(NioServerSocketPipelineSink.java:247)
      at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:637)

        Activity

        Hide
        Eric Charles added a comment -

        Added a few checks and tests (ipv4 mixing ipv6), ipv6 subnetmask delimiter %, and return false in case of UnknownHostException.
        Fixed on Norman's mac os.
        Can be closed.

        Show
        Eric Charles added a comment - Added a few checks and tests (ipv4 mixing ipv6), ipv6 subnetmask delimiter %, and return false in case of UnknownHostException. Fixed on Norman's mac os. Can be closed.
        Hide
        Eric Charles added a comment -

        Can you try with <authorizedAddresses>0:0:0:0:0:0:0:1%0 </authorizedAddresses> in smtpserver.xml ?

        Show
        Eric Charles added a comment - Can you try with <authorizedAddresses>0:0:0:0:0:0:0:1%0 </authorizedAddresses> in smtpserver.xml ?
        Hide
        Norman Maurer added a comment -

        The RemoteAddress which cause the NPE is: 0:0:0:0:0:0:0:1%0

        Show
        Norman Maurer added a comment - The RemoteAddress which cause the NPE is: 0:0:0:0:0:0:0:1%0
        Hide
        Norman Maurer added a comment -

        To reproduce this issue I just use the following command on osx:

        telnet localhost 25

        If I use the following command it works:

        telnet -4 localhost 25

        I think your guess is right, it's prolly a "null" netmask

        Show
        Norman Maurer added a comment - To reproduce this issue I just use the following command on osx: telnet localhost 25 If I use the following command it works: telnet -4 localhost 25 I think your guess is right, it's prolly a "null" netmask
        Hide
        Eric Charles added a comment -

        the cause may be a null ip address or a null netmask.
        This may come from a code bug, or from missing guard.
        To further analyze, it would be good I can repoduce it.
        I suppose it occurs when you send an email to a specific domain for which the dns is only ipv6.

        Could you post a scenario to reproduce it ?
        Tks,

        Show
        Eric Charles added a comment - the cause may be a null ip address or a null netmask. This may come from a code bug, or from missing guard. To further analyze, it would be good I can repoduce it. I suppose it occurs when you send an email to a specific domain for which the dns is only ipv6. Could you post a scenario to reproduce it ? Tks,

          People

          • Assignee:
            Unassigned
            Reporter:
            Norman Maurer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development