summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/mta.c
AgeCommit message (Collapse)Author
2009-08-26fix previousJacek Masiulaniec
2009-08-26Do not add Delivered-To to outgoing mail. It will result in prematureJacek Masiulaniec
bounce as soon as it hits mx2 in mx1 -> mx2 -> mx3 relay chain. hint by sthen@, ok gilles@
2009-08-08- simplify a bit queue_message_update()Gilles Chehade
- make sure queue_message_update() creates bounces using bounce_record() - when mta sends update to queue and it sees that batch is flagged with F_BATCH_PERMFAIL, only update the envelope error message if it doesn't have F_MESSAGE_PERMFAIL set, otherwise we may lose the real reason why we failed for that recipient. There's cleanup to do around that old code, i'm sure we can get it simpler. this commit fixes a bug pea@ spotted where a bounce message would not display the reason of a failure when we generated it after failing to deliver a relayed message.
2009-08-07in mta: ssl/ssl.h -> openssl/ssl.h, consistent with other filesGilles Chehade
2009-08-06fix a crash in mta when forwarding a bounce, caused by a null derefGilles Chehade
2009-08-06replace X-OpenSMPTD-Loop with Delivered-ToGilles Chehade
idea by jacekm@ a few weeks ago, discussed with pyr
2009-08-06- introduce message_set_errormsg() to set the error description that willGilles Chehade
appear in a bounce message, and message_get_errormsg() to retrieve that message. - when loop is detected, call message_set_errormsg() - in mta, call message_set_errormsg() for each recipient failure - in mta, call message_set_errormsg() to copy batch errors to recipients if we failed to deliver for a session related error - when bouncing, add the recipient and error reason to the bounce message
2009-08-06This commit reworks the entire mailer daemon support to actually make itGilles Chehade
work for real. As an added bonus, it simplifies it, makes it follow the same code path as regular messages and kills quite some code from mta, mda and store. There's still some work needed but the most painful part is behind us now ;) ok jacekm@
2009-06-20Allocate memory for env->sc_ssl like in smtp; ok gilles@Jacek Masiulaniec
From: Josh Elsasser <josh@elsasser.org>
2009-06-07Change the way fds passed over a socket are retreived on the receiving side.Eric Faurot
Currently the receiver fetches an imsg via imsg_get() and if he expects an fd, he then calls imsg_get_fd() to fetch the next fd queued on the imsgbuf from which the imsg came. This changes hides the fd queueing mechanism to the API user. When closing an imsg with an fd, the message is flagged so that the receiving end knows it must dequeue the fd in imsg_get() and return it with the imsg structure. This way there is no (less) possible screw up from imsg_get_fd() not being called directly after imsg_get() by the user. The retreived imsg is self-contained. ok pyr@, "I like that" henning@
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-03simplify struct batch; ok gilles@Jacek Masiulaniec
2009-06-02make env->sc_listeners and env->sc_ssl pointers, one step further towardGilles Chehade
configuration reloading without killing active sessions; ok 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-31when entering mta_connect() reset session fd to -1Gilles Chehade
when connect timesout and we close the fd, reset session fd to -1 in session_destroy(), only attempt to close session fd if != -1 fixes a fatal in session_destroy() which happened because we closed a fd after a timeout, but the session still assumed the fd to be opened.
2009-05-30It is now possible to specify a certificate to use when relaying to anotherGilles Chehade
host which requests client certificates: accept [...] relay via [...] ssl certificate "mycert" diff from Josh Elsasser <josh@elsasser.org>, tested and okayed by me with no change but the addition of status 554 to the state machine to deal with remote host telling us it doesn't like our certificate.
2009-05-30increment mta.sessions in when we allocate a new session in mtaGilles Chehade
2009-05-30- increment stats.mta.sessions_active when session is allocated in mtaGilles Chehade
- reorder alphabetically and add mta to the statistics
2009-05-27Insert Received: at receive time instead of delivery time; ok gilles@Jacek Masiulaniec
2009-05-24Parent process forks 3 types of processes, track them all in a single treeJacek Masiulaniec
using newly introduced child struct. Manage process titles centrally in struct smtpd. ok gilles@
2009-05-19Verify the amount of IMSG payload is exactly as expected; ok gilles@Jacek Masiulaniec
2009-05-14use the nitems() macro where appropriateEric Faurot
ok gilles@, jacekm@
2009-05-13do MX lookups in both "relay" and "relay via" case; ok gilles@Jacek Masiulaniec
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-04-28in mta, change the batch status to S_BATCH_TEMPFAILURE by default so thatGilles Chehade
we need to explicitely set success and permanent failures, this way if we hit any condition that we don't explicitely flag as permanent failure the delivery will be rescheduled later. while at it, made various checks more strict to prevent hiding bugs and a bit of knr cleanups discussed with and "reads good" jacekm@
2009-04-28let mta, mda, and mfa become idle - no functional change; ok gilles@Jacek Masiulaniec
2009-04-21correct some fatal(x) calls and error stringsEric Faurot
ok gilles@ jacekm@
2009-04-15fix a bug where after all MX-es were found to be non-contactable,Jacek Masiulaniec
smtpd would treat the delivery as successful; ok gilles@
2009-04-09change syntax of the "listen on" and "relay via" directives:Jacek Masiulaniec
1) kill the ssmtp keyword in "ssmtp listen on ..."; 2) kill the use keyword in "... use certificate foo"; 3) tls no longer implicit, user must explicitely use the tls or smtps option. 4) for "relay via", move the tls/smtps options to right after the port specification; makes it similar to "listen on". These directives: ssmtp listen on fxp0 use ceritifate "foo" accept for all relay via tls "mx.bar.com" now become: listen on fxp0 smtps certificate "foo" accept for all relay via "mx.bar.com" tls ok gilles@
2009-03-29turn some log_debugs into log_warns or even fatals; "looks ok" gilles@Jacek Masiulaniec
2009-03-19in the event of a timeout, mxhost is passed to TAILQ_REMOVE before it isGilles Chehade
initialized. spotted and diff by Matthew Haub <matthew.haub@alumni.adelaide.edu.au>
2009-03-18remove debug X-Cipher and turn it into a useful log_info()Gilles Chehade
2009-03-18in mta, when remote host advertises AUTH, do not attempt to authenticateGilles Chehade
unless we do have F_AUTH set on the mxhost (which means we explicitely mentionned authentication in config) and we did find credentials in the secrets map. issue and initial diff from Rivo Nurges <rix@estpak.ee>
2009-03-15the mda process no longer uses struct batch as its central structure toGilles Chehade
deal with deliveries, it now uses struct session just like mta and smtp processes. we now keep the mbox and message descriptors in the session, saving space in struct message which is now as small as we can make it. While at it, plugged a memory leak and did some cosmethic changes This was the last planned change to our struct message which means that later changes will no longer require a queue flush before rebuild.
2009-03-12Add new function time_to_text to correctly display the date.pea
Use it to display the date in received from header and when we store headers. ok jacekm@
2009-03-10implement basic logging, needs more work; ok gilles@Jacek Masiulaniec
2009-03-09add basic support for outgoing authentication (AUTH PLAIN over ssl) whichGilles Chehade
can be turned on by adding "enable auth" to a "relay via" rule. this made me rework the mx resolution so that it is done by the mta process and not the runner process anymore.
2009-02-22add missing headersCharles Longeau
ok gilles@
2009-02-22put repeated inet_ntop calls into new func ss_to_text, which usesJacek Masiulaniec
getnameinfo internally; ok gilles@
2009-02-22replace MAX* constants by sizeof where possibleOleg Safiullin
ok jacekm@
2009-02-20Fix "Received: from" headerspea
ok gilles@
2009-02-15New config.c that allows for process cloning. Done by pyr@ forJacek Masiulaniec
relayd at n2k9, and adapted to smtpd; ok gilles@
2009-01-29missing prototype for session_respond() in mta, move session_respond()'sGilles Chehade
prototype to smtpd.h spotted and diff from Oleg Safiullin <form@pdp-11.org.ru>
2009-01-29Received header line was incomplete for mail submitted through the enqueuerGilles Chehade
as well as for some outgoing messages, this is fixed now
2009-01-29fix a bug in mta's event maskingGilles Chehade
2009-01-29initial starttls support in mta, this allows:Gilles Chehade
accept for domain "openbsd.org" relay via tls "mx.example.org" to ensure the relaying of mail for whoever@openbsd.org will happen through a secure tls (STARTTLS) session. failure to establish a tls session will be considered as a permanent failure. As a side effect: accept for domain "openbsd.org" relay via ssl "mx.example.org" can now work as well and ensure that the relaying happens through ssmtp OR tls, but never through an unsafe channel. no need to specify a port, they are automatically detected if not specified. still a work in progress, don't expect that it will work flawlessly.
2009-01-29bring initial support for SSL in the mta part of smtpd, allowing for:Gilles Chehade
accept for domain "openbsd.org" relay via ssmtp "mx1.example.org" to ensure that deliveries for whatever@openbsd.org goes through an SSL session to mx1.example.org
2009-01-28fix missing prototype and format related warningsGilles Chehade
2009-01-28now that mta uses a struct session, it can also use session_respond() justGilles Chehade
as smtp_session.c does, so move all of the evbuffer_add_printf() calls out of the way and replace them with session_respond() call.