summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/queue_backend.c
AgeCommit message (Collapse)Author
2016-02-04When deleting a message, remove associated envelopes from the cache,Eric Faurot
if any (it happens when a message transaction is cancelled). ok gilles@ sunil@
2015-12-28remove spaces after '!'Joerg Jung
no binary change ok millert
2015-12-14remove trailing whitespaceJoerg Jung
ok sunil gilles
2015-11-05Implement smtpctl uncorrupt <msgid>Sunil Nimmagadda
"uncorrupt" moves envelopes from corrupt bucket back to the queue for further discovery by the daemon. After correcting the corrupt envelopes, admin could now... # smtpctl uncorrupt msgid # smtpctl discover msgid to schedule the messages. Ok gilles@
2015-11-05Do not terminate message walk on a corrupt envelope.Sunil Nimmagadda
Ok gilles@
2015-10-29Implement smtpctl discover <evpid|msgid>.Sunil Nimmagadda
discover subcommand schedules envelopes manually moved to the queue. It triggers a queue walk searching for envelopes with the given id, schedules them and informs the user number of envelopes scheduled. Admins no longer would need to restart the daemon to discover manually moved messages. Ok gilles@
2015-10-09turn our local enqueuer setgid _smtpq and restrict access to offline queue,Gilles Chehade
the enqueuer will revoke group and regain real gid right after mkstemp. this would have prevented the symlink/hardlink attacks against offline, and it will avoid having to deal with new ways users can mess with it. ok eric@, ok millert@
2015-01-20use <limits.h> comprehensively. For now try to push <> includes toTheo de Raadt
each .c file, and out of the .h files. To avoid overinclude. ok gilles, in principle. If this has been done right, -portable should become easier to maintain.
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-08no need for arc4random_uniform() here, arc4random() does the jobGilles Chehade
spotted by deraadt@, ok eric@
2014-07-08various queue improvements:Eric Faurot
- add a "close" hook to the backend API. - improve the sync() pattern in queue_fs: only sync at commit time and not for every envelope creation - various fixes to the experimental external queue API.
2014-07-07Allow to enable profiling at runtime and fix timings output.Eric Faurot
ok gilles@
2014-04-11fix a use after free in an error pathJonathan Gray
ok gilles@
2014-03-14print the correct user name if SMTPD_QUEUE_USER is missingAlexander Hall
ok tedu@
2014-03-13When failing to find the required privsep user entry, it is not cool atTheo de Raadt
all to fall back to a different user entry. It is decidedly unsafe. ok tedu.
2013-10-26%i -> %d in format stringsEric Faurot
2013-07-19Assorted queue improvements:Eric Faurot
- 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
2013-07-19Get rid of env->sc_pw and env->sc_pwqueue. Early queue initializationEric Faurot
now happens in queue_init(), and backends take the queue passwd as parameter in their init function. Remove useless SMTPD_FILTER_USER while there.
2013-05-24sync with OpenSMTPD 5.3.2Eric Faurot
ok gilles@
2013-04-17large time_t problemsTheo de Raadt
ok gilles
2013-01-26Sync with our smtpd repo:Gilles Chehade
* 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@
2012-11-23Replace the qwalk API (to retreive on disk envelopes at runtime) withEric Faurot
a simple QOP_WALK queue operation. Some knf and formating fixes while there. ok gilles@
2012-11-12Cleanups and improvements:Eric Faurot
* 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@
2012-10-09fix a FILE* leak when using compression.Eric Faurot
ok gilles@
2012-09-01- remove crypto_backendGilles Chehade
- remove support for encrypted queue, it will be reintroduced later after pouring more thinking into it if you had it enabled, flush your queue before updating
2012-08-30switch compress_backend to use FILE * instead of file descriptors, likeCharles Longeau
crypto_backend ok gilles@
2012-08-30fix uninitialized variable which can be reach in case of failure.Charles Longeau
ok gilles@
2012-08-29Introduce the crypto_backend API and provide support for... encrypted queueGilles Chehade
using the new API. By default, OpenSMTPD does not provide queue encryption, but it can be enabled with "queue encryption [args]" and will transparently encrypt/decrypt envelopes/messages as they hit the queue. By default, it will use Blowfish in CBC mode with a different random IV for each envelope and message. User provided key is expanded using sha256 but a different cipher and digest may be specified in smtpd.conf Queue encryption is compatible with compression and if both options are set it will do them in correct order and transparently. tested by chl@, a few users and myself ok chl@ and I
2012-08-26- remove unused variableGilles Chehade
- comment variables unused at this time
2012-08-25Add compress_backend, allowing compression of messages and envelopes in the ↵Charles Longeau
queue. To use it, just add "queue compress" in smtpd.conf. For now, only zlib is used. lots of feedback from eric@ and gilles@ ok eric@ gilles@
2012-08-24envelope_validate() don't take the evpid anymore.Eric Faurot
2012-08-24In envelope ascii dump/load:Charles Longeau
- remove loading of evpid. - don't dump the msgid - ignore msgid at load - remove now unused functions ascii_{dump,load}_uint{32,64}_hex() With inputs from eric@ and gilles@ ok gilles@ eric@
2012-08-24Don't pass struct envelope pointer in queue backend API, instead use ↵Charles Longeau
envelope id and an envelope ascii buffer. ok eric@ gilles@
2012-08-19coding style: replace all occurences of u_int* with uint*Charles Longeau
ok eric@
2012-07-10backout the:Charles Longeau
- 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@
2012-07-09first step of simplifying fsqueue:Gilles Chehade
- 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@
2012-07-08remove enum queue_kind from queue_fsqueue.c.Charles Longeau
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@
2012-07-02Lookup queue and scheduler backends by name, rather than enum.Eric Faurot
Add a command-line option to specify the backend to use at runtime. ok gilles@
2012-06-20Finally get rid of the queue_kind enum in the queue API. Keep thatEric Faurot
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@
2012-06-08add missing header needed by time()Charles Longeau
ok eric@ gilles@
2012-06-03Do not store the envelope id within the envelope, only the message id.Eric Faurot
Make sure existing envelopes can be properly loaded. ok chl@ gilles@
2012-06-01on envelope creation, setup and reset the relevant envelope fields inEric Faurot
the wrapper function rather than in individual backends. ok gilles@
2012-01-14Add missing header needed by PRI format stringCharles Longeau
ok gilles@ eric@
2012-01-13queue_message_purge() and queue_message_delete() are actually the sameEric Faurot
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@
2011-12-23On envelope creation, get the message id in a saner way than theEric Faurot
current confusing hack. ok gilles@
2011-12-19fix/improve envelope_validate():Eric Faurot
- return an informative error string if the envelope is invalid. - take the envelope id as a parameter and make sure it matches. - do not expect the errorline to start with an SMTP response code, as this is not always the case: a temporary failure with mda would cause the envelope to be marked as corrupted. Instead, just make sure that all string fields are actual strings to prevent overflows later. ok gilles@ chl@
2011-12-16simplifyEric Faurot
ok chl@ gilles@
2011-12-14make queue_fsqueue backend consistent with the backend scheme.Eric Faurot
ok gilles@
2011-11-15Qwalk, our API to linearly walk over the persistent queue, did not take theGilles Chehade
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@
2011-10-23introduce Q_CORRUPT and queue_backend operation to move a message fromGilles Chehade
schedule queue to corrupt queue upon envelope loading failure. tested by me, ok eric@