summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/queue.c
AgeCommit message (Collapse)Author
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-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-24Instead of keeping stats private to each process, and querying everyJacek Masiulaniec
process individually whenever stats need to be fetched, keep stats in MAP_ANON shared memory allocated by parent. This means control has direct access to stats and can respond very quickly without troubling any other daemon processes. 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-04-21correct some fatal(x) calls and error stringsEric Faurot
ok gilles@ jacekm@
2009-04-18remove dead code; made possible by previous commit.Jacek Masiulaniec
2009-04-16Total rewrite of the sendmail interface. Adds support for -t, -v,Jacek Masiulaniec
and -F cmdline args. Also, date and Message-Id headers are added when missing. The main trouble with the current enqueue code is that it requires dealing with problems in the control process that are already solved in the smtp process, ie. duplicating a lot of code which interacts with untrusted clients. This diff solves this by making sendmail obtain a SMTP socket from smtp via smtpd.sock, and using that socket to deliver the message. For smtpd it looks as if connection was made from the network, only difference being the F_MESSAGE_ENQUEUED message flag, handy when differentation between local and remote deliveries is wanted. Most of the features come from the femail program, created by henning@. Additional testing by Nigel J. Taylor. ok gilles@, henning@ happy with smtpd using femail code
2009-03-29turn some log_debugs into log_warns or even fatals; "looks ok" gilles@Jacek Masiulaniec
2009-03-01In "smtpctl show stats", break queue.inserts into queue.inserts.remoteJacek Masiulaniec
and queue.inserts.local; ok gilles@
2009-02-22add missing headersCharles Longeau
ok gilles@
2009-02-20purge /enqueue at startup; ok gilles@Jacek Masiulaniec
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-29Implement "smtpctl show stats"; ok gilles@Jacek Masiulaniec
2009-01-29Common queue walking code for smtpd and smtpctl. Kills majority of showqueue.c,Jacek Masiulaniec
the remaining code was moved to queue_shared.c; ok gilles@
2009-01-28Make races between queue and runner impossible by implementing the policy:Jacek Masiulaniec
1) queue never reads /queue. 2) queue writes to /queue only at message injection time. 3) runner does all reading, and all writing apart from 2). ok gilles@
2009-01-28move some functions from queue.c to queue_shared.c as they are not onlyGilles Chehade
used by queue process but also by runner, while at it change the prototype of queue_open_message_file() so it takes the message id and not a batch, runner process requires the decriptor before it even starts building a batch.
2009-01-28add a struct path to struct message so that we can keep track of the RCPTGilles Chehade
provided recipient even after aliases/forwards expansion, we'll need this for loop detection. message id and uid being MAXPATHLEN long is a waste, define MAX_ID_SIZE which is currently set to 64 (but can probably be further reduced) and make sure that structures and the few strlcpy's use the right define. original idea by jacekm@ a while ago
2009-01-27first bricks of enqueue code which allows smtpctl to submit mail to queueGilles Chehade
without "talking" smtp to listeners. currently, a big part of the server side code is done (and requires a cleanup), next step is to get it usable properly from a mail user agent.
2009-01-26move some queue related functions that are needed outside of smtpd to theGilles Chehade
sharedqueue.c file, smtpctl cannot link queue.o without creating a mess otherwise. while at it, move some prototypes to smtpd.h as they will be needed by enqueue code
2009-01-26we had a set of functions to deal specifically with incoming messages andGilles Chehade
we need the same functions for the enqueue code i'm currently working on. instead of duplicating the code, add a set of functions which take the queue we're working on as a parameter and turn the old ones into wrappers. no functionnal change ... yet discussed with jacekm@
2009-01-12more checks in queue_record_incoming_envelope; ok gilles@Jacek Masiulaniec
2009-01-06make file update in queue_update_envelope atomic; ok gilles@Jacek Masiulaniec
2009-01-04aliases/forwards expansion was not done correctly and a race couldGilles Chehade
cause delivery to happen before expansion is over, causing some of the recipients to never receive the mail. change how the mfa, lka, queue and smtp processes communicate to ensure smtp never receives an acknowledgment before ALL expanded envelopes are on disk. While at it, lka was doing work which belongs in mfa, fix that also. this is based on an idea from a talk with jacekm@, change not over but already better than what we had.
2009-01-02fix T_DAEMON_MESSAGE notices delivery; ok gilles@Jacek Masiulaniec
2009-01-02cleanup queue_load_envelope; ok gilles@Jacek Masiulaniec
2009-01-01remove unnecessary includes; ok gilles@Jacek Masiulaniec
2008-12-31if mkdir/mkdtemp fails, fatal if errno != ENOSPC; ok gilles@Jacek Masiulaniec
2008-12-31rename may fail due to ENOSPC, make smtpd survive this condition; ok gilles@Jacek Masiulaniec
2008-12-31kill unnecessary function; ok gilles@Jacek Masiulaniec
2008-12-29Handle ENOSPC in queue_update_envelope; cleanup the code a bit; ok gilles@Jacek Masiulaniec
2008-12-27kill unused function; ok gilles@Jacek Masiulaniec
2008-12-27cleanup; ok gilles@Jacek Masiulaniec
2008-12-27Put common handler code in a function; ok chl@ gilles@Jacek Masiulaniec
2008-12-27Merge hash() and queue_message_hash() into one func, queue_hash(). Fix callersJacek Masiulaniec
to use this interface consistently; ok chl@ gilles@
2008-12-18Cleanup /incoming before handling each MAIL FROM.Jacek Masiulaniec
Improve cleanup condition to cover more cases. ok gilles@
2008-12-17Introduce /purge, where all msgs scheduled for deletion are put byJacek Masiulaniec
queue, and removed from disk by runner. On startup, clean /incoming by moving msgs within it to /purge. ok gilles@
2008-12-14Files under /incoming don't need flock(2)ing anymore.Jacek Masiulaniec
ok gilles@
2008-12-14O_TRUNC is redundant if O_EXCL is specified.Jacek Masiulaniec
ok gilles@
2008-12-14O_TRUNC is redundant if O_EXCL is specified.Jacek Masiulaniec
ok gilles@
2008-12-14queue_create_incoming_layout must return 0 on failure, not -1.Jacek Masiulaniec
ok gilles@
2008-12-13IMSG_* namespace cleanup.Jacek Masiulaniec
ok gilles@
2008-12-11- last snprintf -> bsnprintfGilles Chehade
2008-12-11- snprintf -> bsnprintfGilles Chehade
2008-12-07Simplify queue_record_incoming_envelope.Jacek Masiulaniec
ok gilles@
2008-12-06Make queue_delete_incoming_message not fatal on ENOENT condition.Jacek Masiulaniec
Also, fix function name in fatals. ok gilles@
2008-12-06Don't include <err.h> where log.c API must be used.Jacek Masiulaniec
ok gilles@
2008-12-05- last part of the new queue code: the runner process (unprivileged andGilles Chehade
chrooted) is now in charge of doing the scheduling of deliveries, and the dispatching of messages to MDA and MTA. queue process only does inserts/updates/removals from the queue and can no longer be so busy that it delays answers to imsg from smtp server.