Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-623

make InetAddress.getLocalHost() and hello_name usage consistent across the application




      We currently (in trunk) have the following usages:

      A. core.AbstractJamesService.

      • read the helloName configuration.
      • if autodetect is true then try "InetAddress.getLocalHost().getHostName()" and on exception "localhost"
      • otherwise it uses the "localhost" child of helloHame.

      B. dnsserver.DNSServer.

      • in initialize(), if no dnsserver has been added try to add "InetAddress.getLocalHost().getHostName()" and revert to "" on exception

      C. fetchmail.MessageProcessor

      • computing a remote address, if it does not find the domain part it append the localhost and calulate it this way:
        InetAddress.getByName(InetAddress.getByName(InetAddress.getLocalHost().getHostAddress()).getHostName()).getHostName() and default to "[]" on exception.

      D. fetchmail.ParsedConfiguration

      • to compute default domain name: InetAddress.getByName(InetAddress.getLocalHost().getHostAddress()).getHostName(); and defaults to "localhost" on exception

      E. transport.mailets.AbstractRedirect, AbstractVirtualUserTable, DSNBounce

      • to set the RemoteAddr and RemoteHost for a locally generated mail: java.net.InetAddress.getLocalHost().getHostAddress() with fallback to "" and InetAddress.getLocalHost().getHostName() with fallback to "localhost".

      F. transport.mailets.RemoteDelivery and DSNBounce

      • to set the text part of a bounce message InetAddress.getLocalHost().getHostName() and fallback to [address unknown] (replace "[machine]" machine pattern with the result of the localhost).

      G. James

      • hostname = InetAddress.getLocalHost().getHostName() with fallback to "localhost".
      • put this in DefaultContext in the "HostName" key: not used by anyone.
      • if <servernames>/<autodetect> is true and hostname is not "localhost" add it to servernames (but lowercase it before).
      • use it as fallback as domain part of postmaster if no other servername (not autodected and not "localhost" has been found).

      I'll try to define a proposal to fix this, later. Now I just wanted to share the result of a code review about this issue.


        Issue Links



              norman Norman Maurer
              bago Stefano Bagnara
              0 Vote for this issue
              0 Start watching this issue