summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/dns.c
AgeCommit message (Collapse)Author
2011-04-02add stat counters for the lookup agentEric Faurot
ok gilles@
2011-03-31cleanup and simplification following the asr update.Eric Faurot
- use a specific dispatch function for each type of query - make the host handler work on a list of hosts by default (single host queries are just a particular case) and use that to resolve the MX list - various other code cleanup - remove unused headers - remove orphaned prototypes - update copyright ok gilles@
2011-03-29remove unused code now that reverse lookups are done through asr.Eric Faurot
ok gilles@
2011-03-29make use the cname query interface from asr for reverse lookupsEric Faurot
ok gilles@
2011-03-27add a function to factorize resetting of dnssession events.Eric Faurot
ok gilles@
2011-03-26Fix the MX lookup process:Eric Faurot
- the MX records were not always properly inserted into the sorted array, which led to some MX being silently dropped. - if an MX address could not be resolved, mail delivery would fail, even though other valid MX exist for that domain. Now only report the failure if no server address can be found at all. grrrreeat gilles@
2011-03-26Tweak the asr API to make things a bit smoother on the user side.Eric Faurot
Then asr_run() call now returns ASR_COND when a condition on a FD is expected. The exact condition (readable or writeable) is specified in the asr_result structure, along with the fd and timeout. ok gilles@
2011-03-26use an index for iterating into the mx list.Eric Faurot
ok gilles@
2011-03-23Simplify resolver initialization. This is done only onceEric Faurot
since resolv.conf reloading is handled automatically by asr. ok gilles@
2011-03-09make similar code .. more similarTodd T. Fries
ok gilles@ previous commit should have read: when copying 'struct sockaddr' data, use sa_len not sizeof(struct sockaddr_in) this fixes truncation of IPv6 addresses in the mail delivery path ok gilles@
2011-03-09*** empty log message ***Todd T. Fries
2010-12-19If MX lookup fails, fallback to using the host itself. This has always beenGilles Chehade
the behavior but I introduced a regression when switching to ASR. bug reported by jmc@, bugfix tested by jmc@ and I
2010-12-12use memcpy instead of a cast/deref dance that was reading pastJonathan Gray
the end of the buffer. tested by and ok gilles@
2010-11-29replace the fork-based-non-blocking-resolver-hack by shiny async resolverGilles Chehade
written by eric@. it is still experimental but still better than what we had earlier so ... we'll improve in tree :) diff by me with *lots* of help from eric@, tested by todd and I (and a few people out there)
2010-11-28remove unused headersGilles Chehade
2010-11-28a bit of .h cleanups, no functionnal changeGilles Chehade
2010-09-08we do dns resolutions in a separate process because we don't have an asyncGilles Chehade
resolver. if we run scarce on resources and we cannot fork a separate dns process or we cannot socketpair() tell the caller that we have a temporary failure rather than issueing a fatal(). message will stay in queue and be rescheduled later ... bug reported and bugfix tested by Sacha El Masry <lists@devilray.eu>
2010-06-29force the dns buffers to be aligned using a union, until the retardedTheo de Raadt
"misalign strings on the stack" bug in gcc4 is fixed (even when that is fixed this idiom is safer and quite common) ok jacekm
2010-06-02check event_dispatch() return valueCharles Longeau
ok jacekm@
2009-11-14add missing header needed by signal()Charles Longeau
ok gilles@
2009-11-11Fix previous. When configured to relay via IP address, MX lookup would failJacek Masiulaniec
(NXDOMAIN), leading to a bounce. Precede the MX lookup with an attempt to parse the relay as numeric string. "reads ok" gilles@
2009-11-05Consider DNS lookups that result in NXDOMAIN to be a permanent failure.Joel Sing
ok gilles@ jacekm@
2009-11-05Introduce a 6yz status code, used internally to report permanent errors.Joel Sing
The 1yz and 6yz status codes are now removed prior to reporting the status message in bounce messages, which provides an easy way to distinguish between local and remote status messages. Initial diff from jacekm@ ok gilles@ jacekm@
2009-09-03imsg_get sets errno so use fatal instead of fatalx.Jacek Masiulaniec
2009-08-08import some changes from portable smtpd to reduce the delta between both.Gilles Chehade
this commit contains mostly missing casts and cosmethic changes, do not expect to build this anywhere but on OpenBSD, it does not contain any of the portable glue.
2009-06-06Sync with relayd:Pierre-Yves Ritschard
Stop pushing event handling in the imsg framework. Instead, provide a small glue layer on top of both imsg and libevent. This finally clearly separates event handling and imsg construction. Sidetrack bonus: remove the mega-ugly hack of having a dummy imsg_event_add stub in smtpctl. ok jaceckm@
2009-06-05make smtpd's imsg lib ready, just like relayd and ospfd.Pierre-Yves Ritschard
ok gilles@, jacekm@
2009-06-01Fix EV_READ/EV_WRITE testing inside IMSG handlers. Based on similar changeJacek Masiulaniec
to the routing daemons by claudio@; ok gilles@
2009-05-09- New API to handle all DNS query types (A, MX, PTR) asynchronously.Jacek Masiulaniec
- Improve RFC compliance: CNAMEs are resolved, equal preference MXs are randomized, relaying via MX that has equal/lower preference than local server is prevented, decision on when to treat domain name as implicit MX is better. ok gilles@
2009-02-22replace MAX* constants by sizeof where possibleOleg Safiullin
ok jacekm@
2009-02-15If MX query fails due to DNS error, do not attempt more queries; ok gilles@Jacek Masiulaniec
2009-02-15Fix a bug where list of 6 MXs or more was not handled correctly.Jacek Masiulaniec
Pointed out by & ok sthen@, ok gilles@.
2009-01-01remove unnecessary includes; ok gilles@Jacek Masiulaniec
2008-12-05- more err/errx -> fatal/fatalx, warn/warnx -> log_warn/log_warnxGilles Chehade
contains bits based on an old diff from Jacek Masiulaniec and other bits from me.
2008-12-01- in mxsort, fix type of loop counter, it will never be < 0 if it isGilles Chehade
unsigned and when running out of luck it will cause the lookup process to crash.
2008-11-25- move prototype to smtpd.hGilles Chehade
2008-11-10insertion sort is faster than bubble sort. ok gillesTed Unangst
2008-11-05add a few missing id tags; there are a bunch of files, and developersIgor Sobrado
will probably miss this change when working on more important matters, so it is probably better to sort them now. there is a risk of losing the tags if a change needs to be reverted too. written with excellent advice from jmc@ ok gilles@
2008-11-01smtpd is a smtp server implementation for OpenBSD. It is a work in progressGilles Chehade
which still lacks many features. bringing it in tree will help working on it more easily. "at this stage it should go in" henning@, "move ahead" deraadt@