Tomas Korbar: > Hi, > > > Is "_submission._tcp" special only in the SMTP client? What happens > > with "_submission._tcp.$mydomain in other Postfix programs? > > _submission._tcp is special only to SMTP client. Behaviour of all other > programs remains the same. > > > The patch changes the global proto_info structure. That is unnecessary, > > and I have changed Postfix 3.6 to use "const INET_PROTO_INFO *" > > pointers everywhere, to prevent such unnecessary changes in the future. > > You are right. Fixed in the new patch posted on > https://tkorbar.fedorapeople.org/postfix-3.5.4-relayhost.patch > > > What is the difference in behavior between > > > > [_submission._tcp.$mydomain]:587 > > > > and > > > > _submission._tcp.$mydomain:587 > > In the first case, smtp client will perform directly lookup for SRV record > of submission > service of domain specified with $mydomain. > > In the second case, smtp client will at first try to perform lookup for MX > record of > "_submission._tcp.$mydomain" domain, which will most likely fail and in > response > to that, smtp_host_addr function will be called and that will cause the > name to be > resolved the same way as in the previous case.
Maybe it is better for the SMTP client to not look up MX records if the domain starts with _submission._tcp. Then the decision to look up SRV could be made higher-up, at the point where the SMTP client decides if it wants to do MX lookups or non-MX lookups. Thwn we end up with a hierarchy like: smtp_connect_remote calls smtp_domain_addr if it really wants to do MX lookup calls smtp_host_addr if MX record does not exist calls smtp_srv_ddr if it really wants to do SRV lookup calls smtp_host_addr with the SRV lookup result calls smtp_host_addr if it wants neither MX nor SRV lookup If it turns out that smtp_srv_addr() and smtp_host_addr() are almost the same then that code can be factored out into a helper function. I wrote the above before I realized that SRV lookup can return more than one record, and that those records specify a TCP or UDP port. It basically means that SRV returns someothing similar to MX lookup except that it also returns a port to connect to. This means that we'd have to extend the DNS_RR with at least a field for the port. Maybe we can encode priority in one number. BTW I think that your code has a memory leak - it does not free the address returned from SRV lookup. > > Where is the documentation that describes how this works? > > Please point me where I should write it. If we can identify the behavior than I can add that. > >The SRV handler in libpostfix-dns should parse the entire record. > > Ok. What is your preference on how this should be done? Should i > leave it with hostname within the buffer that gets passed to > dns_rr_create function and then handle it inside smtp_addr_one > function or do you have something else in mind? Whoa. SRV specifies a lot of things that your patch is ignoring. - TCP or UDP port - priority and weight - there can be more than one record Is that kosher? Wietse