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

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

    XMLWordPrintableJSON

    Details

      Description

      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 "127.0.0.1" 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 "[127.0.0.1]" 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 "127.0.0.1" 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                norman Norman Maurer
                Reporter:
                bago Stefano Bagnara
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: