james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: MX records with IP addresses
Date Fri, 23 Apr 2004 03:14:40 GMT
> I would say that Brian is correct in his interpretation.

So would I.

> Does James want to enforce such a strict interpreptation?
> Depends on the deployer.

We have not had such a strict interpretation up until now, because java.net
is more lenient.

> This issue doesn't compromise James behaviour, so maybe we should consider
> adding a wrapper to Brians stuff which can be configured to enforce strict
> or lenient RFC compliance and adjusts its behaviour accordingly.

For which release?

Brian wrote that: "It should be easy enough to do this in the application;
call getTarget() on the MXRecord, relativize it to the root name, and if it
looks like an IP address, treat it as one."  I'm sure he's right, but I
started to play with some code (below) for that, and I'm not sure what to do
with it.  Maybe I'm just being dense.  :-(

We are trying to take user@domain, and resolve its MX information.  The
domain part does not have a trailing '.', and it appears that
Name.relativize(String) does nothing if the origin passed isn't absolute
(has trailing '.').  And if it does, we'd have to add the origin back before
we could use it.  For some reason I thought that the target already has the
origin when we get it from the DNS lookup.  I checked against my own zone,
and when query for a record that is defined with a relative value, I get an
absolute one back from dig.

Maybe I'm being too simplistic with DNS ... I was thinking we could just
strip the trailing '.' before passing the value to Address.get[All]ByName().

>From Brian's comments, do you see what we should be doing?  I just want to
get this right, and it ends up isolated in once place.

	--- Noel

 final String[] domains = { "fogods.com", "cnpa.org", "devtech.com" };

 for (int i = 0 ; i < domains.length ; i++)
 try
 {
     String domain = domains[i];
     System.out.println("\n\n" + domain + "\n");

     Record[] records = new Lookup(domain, Type.MX).run();
     MXRecord mx = (MXRecord) records[0];
     System.out.println("MX = " + mx.getTarget().toString ());

     System.out.println("MX.relativize(origin) = " +
mx.getTarget().relativize(Name.fromString(domain)).toString());
     System.out.println("MX.relativize(origin.) = " +
mx.getTarget().relativize(Name.fromString(domain + ".")).toString());

     System.out.println("domain(MX.relativize(origin.), origin) = " +
Name.fromString(mx.getTarget().relativize(Name.fromString(domain +
".")).toString(), Name.fromString(domain)));
     System.out.println("domain(MX.relativize(origin), origin) = " +
Name.fromString(mx.getTarget().relativize(Name.fromString(domain)).toString(
), Name.fromString(domain)));
     System.out.println("domain(MX.relativize(origin.), origin.) = " +
Name.fromString(mx.getTarget().relativize(Name.fromString(domain +
".")).toString(), Name.fromString(domain + ".")));
     System.out.println("domain(MX.relativize(origin), origin.) = " +
Name.fromString(mx.getTarget().relativize(Name.fromString(domain)).toString(
), Name.fromString(domain + ".")));

     System.out.println("A(MX) = " +
Address.getByName(mx.getTarget().toString()));
     System.out.println("A(MX.relativize(origin)) = " +
Address.getByName(mx.getTarget().relativize(Name.fromString(domain)).toStrin
g()).toString());
     System.out.println("A(MX.relativize(origin.)) = " +
Address.getByName(mx.getTarget().relativize(Name.fromString(domain +
".")).toString()).toString());
 }
 catch (Exception e)
 {
     System.err.println(e.getMessage());
 }

----------------------------

fogods.com

MX = 218.106.116.147.
MX.relativize(origin) = 218.106.116.147.
MX.relativize(origin.) = 218.106.116.147.
domain(MX.relativize(origin.), origin) = 218.106.116.147.
domain(MX.relativize(origin), origin) = 218.106.116.147.
domain(MX.relativize(origin.), origin.) = 218.106.116.147.
domain(MX.relativize(origin), origin.) = 218.106.116.147.
unknown host


cnpa.org

MX = mail.devtech.com.
MX.relativize(origin) = mail.devtech.com.
MX.relativize(origin.) = mail.devtech.com.
domain(MX.relativize(origin.), origin) = mail.devtech.com.
domain(MX.relativize(origin), origin) = mail.devtech.com.
domain(MX.relativize(origin.), origin.) = mail.devtech.com.
domain(MX.relativize(origin), origin.) = mail.devtech.com.
A(MX) = /66.112.202.2
A(MX.relativize(origin)) = /66.112.202.2
A(MX.relativize(origin.)) = /66.112.202.2


devtech.com

MX = mail.devtech.com.
MX.relativize(origin) = mail.devtech.com.
MX.relativize(origin.) = mail
domain(MX.relativize(origin.), origin) = mail.devtech.com
domain(MX.relativize(origin), origin) = mail.devtech.com.
domain(MX.relativize(origin.), origin.) = mail.devtech.com.
domain(MX.relativize(origin), origin.) = mail.devtech.com.
A(MX) = /66.112.202.2
A(MX.relativize(origin)) = /66.112.202.2
unknown host


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


Mime
View raw message