summaryrefslogtreecommitdiffstats
path: root/usr.sbin/smtpd/queue_fsqueue.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Assorted queue improvements:eric2013-07-191-689/+0
| | | | | | | | | - cleanup the internal queue backend API and get rid of the QOP_* thing. - implement a queue_proc backend - rename queue_fsqueue.c to queue_fs - enable support for queue encryption - add an envelope cache - better logging and error reporting
* need to create the incoming directoryeric2013-07-191-2/+6
|
* Get rid of env->sc_pw and env->sc_pwqueue. Early queue initializationeric2013-07-191-4/+4
| | | | | | | now happens in queue_init(), and backends take the queue passwd as parameter in their init function. Remove useless SMTPD_FILTER_USER while there.
* sync with OpenSMTPD 5.3.2eric2013-05-241-29/+33
| | | | ok gilles@
* change log format to fix warninggilles2013-04-021-3/+3
|
* ooops, forgot to lower the define after my very last test: it's 10% not 99%gilles2013-03-311-2/+2
|
* have smtpd temporarily refuse new messages if file system holding the queuegilles2013-03-301-1/+47
| | | | | | | has less than 10% of disk space or inodes left. a warning is logged and the clients will get a temporarily failure asking them to retry later. prompted by deraadt@
* assorted fixes spotted by Coverity.eric2013-01-311-4/+13
| | | | | | some log message updates. ok gilles@
* Sync with our smtpd repo:gilles2013-01-261-109/+193
| | | | | | | | | | | | | | | | | | | | | | * first bricks of ldap and sqlite support (not finished but both working) * new table API to replace map API, all lookups are done through tables * improved handling of temporary errors throughout the daemon * improved scheduler and mta logic: connection reuse, optimizes batches * improved queue: more tolerant to admin errors, new layout, less disk-IO * improved memory usage under high load * SSL certs/keys isolated to lookup process to avoid facing network * VIRTUAL support improved, fully virtual setups possible now * runtime tracing of processes through smtpctl trace * ssl_privsep.c sync-ed with relayd * ssl.c no longer contains smtpd specific interfaces * smtpd-specific ssl bits moved to ssl_smtpd.c * update mail address in copyright FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. smtpd.conf(5) simplified, it will require adaptations ok eric@
* Replace the qwalk API (to retreive on disk envelopes at runtime) witheric2012-11-231-55/+55
| | | | | | | a simple QOP_WALK queue operation. Some knf and formating fixes while there. ok gilles@
* Cleanups and improvements:eric2012-11-121-7/+7
| | | | | | | | | | | | | | | | | | | | * Log more events (especially client session) and use a better scheme for that: each messages is prefixed with a token to easily identify its class: - info/warn/debug: general server messages - smtp-in: smtp client connections - relay: status update for relayed messages - delivery: status update for local deliveries * Implement "smtpctl monitor" to display updates of selected internal counters. * When reloading the on-disk queue at startup do not commit a message if no envelope was submitted for that message. * Remove unused stuff in the config parser. ok gilles@
* switch from {open,read,close}() to {fopen,fread,fclose}() in fsqueue_envelope_load(),chl2012-10-221-8/+7
| | | | | | also fix a potential fd leak. ok gilles@ eric@
* when reloading the envelopes from disk, skip envelopes that areeric2012-08-301-1/+10
| | | | | | | more recent than the startup time, since they are already known to the scheduler. ok gilles@
* sane rewrite of the disk-queue traversal code, and log bogus files founderic2012-08-261-125/+68
| | | | | | in there. fixes issues reported by many. ok gilles@
* Don't pass struct envelope pointer in queue backend API, instead use envelope id andchl2012-08-241-38/+30
| | | | | | an envelope ascii buffer. ok eric@ gilles@
* When creating an envelope, check if the message is incoming oreric2012-08-241-12/+22
| | | | | | | queued to decide the path for the envelope. Remove the need to check the envelope type. ok gilles@ chl@
* coding style: replace all occurences of u_int* with uint*chl2012-08-191-21/+21
| | | | ok eric@
* Kill envelope_{dump,load}_file() and replace them with envelope_{dump,load}_buffer().chl2012-08-191-26/+43
| | | | | | with input from eric@ ok eric@
* cleanup some old debug traceseric2012-08-081-6/+2
| | | | ok gilles@ chl@
* backout the:chl2012-07-101-12/+30
| | | | | | | | | | | | - remove the /envelopes subdirectory, envelopes are at the same level than the message file - kill PATH_ENVELOPES define but keep the: - reduce the number of buckets from 0xfff to 0xff, this avoid performances of the queue to decrease when we start having tons of buckets ok eric@ gilles@
* first step of simplifying fsqueue:gilles2012-07-091-36/+18
| | | | | | | | | | | | | - remove the /envelopes subdirectory, envelopes are at the same level than the message file - kill PATH_ENVELOPES define - reduce the number of buckets from 0xfff to 0xff, this avoid performances of the queue to decrease when we start having tons of buckets this diff introduces a change to the queue layout, you will want to empty your queue before updating. more cleanup to come ok eric@, ok chl@
* remove enum queue_kind from queue_fsqueue.c.chl2012-07-081-115/+71
| | | | | | | | | | incoming messages are now always stored in /incoming, whatever the queue_backend is. remove QOP_FD_RW and fsqueue_message_fd_rw(). while there check return value of generated paths before calling rmtree() with advice from gilles@ and eric@ ok gilles@ eric@
* make backend functions static.eric2012-07-021-17/+15
| | | | ok gilles@
* Finally get rid of the queue_kind enum in the queue API. Keep thateric2012-06-201-84/+52
| | | | | | | | | internally in fsqueue backend for now, and let the fsqueue_message() and fsqueue_envelope() dispatchers do the right thing. Based on a diff by chl@ ok chl@ gilles@
* on envelope creation, setup and reset the relevant envelope fields ineric2012-06-011-10/+2
| | | | | | the wrapper function rather than in individual backends. ok gilles@
* move envelope dump/load functions to envelope.ceric2012-06-011-176/+3
| | | | ok gilles@
* various reliability fixes:gilles2012-03-071-7/+2
| | | | | | | | | - prevent queue_fsqueue from fatal() when it hits an ENOENT, it can happen - change a bit the scheduler API to simplify it, fix runner accordingly - we can't remove msg/batch from ramqueue while envelope is offloaded or it will cause a double, instead we add refcnt to both msg/batch and only free them when it hits 0
* fix an issue observed this week-end while flooding ajacoutot@ :gilles2012-01-311-1/+3
| | | | | | | | | | | | | | we keep track of available fd's to prevent scheduling of messages if we know that we are going to fail. however, since the envelope is not removed from the scheduler, it will be rescheduled right away leading to a busy loop in the scheduler. we know flag the mda/mta processes as BUSY and do not schedule envelopes that target a BUSY process. also, fix a potential bug that could lead to a use after free when doing a batch/message/host traversal of schedulable envelopes. while at it fix misuse of env->sc_opts as env->sc_flags, was not really causing any issue as the misuse was constant ...
* Remove message directories right away instead of moving them to purge/.eric2012-01-291-3/+3
| | | | | | Prevent hitting dir entry limits when dealing with lots of mails. ok gilles@
* Quick fix to prevent two processes from using the same temporaryeric2012-01-291-5/+13
| | | | | | envelope file at the same time. ok gilles@
* Add a parameter to the queue backend init() call to specify wether theeric2012-01-241-5/+6
| | | | | | | | call is issued by smtpd or smtpctl. In the latter case, only perform sanity checks and do not touch directories. A running server no longer lose its "incoming/" directory each time smtpctl is called... ok gilles@
* When moving a message to the corrupt/ directory, give it an alternate nameeric2012-01-141-1/+11
| | | | | | if there is already an entry with the same name. ok gilles@ chl@
* Change fsqueue_*_path() to report success or failure instead oferic2012-01-141-23/+15
| | | | | | | | fatal(). Make sure at init time that all paths can contain envelopes, then these calls will never fail (provided that buffers are always correctly sized, which is true internally). ok gilles@ chl@
* When creating a new message (in incoming/) make sure that the msgid does noteric2012-01-141-2/+8
| | | | | | already exist in queue/ to prevent possible collision on commit. ok gilles@
* Add a fsqueue_message_path() function to build path to message direric2012-01-141-54/+41
| | | | | | and use it where appropriate. ok gilles@ chl@
* use a simpler way to get to the parent directoryeric2012-01-131-5/+2
| | | | ok gilles@
* queue_message_purge() and queue_message_delete() are actually the sameeric2012-01-131-68/+8
| | | | | | | | thing. Remove queue_message_purge() in favor of queue_message_delete and simplify fsqueue_message_delete() implementation to move the message dir to purge/ ok gilles@
* Add a fsqueue_envelope_dump_atomic() function that writes an envelopeeric2012-01-121-80/+44
| | | | | | | | | | | | to incoming/envelope.tmp before moving it to its final destination. This allows to make sure that envelopes created directly in the queue (such as bounces) can't let the queue in an inconsistent state if the program stops in the middle of an envelope dump. This also allow to simplify qwalk, since we don't put any temporary contents anywhere in "walkable" queue dirs. ok gilles@
* implement an envelope_ascii API that's not tied to a specific queue_backendgilles2012-01-111-1/+175
| | | | simplify queue_fsqueue
* Simplify runner/queue by getting rid of Q_PURGE. Instead, let smtpderic2012-01-111-20/+7
| | | | | | | | periodically clear the purge/ directory. At init time, the fsqueue backend simply moves the existing incoming/ dir in purge/ to discard aborted sessions. ok gilles@ chl@
* Q_BOUNCE is not used anymoreeric2011-12-271-33/+3
| | | | ok gilles@
* On envelope creation, get the message id in a saner way than theeric2011-12-231-2/+2
| | | | | | current confusing hack. ok gilles@
* Add fqueue_envelope_path() function to create path to envelopes.eric2011-12-221-25/+30
| | | | ok chl@ gilles@
* make queue_fsqueue backend consistent with the backend scheme.eric2011-12-141-1/+10
| | | | ok gilles@
* get rid of the "enqueue/" queue; use "incoming/" instead.eric2011-11-211-8/+4
| | | | ok gilles@ chl@
* wooooops defines missing from previous commitgilles2011-11-151-2/+12
|
* Qwalk, our API to linearly walk over the persistent queue, did not take thegilles2011-11-151-24/+250
| | | | | | | | | | | | | | | | | | | | | | queue_backend into account and assumed a filesystem with a specific layout. This commit does plenty of things: - make qwalk an abstraction in the queue_backend API, and impose queue drivers to implement qwalk_open(), qwalk() and qwalk_close(); - move previous qwalk_open(), qwalk() and qwalk_close() to the fsqueue driver since they were fsqueue specific ... - make qwalk API work with msgid/evpid instead of pathnames since we're going to use the queue_backend API to load envelopes by evpid anyway; - makes smtpd use *solely* the queue_backend API when manipulating the queue. pathnames were removed from smtpd.h and moved into the fsqueue which means we can now store a queue anywhere ... as long as we write the ten functions or so required for a queue driver ;-) ok eric@, ok chl@
* The spool and offline directories are backend-independent, so theyeric2011-11-141-116/+7
| | | | | | must be created early by smtpd, rather than in fsqueue. ok gilles@ chl@
* No need to save/restore the batch_id since the envelope is not dumpederic2011-11-061-7/+1
| | | | | | as a structure anymore. ok chl@ gilles@
* Use PRI{x,d}64 in format strings instead of %llx, %lld or %qd to print {u_,}int64_t or time_tchl2011-10-271-5/+6
| | | | | | | | While there, cast some time_t to int64_t These will fix build warnings for portable smptd ok gilles@ eric@