OpenBSD CVS

CVS log for src/usr.sbin/smtpd/bounce.c


[BACK] Up to [local] / src / usr.sbin / smtpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.90 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.89: +2 -1 lines
Diff to previous 1.89 (colored)

add missing include of time.h

spotted after a report on OpenSMTPD-portable.  While here include
sys/time.h in smtpd.h, as noted in event_init(3), since it includes
event.h.

ok millert@

Revision 1.89 / (download) - annotate - [select for diffs], Mon May 15 12:03:04 2023 UTC (12 months, 2 weeks ago) by op
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

cast to '(long long)' instead of '(long long int)'

while here adjust the spacing in some of the touched lines.
requested by deraadt@, ok tb@

Revision 1.88 / (download) - annotate - [select for diffs], Thu May 4 12:43:44 2023 UTC (12 months, 4 weeks ago) by chrisz
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

Be more economical with returning bodys in bounce messages
according to rfc3461 4.3

OK millert@

Revision 1.87 / (download) - annotate - [select for diffs], Wed Feb 8 08:20:54 2023 UTC (15 months, 3 weeks ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 (colored)

usr.sbin: missing void to appease clang 15's -Wstrict-prototype.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Jul 28 19:39:50 2021 UTC (2 years, 10 months ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.85: +5 -3 lines
Diff to previous 1.85 (colored)

add format attribute to vaararg functions.
millert@ thinks its useful.

Revision 1.85 / (download) - annotate - [select for diffs], Mon Jun 14 17:58:15 2021 UTC (2 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.84: +1 -13 lines
Diff to previous 1.84 (colored)

add required headers for smtpd.h and remove unnecessary ones in other files.

ok jung@

Revision 1.84 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.83: +2 -3 lines
Diff to previous 1.83 (colored)

replaces calls to err(3)/errx(3) with fatal()/fatalx() from log.c
for code that runs in the daemon.

ok florian@ millert@

Revision 1.83 / (download) - annotate - [select for diffs], Thu Dec 31 08:27:15 2020 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

Rename the pony process to dispatcher and klondike to crypto.

From gilles@
OK millert@ giovanni@

Revision 1.82 / (download) - annotate - [select for diffs], Fri Apr 24 11:34:07 2020 UTC (4 years, 1 month ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.81: +5 -1 lines
Diff to previous 1.81 (colored)

strip trailing CRs at smtp level rather than io level

ok millert@

Revision 1.81 / (download) - annotate - [select for diffs], Mon Nov 25 12:11:26 2019 UTC (4 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.80: +50 -50 lines
Diff to previous 1.80 (colored)

use crlf line-ending during the internal smtp session

ok gilles@ martijn@

Revision 1.80 / (download) - annotate - [select for diffs], Sat Dec 8 08:01:15 2018 UTC (5 years, 5 months ago) by sunil
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.79: +14 -14 lines
Diff to previous 1.79 (colored)

Use correct RFC 3464 specified values for Action field in a DSN.
error -> failed
success -> delivered

This fixes DSN parsing for Mailman. Issue reported by Cristiano
Costa on misc@opensmtpd.org.

While here, rename enums to reflect the intent and properly handle
envelope ascii load/dump to understand change in the values.

Suggestions and ok gilles@

Revision 1.79 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.78: +8 -8 lines
Diff to previous 1.78 (colored)

remove 'where' parameter from all x*() functions in utils.c, it doesn't
really help us with anything, propagate the change in codebase

ok millert@

Revision 1.78 / (download) - annotate - [select for diffs], Thu May 24 11:38:24 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

switch smtpd to new grammar

ok eric@

Revision 1.77 / (download) - annotate - [select for diffs], Wed Nov 30 11:52:48 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.76: +32 -35 lines
Diff to previous 1.76 (colored)

make struct io opaque:

- move struct io definition to ioev.c
- replace io_init/io_clear with io_new/io_free
- allocate an iobuf for each new io internally
- use struct io pointer in the rest of the code
- remove remaining uses of iobuf_*

ok gilles@ sunil@

Revision 1.76 / (download) - annotate - [select for diffs], Tue Nov 22 07:28:42 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.75: +2 -4 lines
Diff to previous 1.75 (colored)

Normalize the io input buffer internally when reinstalling the io event, so
the caller doesn't have to bother with this.

ok gilles@ sunil@

Revision 1.75 / (download) - annotate - [select for diffs], Mon Nov 21 13:00:43 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.74: +25 -32 lines
Diff to previous 1.74 (colored)

replace calls to iobuf_*() functions with the corresponding io_*() wrappers.

ok sunil@ gilles@

Revision 1.74 / (download) - annotate - [select for diffs], Sun Nov 20 08:43:36 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.73: +4 -2 lines
Diff to previous 1.73 (colored)

add dedicated functions to set fd and callback on a struct io.
simplify io_init() prototype.

ok sunil@ gilles@

Revision 1.73 / (download) - annotate - [select for diffs], Wed Nov 16 21:30:37 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.72: +4 -4 lines
Diff to previous 1.72 (colored)

pass the user pointer as parameter to the io callback instead of having
the user dereference the io structure.

ok millert@ gilles@

Revision 1.72 / (download) - annotate - [select for diffs], Wed Feb 3 05:57:09 2016 UTC (8 years, 4 months ago) by sunil
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.71: +9 -5 lines
Diff to previous 1.71 (colored)

Use "esc_class" to classify bounce type instead of "errorline" as
we no longer prepend status code to "errorline". Fixes mismatch
between DSN's subject line and its content.

Ok jung@ gilles@ millert@

Revision 1.71 / (download) - annotate - [select for diffs], Thu Dec 24 16:54:37 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

more e-mail -> email

Revision 1.70 / (download) - annotate - [select for diffs], Mon Dec 14 10:31:25 2015 UTC (8 years, 5 months ago) by sunil
Branch: MAIN
Changes since 1.69: +13 -13 lines
Diff to previous 1.69 (colored)

Fix bad indents and whitespaces.

Ok jung@ gilles@

Revision 1.69 / (download) - annotate - [select for diffs], Mon Dec 14 10:22:11 2015 UTC (8 years, 5 months ago) by jung
Branch: MAIN
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (colored)

remove trailing whitespace

ok sunil gilles

Revision 1.68 / (download) - annotate - [select for diffs], Mon Nov 23 06:54:21 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.67: +92 -16 lines
Diff to previous 1.67 (colored)

Restructure bounce content as a multi-part MIME message.
Content-Type header diff from Philipp Takacs <philipp<at>bureaucracy.de>

Ok gilles@ jung@

Revision 1.67 / (download) - annotate - [select for diffs], Wed Oct 7 19:25:42 2015 UTC (8 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.66: +7 -5 lines
Diff to previous 1.66 (colored)

Use getline(3) rather than fgetln(3).  OK gilles@

Revision 1.66 / (download) - annotate - [select for diffs], Tue Jan 20 17:37:54 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.65: +5 -4 lines
Diff to previous 1.65 (colored)

use <limits.h> comprehensively.  For now try to push <> includes to
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.

Revision 1.65 / (download) - annotate - [select for diffs], Wed May 28 10:34:16 2014 UTC (10 years ago) by daniel
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

remove an errant semicolon.

ok gilles@

Revision 1.64 / (download) - annotate - [select for diffs], Sat Apr 19 17:27:40 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.63: +10 -9 lines
Diff to previous 1.63 (colored)

(void) cast snprintf() calls that cannot truncate

Revision 1.63 / (download) - annotate - [select for diffs], Fri Apr 4 16:10:41 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.62: +11 -11 lines
Diff to previous 1.62 (colored)

Merge the mda, mta and smtp processes into a single unprivileged
process managing message reception, delivery and transfer.  Mostly
mechanical, but very intrusive as it required to rewamp all IMSG to
fix ambiguities.

with and ok gilles@

Revision 1.62 / (download) - annotate - [select for diffs], Tue Feb 4 15:44:05 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.61: +47 -4 lines
Diff to previous 1.61 (colored)

Add support for DSN and Enhanced Status Code

Revision 1.61 / (download) - annotate - [select for diffs], Tue Feb 4 14:56:03 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.60: +1 -2 lines
Diff to previous 1.60 (colored)

internal improvements and cleanups

- get rid of the whole penalty thing for failed envelopes in the mta and scheduler.
- do not disable routes on smtp errors
- try to schedule all types of envelopes on each scheduler frame.

Revision 1.60 / (download) - annotate - [select for diffs], Tue Dec 3 08:32:40 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.59: +14 -5 lines
Diff to previous 1.59 (colored)

warn when failing to enqueue an internal bounce.

Revision 1.59 / (download) - annotate - [select for diffs], Wed Nov 6 10:01:29 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.58: +39 -9 lines
Diff to previous 1.58 (colored)

Much much improved config parser and related changes.
Simplify code and do not impose an order on conditions and rule options.

Format changes that may require smtpd.conf update for some setups:

- SSL certificates are no longer automatically loaded, but must be
  explicitely declared using the "pki" keyword.
- "certificate" option becomes "pki" in listener and accept rules.
- "ssl://" becomes "secure://" in relay via rules.
- "helo" becomes "hostnames" in relay rules

New features:

- accept rules do not need an explicit action, in which case alias table
  or .forward must provide one.
- new "forward-only" action to force relaying and reject rcpts that expand
  as local delivery.
- "!" (negation) modifier on rule matching conditions.
- new "recipient" rule matching condition.
- new "verify" option on listeners and relay rules to reject invalid
  certificates.

Other changes:

- remember the helo name advertised on incoming mail and use it for sending
  bounces.
- bump envelope version (existing envelopes are updated on-the-fly).

Revision 1.58 / (download) - annotate - [select for diffs], Sat Oct 26 12:27:58 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.57: +8 -8 lines
Diff to previous 1.57 (colored)

%i -> %d in format strings

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jul 19 15:14:23 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.56: +2 -1 lines
Diff to previous 1.56 (colored)

scheduler improvements:
- implement suspend/resume scheduling for individual envelopes or message,
  with the associated smtpctl commands.
- allow the mta to request immediate scheduling of an envelope.
- on temporary failures a penalty can be given to further delay the next try.

Revision 1.56 / (download) - annotate - [select for diffs], Fri May 24 17:03:14 2013 UTC (11 years ago) by eric
Branch: MAIN
Changes since 1.55: +4 -6 lines
Diff to previous 1.55 (colored)

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.55 / (download) - annotate - [select for diffs], Fri Apr 12 18:22:49 2013 UTC (11 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.54: +4 -4 lines
Diff to previous 1.54 (colored)

replace MAX_LINE_SIZE and SMTP_LINE_MAX with SMTPD_MAXLINESIZE for
consistency and clarity.  Remove useless and confusing extra byte in
a few arrays based on this define.

ok gilles@

Revision 1.54 / (download) - annotate - [select for diffs], Sat Jan 26 09:37:23 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.53: +405 -246 lines
Diff to previous 1.53 (colored)

Sync with our smtpd repo:

* 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@

Revision 1.53 / (download) - annotate - [select for diffs], Fri Nov 23 10:55:25 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.52: +13 -11 lines
Diff to previous 1.52 (colored)

knf

ok gilles@

Revision 1.52 / (download) - annotate - [select for diffs], Mon Nov 12 14:58:53 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.51: +8 -8 lines
Diff to previous 1.51 (colored)

Cleanups and improvements:

* 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@

Revision 1.51 / (download) - annotate - [select for diffs], Sun Oct 7 15:46:38 2012 UTC (11 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.50: +9 -11 lines
Diff to previous 1.50 (colored)

convert iobuf_queue()'s to iobuf_fqueue(). (idea from gilles@)
introduce iobuf_xinit() and iobuf_xfqueue(). (idea from eric@)

ok gilles@

Revision 1.50 / (download) - annotate - [select for diffs], Wed Oct 3 16:43:19 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.49: +3 -7 lines
Diff to previous 1.49 (colored)

don't try to cope with iobuf_init() failure, make it fatal() instead.

from eric@ input

ok gilles@

Revision 1.49 / (download) - annotate - [select for diffs], Tue Oct 2 12:37:38 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.48: +7 -2 lines
Diff to previous 1.48 (colored)

check iobuf_init() return value.

ok gilles@ eric@

Revision 1.48 / (download) - annotate - [select for diffs], Wed Sep 26 21:06:45 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.47: +2 -1 lines
Diff to previous 1.47 (colored)

fix memory leak in case of fdopen() failure

ok eric@ gilles@

Revision 1.47 / (download) - annotate - [select for diffs], Sat Aug 18 15:39:26 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.46: +55 -19 lines
Diff to previous 1.46 (colored)

Limit the number of bounce sessions running at the same time.  When
committed, a bounce is put on a runnable list of bounces. This list
is drained to enqueue as much bounces as possible within the limit.

This avoids DoS'ing the server when lots of bounces are enqueued at
startup.

While there, allow new envelopes to be added to a bounce until the
the very last moment (i.e. when the list of recipients is written).

ok gilles@ chl@

Revision 1.46 / (download) - annotate - [select for diffs], Thu Aug 9 16:00:31 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.45: +189 -79 lines
Diff to previous 1.45 (colored)

Allow failure reports for different recipients of the same message
to be grouped into a single bounce message.

The bounce structure keeps a list of envelopes.  For now, the list
is constructed by delaying the re-enqueuing of a bounce envelope a
bit, to wait for other bounces from the same message to be part of
the same report.

Revision 1.45 / (download) - annotate - [select for diffs], Thu Aug 9 11:52:32 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.44: +1 -16 lines
Diff to previous 1.44 (colored)

remove unused function and prototypes

Revision 1.44 / (download) - annotate - [select for diffs], Thu Aug 9 09:48:02 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.43: +23 -20 lines
Diff to previous 1.43 (colored)

Improve the message flows to completely isolate operations on the
queue backend within the queue process.

The scheduler sends envelope ids to the queue process which loads
the envelope and forward the request to the agent responsible for
the delivery.  The result is sent by the agent to the queue which
updates the storage before notifying the scheduler.

Bounces are created and enqueued (from the client side) by the
queue process, rather than the scheduler.

ok gilles@

Revision 1.43 / (download) - annotate - [select for diffs], Wed Aug 8 08:50:42 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.42: +7 -1 lines
Diff to previous 1.42 (colored)

Improve the scheduler backend API.

New envelopes are pushed into the scheduler through the insert()
commit() rollback() transactional interface functions.

Worklists are pulled from the scheduler through a single batch()
interface function, which returns a list of envelope ids and the
type of processing. Envelopes returned in this batch are said to
be "in-flight", as opposed to "pending". They are supposed to be
processed in some way, and either updated() or deleted() at some
point.

The schedule()/remove() functions are used to alter the internal
state of "pending" envelopes to make them schedulable.  The enve-
lopes will be part of a worklist on the next call to batch().

Rewrite the scheduler_ramqueue backend.

The initial queue loading in now done by the queue.

ok gilles@

Revision 1.42 / (download) - annotate - [select for diffs], Mon Jul 9 09:57:53 2012 UTC (11 years, 10 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored)

- runner is the terminology we used back when we had runqueues, we no
  longer have them and runner is actually a scheduler so rename.
- introduce scheduler_backend which does the same to scheduler than
  queue_backend does to queue and map_backend does to maps
- remove all occurences of RUNNER and runner, replace them with SCHEDULER
  and scheduler

ok eric@, ok chl@

Revision 1.41 / (download) - annotate - [select for diffs], Wed Jun 20 20:45:23 2012 UTC (11 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.40: +5 -5 lines
Diff to previous 1.40 (colored)

Finally get rid of the queue_kind enum in the queue API. Keep that
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@

Revision 1.40 / (download) - annotate - [select for diffs], Sun Jan 29 11:37:32 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.39: +283 -115 lines
Diff to previous 1.39 (colored)

Rewrite io code in smtp and mta using the iobuf/ioev interface to have
a better separation between io and protocol logic.  As a side-effect,
it fixes a couple of long-standing issues in the io path, and
hopefully add fresh ones instead.  Kill client.c in the process.

ok gilles@

Revision 1.39 / (download) - annotate - [select for diffs], Thu Jan 12 22:59:55 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.38: +1 -3 lines
Diff to previous 1.38 (colored)

The status field in the envelope is confusing. Its only purpose is to
notify the runner of what happened with an envelope that has been
scheduled.  It is not part of the state of the envelope, and it is not
even dumped.  So it should only be set by mta/mda, checked by runner
to decide what to do with the envelope, and ignored everywhere else.

ok gilles@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jan 11 17:28:36 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.37: +6 -42 lines
Diff to previous 1.37 (colored)

Finally remove the queue_message_update() function which ended up
being only called by bounce sessions, so most of the code there was
actually useless.  The envelope is directly deleted or updated at the
relevant place.

ok gilles@

Revision 1.37 / (download) - annotate - [select for diffs], Tue Dec 27 14:38:56 2011 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.36: +8 -17 lines
Diff to previous 1.36 (colored)

Instead of using a separate "bounce" queue, create the bounce envelope
directly as an envelope of the bounced message, just like "regular"
envelopes.

ok gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Wed Dec 14 23:08:40 2011 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.35: +59 -1 lines
Diff to previous 1.35 (colored)

finally kill queue_shared.c and move what is left to bounce.c
where it belongs.

ok gilles@

Revision 1.35 / (download) - annotate - [select for diffs], Thu Oct 27 14:32:57 2011 UTC (12 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.34: +3 -2 lines
Diff to previous 1.34 (colored)

Use PRI{x,d}64 in format strings instead of %llx, %lld or %qd to print {u_,}int64_t or time_t

While there, cast some time_t to int64_t

These will fix build warnings for portable smptd

ok gilles@ eric@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Oct 23 09:30:06 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.33: +13 -10 lines
Diff to previous 1.33 (colored)

fsqueue no longer stores envelopes by dumping the structure, instead use a
couple of load/dump functions to convert to and from a human readable fmt.
while at it kill struct delivery and merge back its fields to the envelope.

this basically means we shouldn't require users to flush their queues every
time we make a change to struct envelope.

work is not done, but we're at a better state than the binary fsqueue so
we'll improve it in-tree.

has been running on my own box for the last 12 hours or so
ok eric@, chl@

Revision 1.33 / (download) - annotate - [select for diffs], Thu Sep 1 19:56:49 2011 UTC (12 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

Introduce a small set of functions to manage stat counters in a
simpler and hopefully saner way.

ok gilles@ chl@

Revision 1.32 / (download) - annotate - [select for diffs], Mon May 16 21:05:51 2011 UTC (13 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.31: +10 -10 lines
Diff to previous 1.31 (colored)

murder struct path and make sure smtpd uses simpler structures that do not
bring a shitload of unnecessary information everywhere. this required many
parts of smtpd to be refactored and more specifically envelope expansion.

in the process lots of code got simplified, and the envelope expansion code
has been isolated to lka_session.c with some longstanding bugs fixed.

Diff has been tested by many with no major regression reported.
armani@ spotted a bug in a setup where a domain is listed a both primary
and virtual, I will fix that in-tree as it's becoming painful to maintain
this diff out.

Revision 1.31 / (download) - annotate - [select for diffs], Sun May 1 12:57:11 2011 UTC (13 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.30: +7 -9 lines
Diff to previous 1.30 (colored)

the smtpd env is meant to be global, so do not pass it all around.

discussed with and ok gilles@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Apr 17 11:39:22 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.29: +10 -10 lines
Diff to previous 1.29 (colored)

a structure describing an envelope should be called struct envelope, not
struct message ...

Revision 1.29 / (download) - annotate - [select for diffs], Fri Apr 15 17:01:05 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.28: +5 -3 lines
Diff to previous 1.28 (colored)

kill message_id and message_uid

smtpd now has an evpid associated to each delivery message, the evpid is an
u_int64_t where the upper 32 bits are the msgid, and the 32 bits are the
envelope unique identifier for that message. this results in lots of space
saved in both disk-based and ram-based queues, but also simplifies a lot of
code.

change has been stressed on my desktop, and has ran on my MX for the entire
afternoon without a regression.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Apr 14 21:53:45 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.27: +3 -2 lines
Diff to previous 1.27 (colored)

fsqueue now provides fsqueue_message_fd_r() and fsqueue_message_fd_rw() to
obtain a read{-only,/write} descriptor to the message file.

make sure smtpd uses the new API everywhere it needs a fd, and kill the
many functions that were used until now.

Revision 1.27 / (download) - annotate - [select for diffs], Thu Apr 14 20:11:08 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

fsqueue queue backend will implement a filesystem queue:
- fsqueue->setup() performs the queue initialization;
- fsqueue->message() controls messages;
- fsqueue->envelope() controls envelopes;

This commit brings the following to fsbackend:
fsqueue_setup(), fsqueue_message_delete(), fsqueue_envelope_load(),
fsqueue_envelope_update(), fsqueue_envelope_delete().

It also makes smtpd use the queue_backend API for these operations.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Mar 26 10:59:59 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.25: +14 -7 lines
Diff to previous 1.25 (colored)

have the client API receive a stdio stream rather than a fd to the message
fd. this shifts responsibility for the fclose to the caller, prevents a
memory leak and makes everyone happy.

diff by Jared Yanovich, thanks !

Revision 1.25 / (download) - annotate - [select for diffs], Mon Mar 21 13:06:25 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.24: +5 -4 lines
Diff to previous 1.24 (colored)

do not close msgfd in bounce_session(), it is closed by client_close()

Revision 1.24 / (download) - annotate - [select for diffs], Sun Nov 28 13:56:43 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

a bit of .h cleanups, no functionnal change

Revision 1.23 / (download) - annotate - [select for diffs], Sat Oct 9 22:11:08 2010 UTC (13 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.22: +1 -1 lines
Diff to previous 1.22 (colored)

missing from previous commit

Revision 1.22, Tue Jun 1 23:06:23 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.21: +1 -1 lines
FILE REMOVED

new queue, again; gcc2 compile tested by deraadt

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jun 1 19:47:08 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.20: +0 -0 lines
Diff to previous 1.20 (colored)

New queue doesn't compile on gcc2, back out.  Spotted by deraadt@

Revision 1.20, Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.19: +1 -1 lines
FILE REMOVED

Rewrite entire queue code.

Major goals:

1) Fix bad performance caused by the runner process doing full queue
read in 1s intervals.  My Soekris can now happily accept >50 msg/s
while having multi-thousand queue; before, one hundred queue would
bring the system to its knees.

2) Introduce Qmail-like scheduler that doesn't write as much to the
disk so that it needs less code for servicing error conditions,
which in some places can be tricky to get right.

3) Introduce separation between the scheduler and the backend; these
two queue aspects shouldn't be too tied too each other.  This means
that eg. storing queue in SQL requires rewrite of just queue_backend.c.

4) Make on-disk queue format architecture independent, and more
easily extensible, to reduce number of flag days in the future.

Minor goals:

ENOSPC no longer prevents delivery attempts, fixed session limiting
for relayed mail, improved batching of "relay via" mails, human-readable
mailq output, "show queue raw" command, clearer logging, sending
of single bounce about multiple recipients, exact delay= computation,
zero delay between deliveries while within session limit (currently
1s delay between re-scheduling is enforced), mta no longer requests
content fd, corrected session limit for bounce submissions, tiny
<100B queue files instead of multi-KB, detect loops before accepting
mail, reduce traffic on imsg channels by killing enormous struct
submit_status.

Revision 1.19 / (download) - annotate - [select for diffs], Wed May 19 20:57:10 2010 UTC (14 years ago) by gilles
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

cleanup-only commit, removes unrequired includes, no functionnal change

Revision 1.18 / (download) - annotate - [select for diffs], Thu Apr 22 12:56:33 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.17: +1 -8 lines
Diff to previous 1.17 (colored)

Fix a case of runner trying to send imsg directly to smtp process instead
of forwarding it via queue.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Dec 23 17:16:03 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.16: +10 -11 lines
Diff to previous 1.16 (colored)

Implementation of RFC 2920 PIPELINING extension, client side only for now.

This restructures the client_* API internals significantly.  The code becomes
pipelining in nature.  All SMTP commands are put on the output queue and
dequeued as quickly as possible.  Once dequeued, they're moved to the receive
queue so that replies can be matched with previous commands.

Dequeuing commands from the output queue halts when the count of commands
currently in-pipeline (``cmdi'') is equal to the command send window (``cmdw'').
There are three cmdw values useful in practice:

0               clear pipeline, ie. inhibit all future sends
1               disable pipelining, ie. use old ``one-request-one-reply`` mode
SIZE_T_MAX      enable pipelining, ie. dequeue as many commands as possible

At the beginning of session cmdw is 1.  When it is found that peer supports
PIPELINING, it grows to SIZE_T_MAX.  After dequeing DATA it is again 1.  After
sending QUIT it is 0.

Each command dequeued from the output queue becomes a buf in a msgbuf.  The act
of combining multiple commands into a single send operation did not need to be
implemented: buf_write() already combines bufs using iovec and sends them at
once using sendmsg(2).

Tested by todd@ and oga@

"looks good" to gilles@

Revision 1.16 / (download) - annotate - [select for diffs], Mon Dec 14 23:17:04 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Handle 6yz code as permanent error.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Dec 14 18:21:53 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.14: +5 -1 lines
Diff to previous 1.14 (colored)

Control maximum number of bounce sessions similarly to how the mta and mda
are now controlled.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Dec 12 14:03:59 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.13: +7 -10 lines
Diff to previous 1.13 (colored)

When acting as a client do content reads from the disk progressively
as the remote accepts more data instead of doing one big read into
the memory in the beginning of session.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Dec 12 10:33:11 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.12: +35 -46 lines
Diff to previous 1.12 (colored)

Simplify client_* api, mainly by making fatal conditions result in immediate
fatals instead of passing the error up (kills ~300 lines).

Implement sending of the QUIT command which replaces crude close(2).

tested by gilles@, todd@

Revision 1.12 / (download) - annotate - [select for diffs], Wed Nov 11 10:04:05 2009 UTC (14 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.11: +2 -1 lines
Diff to previous 1.11 (colored)

add missing headers needed by time()

ok jacekm@

Revision 1.11 / (download) - annotate - [select for diffs], Thu Nov 5 12:08:41 2009 UTC (14 years, 6 months ago) by jsing
Branch: MAIN
Changes since 1.10: +3 -0 lines
Diff to previous 1.10 (colored)

Include a Date: header in bounce messages.

ok jacekm@ gilles@

Revision 1.10 / (download) - annotate - [select for diffs], Thu Nov 5 12:05:47 2009 UTC (14 years, 6 months ago) by jsing
Branch: MAIN
Changes since 1.9: +7 -1 lines
Diff to previous 1.9 (colored)

Introduce a 6yz status code, used internally to report permanent errors.
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@

Revision 1.9 / (download) - annotate - [select for diffs], Wed Sep 16 15:33:06 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.8: +4 -1 lines
Diff to previous 1.8 (colored)

Free resources when bounce enqueue fails due to a timeout.

Revision 1.8 / (download) - annotate - [select for diffs], Tue Sep 15 16:50:06 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.7: +36 -14 lines
Diff to previous 1.7 (colored)

Extend SMTP client_* API to support SSL+AUTH, and use it in the mta
process to relay mails.  ok gilles@

Revision 1.7 / (download) - annotate - [select for diffs], Fri Sep 4 18:50:43 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.6: +6 -2 lines
Diff to previous 1.6 (colored)

Fix scheduling of bounces that could not be delivered.
ok gilles@

Revision 1.6 / (download) - annotate - [select for diffs], Thu Aug 27 11:37:30 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.5: +90 -126 lines
Diff to previous 1.5 (colored)

Implement client side of the SMTP protocol in a library-like module.
Make bounce code and /usr/sbin/sendmail interface use this new API.
The mta process continues to use its own implementation, but
eventually will be switched to use this shared module.

Buffer routines are taken from buffer.c rather than from evbuffer.
This is one step forward to using a single buffer API across the
program.

"it looks sexy" gilles@

Revision 1.5 / (download) - annotate - [select for diffs], Thu Aug 6 16:26:39 2009 UTC (14 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.4: +2 -3 lines
Diff to previous 1.4 (colored)

when writing a bounce, follow the same rule as for mta sessions and prepend
with a dot lines starting with a dot

Revision 1.4 / (download) - annotate - [select for diffs], Thu Aug 6 14:27:41 2009 UTC (14 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

factorize file_copy_session() and file_copy() so file_copy() can handle
both deliveries to mailboxes (mbox/maildir) and copying to a session.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Aug 6 14:16:37 2009 UTC (14 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

fix a typo in bounce message t -> to

Revision 1.2 / (download) - annotate - [select for diffs], Thu Aug 6 14:12:48 2009 UTC (14 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.1: +7 -1 lines
Diff to previous 1.1 (colored)

- introduce message_set_errormsg() to set the error description that will
  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

Revision 1.1 / (download) - annotate - [select for diffs], Thu Aug 6 13:40:45 2009 UTC (14 years, 9 months ago) by gilles
Branch: MAIN

This commit reworks the entire mailer daemon support to actually make it
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@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.