OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.147 / (download) - annotate - [select for diffs], Sat Jan 20 09:01:03 2024 UTC (4 months, 2 weeks ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.146: +15 -12 lines
Diff to previous 1.146 (colored)

Use imsg_get_fd() to access the fd passed via imsgs.

Most of the conversion is simple there is just log_imsg() that can
no longer display the fd since imsg_get_fd() can only be called once.
OK op@

Revision 1.146 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months, 1 week ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.145: +2 -1 lines
Diff to previous 1.145 (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.145 / (download) - annotate - [select for diffs], Wed May 10 07:19:08 2023 UTC (13 months ago) by op
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

remove trailing whitespace

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

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

Revision 1.143 / (download) - annotate - [select for diffs], Mon Jun 14 17:58:15 2021 UTC (2 years, 11 months ago) by eric
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.142: +1 -14 lines
Diff to previous 1.142 (colored)

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

ok jung@

Revision 1.142 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.141: +2 -3 lines
Diff to previous 1.141 (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.141 / (download) - annotate - [select for diffs], Thu Oct 3 08:50:08 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.140: +1 -3 lines
Diff to previous 1.140 (colored)

no need to set n to 0 right before assigning it ret value from io_printf()

Revision 1.140 / (download) - annotate - [select for diffs], Thu Oct 3 05:48:33 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.139: +4 -4 lines
Diff to previous 1.139 (colored)

make it obvious we don't care about text_to_mailaddr() return values, we've
already checked it upfront and wouldn't reach this point if it didn't parse
correctly.

Revision 1.139 / (download) - annotate - [select for diffs], Sat Aug 10 19:16:01 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.138: +10 -7 lines
Diff to previous 1.138 (colored)

improve level of details when logging mda errors that happen while we're in
the creation of the mda process. in some situations, we can provide details
far more precise than just the strerror()

Revision 1.138 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:50 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.137: +2 -2 lines
Diff to previous 1.137 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Jan 5 10:20:21 2019 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.136: +7 -5 lines
Diff to previous 1.136 (colored)

we assumed that there was no such thing as an "mda session" so the logs
displayed 0000000000000000 as the session id for mda deliveries, but we
were wrong. there's actually an identifier that's associated to a batch
of envelopes to be delivered to the same user, and this most definitely
is a session id for that user.

Revision 1.136 / (download) - annotate - [select for diffs], Thu Dec 27 15:41:50 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.135: +6 -1 lines
Diff to previous 1.135 (colored)

extract subaddress from last resolved node, not from dest or rcpt address
which was incorrect and can lead to ambiguous cases, this will affect the
people who were using subaddresses within aliases themselves AND expected
deliveries to a maildir subdir of the recipient user.

ok eric@

Revision 1.135 / (download) - annotate - [select for diffs], Tue Oct 30 14:17:17 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.134: +2 -2 lines
Diff to previous 1.134 (colored)

in mda.c, when reading the last line of an mda, we should never have a \n
in the buffer, however better be safe than sorry, add VIS_NL to strnvis()
flags because a \n would corrupt an envelope.

while debugging an issue from Jason Donenfeld, this appears as a safety-net

ok eric@

Revision 1.134 / (download) - annotate - [select for diffs], Tue Sep 4 13:04:42 2018 UTC (5 years, 9 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.133: +73 -7 lines
Diff to previous 1.133 (colored)

upon mda failure, smtpd would assume tempfail and retry. this is at odds
with the other MTA which assume a permfail unless the exit status is one
of a specific set. make smtpd honour the same exit statuses as postfix.

note that all errors that occur before the user mda is executed (fork, pipe
and related) are still considered tempfail, only errors coming from the mda
itself are handled as permfail.

this commit is a temporary solution as i believe the SIGCHLD handler is way
more complex than it should be and we'll simplify it after 6.4 is out.

ok eric@

Revision 1.133 / (download) - annotate - [select for diffs], Sun Jul 8 13:06:37 2018 UTC (5 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.132: +2 -2 lines
Diff to previous 1.132 (colored)

remove 'event=' from logs it doesn't carry any information

suggested by eric@, ok millert@

Revision 1.132 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.131: +10 -11 lines
Diff to previous 1.131 (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.131 / (download) - annotate - [select for diffs], Thu May 24 11:38:24 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.130: +46 -178 lines
Diff to previous 1.130 (colored)

switch smtpd to new grammar

ok eric@

Revision 1.130 / (download) - annotate - [select for diffs], Sat Apr 28 13:54:03 2018 UTC (6 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored)

remove left-over comma from log message

Revision 1.129 / (download) - annotate - [select for diffs], Wed Apr 25 07:48:59 2018 UTC (6 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.128: +2 -2 lines
Diff to previous 1.128 (colored)

Return-Path should be in brackets as per RFC5322

diff from Leo Gaspard, ok eric@ and I

Revision 1.128 / (download) - annotate - [select for diffs], Tue Nov 21 12:20:34 2017 UTC (6 years, 6 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.127: +301 -312 lines
Diff to previous 1.127 (colored)

no need to check the sending process in imsg handlers when there is no
ambiguity: just use a single switch.

ok gilles@ sunil@

Revision 1.127 / (download) - annotate - [select for diffs], Mon Jul 31 16:45:03 2017 UTC (6 years, 10 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.126: +5 -3 lines
Diff to previous 1.126 (colored)

handle empty output correctly in mda_getlastline()

diff from Casper Ti. Vector, ok eric@

Revision 1.126 / (download) - annotate - [select for diffs], Wed Nov 30 17:43:32 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.125: +7 -7 lines
Diff to previous 1.125 (colored)

hide internal io flags and rename IO_PAUSE_{IN,OUT} to IO_{IN,OUT}

ok gilles@ sunil@

Revision 1.125 / (download) - annotate - [select for diffs], Wed Nov 30 11:52:48 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.124: +18 -20 lines
Diff to previous 1.124 (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.124 / (download) - annotate - [select for diffs], Thu Nov 24 12:58:27 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.123: +2 -2 lines
Diff to previous 1.123 (colored)

add an io_error() accessor to avoid dereferencing the io struct directly.

ok gilles@

Revision 1.123 / (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.122: +10 -11 lines
Diff to previous 1.122 (colored)

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

ok sunil@ gilles@

Revision 1.122 / (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.121: +4 -3 lines
Diff to previous 1.121 (colored)

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

ok sunil@ gilles@

Revision 1.121 / (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.120: +4 -4 lines
Diff to previous 1.120 (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.120 / (download) - annotate - [select for diffs], Thu Sep 1 15:12:45 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.119: +1 -6 lines
Diff to previous 1.119 (colored)

zap dead code

ok gilles@ sunil@

Revision 1.119 / (download) - annotate - [select for diffs], Sun May 22 16:31:21 2016 UTC (8 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.118: +5 -4 lines
Diff to previous 1.118 (colored)

start work on improving the log format, this is work in progress but it'll
be better worked in tree

ok eric@, beck@

Revision 1.118 / (download) - annotate - [select for diffs], Fri Mar 25 15:06:58 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.117: +2 -2 lines
Diff to previous 1.117 (colored)

Nuke session_socket_blockmode() and session_socket_linger(). Use
the identical io_set_blocking() and io_set_linger().

Since both are always called to turn off blocking or lingering,
nuke the parameter and associated enum in favour of "just doing the
right thing".

While passing remove the unneeded last parameter to the remaining
fcntl(F_GETFL).

Finally, rename the functions to io_set_nonblocking() and
io_set_nolinger() for clarity.

No functional change.

Started with a sweep of fcntl() usage inspired by guenther@.

ok gilles@

Revision 1.117 / (download) - annotate - [select for diffs], Tue Feb 2 05:45:27 2016 UTC (8 years, 4 months ago) by sunil
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.116: +3 -1 lines
Diff to previous 1.116 (colored)

Check imsg data size before use.

Ok eric@ millert@

Revision 1.116 / (download) - annotate - [select for diffs], Fri Jan 8 19:31:29 2016 UTC (8 years, 5 months ago) by chrisz
Branch: MAIN
Changes since 1.115: +3 -3 lines
Diff to previous 1.115 (colored)

Add missing space in "Delivered-to:%s\n" header.

OK sunil@

Revision 1.115 / (download) - annotate - [select for diffs], Mon Dec 14 10:38:40 2015 UTC (8 years, 5 months ago) by sunil
Branch: MAIN
Changes since 1.114: +51 -26 lines
Diff to previous 1.114 (colored)

Wrap long lines.

Ok gilles@

Revision 1.114 / (download) - annotate - [select for diffs], Mon Nov 30 13:10:13 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.113: +12 -3 lines
Diff to previous 1.113 (colored)

handle "mda command too long" as a tempfail

Revision 1.113 / (download) - annotate - [select for diffs], Mon Nov 30 12:26:55 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.112: +11 -4 lines
Diff to previous 1.112 (colored)

While delivering to lmtp or mda, accept optional "as user" parameter
whose privileges would be used instead of the default.

Ok gilles@ jung@

Revision 1.112 / (download) - annotate - [select for diffs], Tue Oct 27 21:20:11 2015 UTC (8 years, 7 months ago) by jung
Branch: MAIN
Changes since 1.111: +3 -1 lines
Diff to previous 1.111 (colored)

add a rcpt-to parameter to be able to use the original (probably expanded)
RCPT TO within LMTP sessions

ok gilles eric

Revision 1.111 / (download) - annotate - [select for diffs], Mon Oct 26 09:22:03 2015 UTC (8 years, 7 months ago) by jsg
Branch: MAIN
Changes since 1.110: +2 -1 lines
Diff to previous 1.110 (colored)

avoid a potential double free
ok gilles@

Revision 1.110 / (download) - annotate - [select for diffs], Sun Oct 11 12:09:06 2015 UTC (8 years, 8 months ago) by sunil
Branch: MAIN
Changes since 1.109: +20 -35 lines
Diff to previous 1.109 (colored)

Convert some fgetln to getline.

Suggestion and ok millert@, ok gilles@, eric@

Revision 1.109 / (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.108: +8 -7 lines
Diff to previous 1.108 (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.108 / (download) - annotate - [select for diffs], Mon Jan 5 21:00:36 2015 UTC (9 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.107: +25 -11 lines
Diff to previous 1.107 (colored)

some third-party mda require a prepended From separator line, so remove the
prepending from delivery_filename backend and prepend conditionally earlier
in the code path if delivery method is through mda or filename.

ok eric@

Revision 1.107 / (download) - annotate - [select for diffs], Tue Jul 8 07:59:31 2014 UTC (9 years, 11 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.106: +2 -2 lines
Diff to previous 1.106 (colored)

fix typos.

ok jmc@

Revision 1.106 / (download) - annotate - [select for diffs], Wed Apr 30 09:17:29 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.105: +3 -1 lines
Diff to previous 1.105 (colored)

when using maildir, do not create automatically create folders to match tag
in email address (ie: gilles+tag => ~/Maildir/.tag), instead use the folder
if it already exists and deliver to the mail Maildir otherwise.

ok eric@ and chl@

Revision 1.105 / (download) - annotate - [select for diffs], Sat Apr 19 17:42:18 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.104: +7 -7 lines
Diff to previous 1.104 (colored)

(void) cast snprintf calls that cannot truncate or for which earlier checks
ensure the copy won't fail

Revision 1.104 / (download) - annotate - [select for diffs], Sat Apr 19 13:07:56 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.103: +55 -22 lines
Diff to previous 1.103 (colored)

add missing checks to strlcpy() when copying envelope "destination" buffer
to the mda delivery buffer. we should never hit these unless we mistakenly
change the value of a define, better be safe than sorry.

(void) cast strlcpy/strlcat that cannot truncate or that we know and want
to truncate rather than lose (informative data not used by smtpd but
intended to help the human reading the log)

Revision 1.103 / (download) - annotate - [select for diffs], Fri Apr 4 16:10:42 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.102: +67 -113 lines
Diff to previous 1.102 (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.102 / (download) - annotate - [select for diffs], Tue Feb 4 15:44:05 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.101: +19 -12 lines
Diff to previous 1.101 (colored)

Add support for DSN and Enhanced Status Code

Revision 1.101 / (download) - annotate - [select for diffs], Tue Feb 4 14:56:03 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.100: +7 -7 lines
Diff to previous 1.100 (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.100 / (download) - annotate - [select for diffs], Thu Dec 26 17:25:32 2013 UTC (10 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored)

bcopy -> memmove
bzero -> memset

Revision 1.99 / (download) - annotate - [select for diffs], Thu Nov 28 10:43:37 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

unsigned char casts for ctype
ok gilles@

Revision 1.98 / (download) - annotate - [select for diffs], Wed Nov 20 09:22:42 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.97: +215 -170 lines
Diff to previous 1.97 (colored)

Rework the mda and scheduler to use the holdq mechanism instead of
tempfail for limiting the number of pending deliveries to the same
user.  This allows to reach optimal delivery time even in case of
burst, while keeping the number of inflight envelopes low.

Revision 1.97 / (download) - annotate - [select for diffs], Mon Oct 28 09:14:58 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.96: +2 -1 lines
Diff to previous 1.96 (colored)

bzero() some structs before using them, to be safe.

Revision 1.96 / (download) - annotate - [select for diffs], Sun Oct 27 07:56:25 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.95: +2 -1 lines
Diff to previous 1.95 (colored)

Create the control socket in the parent process to abort early if
another smtpd instance is running.  Close the inherited socket in
every forked process but control.

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

%i -> %d in format strings

Revision 1.94 / (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.93: +9 -9 lines
Diff to previous 1.93 (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.93 / (download) - annotate - [select for diffs], Fri Jul 19 11:14:08 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.92: +4 -3 lines
Diff to previous 1.92 (colored)

Get rid of env->sc_pw and env->sc_pwqueue.  Early queue initialization
now happens in queue_init(), and backends take the queue passwd as
parameter in their init function.

Remove useless SMTPD_FILTER_USER while there.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Jul 19 07:49:08 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.91: +1 -2 lines
Diff to previous 1.91 (colored)

Remove useless sc_pid from struct smtpd.

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.90 / (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.89: +4 -4 lines
Diff to previous 1.89 (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.89 / (download) - annotate - [select for diffs], Tue Feb 5 11:45:18 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.88: +1 -1 lines
Diff to previous 1.88 (colored)

- handle getaddrinfo() error as LKA_TEMPFAIL
- handle getsockname() error in smtp_connected()
- accept '/' as part of user-part, expand to ':' as done by qmail
- fix wrong check in mda leading to bogus Return-Path header
- fix aliases parsing when there's a white space between key and separator
- some cosmethic cleanup

Revision 1.88 / (download) - annotate - [select for diffs], Tue Feb 5 10:53:57 2013 UTC (11 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

Spelling fixes: retreive -> retrieve. ok gilles

Revision 1.87 / (download) - annotate - [select for diffs], Thu Jan 31 18:18:40 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.86: +238 -149 lines
Diff to previous 1.86 (colored)

update mda to use a smaller struct mda_envelope internally.
raise internal envelope limits.
simplify code.

ok gilles@

Revision 1.86 / (download) - annotate - [select for diffs], Mon Jan 28 16:32:10 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.85: +10 -3 lines
Diff to previous 1.85 (colored)

log sender address as "<>" when delivering bounces

ok gilles@

Revision 1.85 / (download) - annotate - [select for diffs], Sat Jan 26 09:37:23 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.84: +275 -131 lines
Diff to previous 1.84 (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.84 / (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.83: +23 -22 lines
Diff to previous 1.83 (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.83 / (download) - annotate - [select for diffs], Fri Nov 2 16:02:33 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.82: +169 -113 lines
Diff to previous 1.82 (colored)

Consistency and robustness improvements in mda:

- Introduce a mda_getlastline function(); improve the code to avoid
  useless allocations and string formatting; make it return the last
  line with content (skip trailing empty lines if found).
- Add a mechanism by which the mda can request the parent to abort a
  local delivery by killing the process.
- Use ioev/iobuf for draining data to the delivery process.
- Make sure to catch all transient errors and make them result in a
  tempfail rather than calling fatal().
- Make sure that the envelope status is properly set for all failures.
- Stop using SMTP response codes; it makes no sense in this context.

ok gilles@

Revision 1.82 / (download) - annotate - [select for diffs], Thu Oct 25 09:51:08 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.81: +170 -85 lines
Diff to previous 1.81 (colored)

Make the mda request the message fd from the queue when needed, instead of
pushing the fd with the envelope.  This allows the mda to deal itself with
session limits.  Envelopes are sent at full rate to the mda, which buffers
them on per-user queues, or sends them back for rescheduling if it already
has too many pending envelopes.  Delivery sessions are created (within per-
user and global limits) to drain the queues.

This makes the server handle envelope bursts more efficiently.

ok gilles@

Revision 1.81 / (download) - annotate - [select for diffs], Wed Oct 17 17:14:11 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.80: +15 -15 lines
Diff to previous 1.80 (colored)

rename field msg -> evp.

ok gilles@

Revision 1.80 / (download) - annotate - [select for diffs], Sun Oct 14 20:18:22 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.79: +4 -6 lines
Diff to previous 1.79 (colored)

As discussed with gilles@, actually impose the per-user limit regardless
of the delivery method.  Bump the limit a bit.

requested by and ok gilles@

Revision 1.79 / (download) - annotate - [select for diffs], Sun Oct 14 18:50:25 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.78: +65 -1 lines
Diff to previous 1.78 (colored)

Limit the number of per-user mda (external program) deliveries that can be
running at the same time. It prevents a user from consuming all mda "slots"
with a long-running filter in his .forward file.  Other delivery types are
not affected.

ok gilles@ chl@

Revision 1.78 / (download) - annotate - [select for diffs], Fri Sep 28 13:40:21 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.77: +21 -31 lines
Diff to previous 1.77 (colored)

Move mda_session to mda.c, and make it use a tree instead of a list,
but still use uint32_t keys since ithe key is used as peerid in msg.

ok gilles@

Revision 1.77 / (download) - annotate - [select for diffs], Thu Sep 27 17:47:49 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.76: +4 -9 lines
Diff to previous 1.76 (colored)

use xmalloc()/xcalloc() helpers

while there unify usage of log_trace() in ramstat_set()

ok gilles@ eric@

Revision 1.76 / (download) - annotate - [select for diffs], Wed Sep 26 19:52:20 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.75: +8 -8 lines
Diff to previous 1.75 (colored)

Stop using the delivery_data union (field "to") in delivery_mda.
It's confusing and not necessary as it's only used for "buffer".
Instead, just add a "buffer" member in the structure and rename
"as_user" to "user".

The delivery_data union becomes an anonymous union in expandnode,
which is the only other place where it's used.

ok gilles@

Revision 1.75 / (download) - annotate - [select for diffs], Fri Sep 21 12:33:32 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.74: +4 -22 lines
Diff to previous 1.74 (colored)

Add a log_envelope() function that log envelope status in a uniform way.
It automagically adds an rcpt=<user@domain> field if "dest" differs from
the original "rcpt". The function takes an "extra" parameter that allows
to add some specific info depending on the context.

ok gilles@

Revision 1.74 / (download) - annotate - [select for diffs], Thu Sep 20 09:27:49 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.73: +4 -7 lines
Diff to previous 1.73 (colored)

envelope type is necessarily D_MDA here.

ok chl@

Revision 1.73 / (download) - annotate - [select for diffs], Sun Sep 16 16:43:28 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.72: +1 -3 lines
Diff to previous 1.72 (colored)

Factorize log_imsg() in imsg_dispatch() instead of in each imsg_callback()'s
and put it out of profiling, so it's not accounted.

While there, for PROC_PARENT:
- set smtpd_process for PROC_PARENT
- use setproctitle() like other processes

ok gilles@

Revision 1.72 / (download) - annotate - [select for diffs], Sat Aug 25 10:23:11 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.71: +3 -2 lines
Diff to previous 1.71 (colored)

- introduce struct stat_value
- statistics can now have a type (counter, timestamp, timeval, timespec and
  possibly others in the future)
- stat_increment() / stat_decrement() now take an increment/decrement value
  and are at the moment only of type counter
- stat_set() now takes a stat_value
- provide helpers to convert raw values to stat_value

ok eric@, ok chl@

while at it fix a rq_queue_dump() call using a bogus timestamp in scheduler
ramqueue.

Revision 1.71 / (download) - annotate - [select for diffs], Sat Aug 25 08:27:03 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.70: +3 -3 lines
Diff to previous 1.70 (colored)

use duration_to_text() when logging delay, for consistency.

ok gilles@ chl@

Revision 1.70 / (download) - annotate - [select for diffs], Tue Aug 21 13:13:17 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.69: +72 -6 lines
Diff to previous 1.69 (colored)

Re-enable loop detection, but in mta and mda this time.

ok gilles@

Revision 1.69 / (download) - annotate - [select for diffs], Sun Aug 19 14:16:58 2012 UTC (11 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.68: +5 -5 lines
Diff to previous 1.68 (colored)

coding style: replace all occurences of u_int* with uint*

ok eric@

Revision 1.68 / (download) - annotate - [select for diffs], Thu Aug 9 09:48:02 2012 UTC (11 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.67: +1 -5 lines
Diff to previous 1.67 (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.67 / (download) - annotate - [select for diffs], Fri Jan 13 14:01:57 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.66: +8 -8 lines
Diff to previous 1.66 (colored)

Stop using envelope->status to report delivery outcome to the
runner/queue.  Instead, replace IMSG_QUEUE_MESSAGE_UPDATE with three
messages:

- IMSG_QUEUE_DELIVERY_OK
- IMSG_QUEUE_DELIVERY_TEMPFAIL
- IMSG_QUEUE_DELIVERY_PERMFAIL

1) it's less confusing as status is also used by smtp
2) it's easier to see what happens just looking at imsg traces
3) it makes the code path generally easier to follow
4) it's safer because it enforces clear semantics and intent, whereas
   the status field is loosely defined and could carry bogus values.

ok gilles@ chl@

Revision 1.66 / (download) - annotate - [select for diffs], Thu Jan 12 20:59:07 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.65: +7 -7 lines
Diff to previous 1.65 (colored)

use mbox backend for mbox delivery.

ok gilles@

Revision 1.65 / (download) - annotate - [select for diffs], Sun Dec 18 18:43:30 2011 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.64: +2 -3 lines
Diff to previous 1.64 (colored)

- use envelope_set_errormsg() where possible.
- make it use sizeof() rather than a hardcoded limit.

ok chl@ gilles@

Revision 1.64 / (download) - annotate - [select for diffs], Tue Dec 13 21:44:47 2011 UTC (12 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.63: +4 -4 lines
Diff to previous 1.63 (colored)

- introduce delivery backend API (delivery.c)
- move each delivery method to it's own delivery backend
- simplify smtpd.c accordingly
- rename A_EXT -> A_MDA since that's what we really do

ok eric@

Revision 1.63 / (download) - annotate - [select for diffs], Mon Nov 14 19:23:41 2011 UTC (12 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.62: +3 -2 lines
Diff to previous 1.62 (colored)

when receiving an unexpected imsg, print its name.

with help and ideas from eric@

ok eric@ gilles@

Revision 1.62 / (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.61: +4 -3 lines
Diff to previous 1.61 (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.61 / (download) - annotate - [select for diffs], Sun Oct 23 09:30:07 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.60: +20 -20 lines
Diff to previous 1.60 (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.60 / (download) - annotate - [select for diffs], Sun Oct 9 18:39:53 2011 UTC (12 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.59: +3 -1 lines
Diff to previous 1.59 (colored)

show messages sent between processes in debug mode

ok gilles@ chl@

Revision 1.59 / (download) - annotate - [select for diffs], Mon Aug 29 21:43:08 2011 UTC (12 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored)

cast all printed time_t to long long int, and change format string accordingly.

ok gilles@

Revision 1.58 / (download) - annotate - [select for diffs], Mon Aug 29 18:49:29 2011 UTC (12 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.57: +2 -1 lines
Diff to previous 1.57 (colored)

add missing header needed by signal()

ok gilles@

Revision 1.57 / (download) - annotate - [select for diffs], Fri Aug 26 14:39:47 2011 UTC (12 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.56: +2 -1 lines
Diff to previous 1.56 (colored)

add missing header needed by time()

ok gilles@

Revision 1.56 / (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.55: +37 -31 lines
Diff to previous 1.55 (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.55 / (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.54: +13 -13 lines
Diff to previous 1.54 (colored)

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

discussed with and ok gilles@

Revision 1.54 / (download) - annotate - [select for diffs], Sun Apr 17 13:36:07 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.53: +13 -13 lines
Diff to previous 1.53 (colored)

cleanups, cosmethic changes, functions that should be static are now static
no functionnal change

Revision 1.53 / (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.52: +2 -2 lines
Diff to previous 1.52 (colored)

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

Revision 1.52 / (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.51: +3 -3 lines
Diff to previous 1.51 (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.51 / (download) - annotate - [select for diffs], Sun Nov 28 14:35:58 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.50: +1 -4 lines
Diff to previous 1.50 (colored)

remove all unused headers

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

a bit of .h cleanups, no functionnal change

Revision 1.49 / (download) - annotate - [select for diffs], Sat Oct 9 22:05:35 2010 UTC (13 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.48: +97 -75 lines
Diff to previous 1.48 (colored)

backout the "new" queue code commited 4 months ago. it has many good ideas,
is way more optimized than what we had earlier and there's definitely stuff
we want to keep, however it is early optimization that doesn't account for
many features and makes them hard (if not impossible) to write without
ugly workarounds that ruin the purpose of the optimizations.

the backout goes to 30 May's right before the commit and catches up on all
the non-queue related commits that happened since then.

i'll work on reintroducing the ideas from this queue when the basic
features we expect from a MTA are implemented.

suggested on tech@ about a week ago, no objections, several "please make
smtpd move forward" mails from hackers and tech readers.

Revision 1.48 / (download) - annotate - [select for diffs], Wed Jun 2 19:16:53 2010 UTC (14 years ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

check event_dispatch() return value

ok jacekm@

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jun 1 23:06:23 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.46: +77 -98 lines
Diff to previous 1.46 (colored)

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.45 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.44: +78 -98 lines
Diff to previous 1.44 (colored)

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.44 / (download) - annotate - [select for diffs], Wed May 26 13:56:08 2010 UTC (14 years ago) by nicm
Branch: MAIN
Changes since 1.43: +10 -10 lines
Diff to previous 1.43 (colored)

Rename some imsg bits to make namespace collisions less likely buf to
ibuf, buf_read to ibuf_read, READ_BUF_SIZE to IBUF_READ_SIZE.

ok henning gilles claudio jacekm deraadt

Revision 1.43 / (download) - annotate - [select for diffs], Wed Apr 21 18:54:43 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.42: +5 -6 lines
Diff to previous 1.42 (colored)

Runner process is just a helper for queue, so tear down its imsg
channels to parent, mda, mta, lka, smtp, and control.  This leaves
just the channel to queue, which forwards imsgs on runner's behalf
and redirects any replies back to it.

OK gilles@

Revision 1.42 / (download) - annotate - [select for diffs], Wed Apr 21 08:29:01 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.41: +1 -7 lines
Diff to previous 1.41 (colored)

Remove unusable ifdef DEBUG code.

Revision 1.41 / (download) - annotate - [select for diffs], Tue Apr 20 18:18:36 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

Use correct type for ``mda_id'', ie. match with type used in imsg header.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Apr 20 15:34:56 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.39: +97 -235 lines
Diff to previous 1.39 (colored)

Kill *2400* lines of code by abstracting common bits of the imsg handlers.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Apr 19 20:10:36 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

Use larger buffer for mda output.

Revision 1.38 / (download) - annotate - [select for diffs], Mon Apr 19 08:14:07 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.37: +221 -258 lines
Diff to previous 1.37 (colored)

Simplify local delivery codepath:
- replace uses of struct batch in the parent with simpler struct delivery.
- replace IMSG_BATCH_* dance with single IMSG_MDA_SESS_NEW.
- make mda assume it delivers to external program over a pipe.
- fork helper process when delivering to maildir or a file.

New feature: upon external mda failure use last line of its output
as an error message.

With input and tests from nicm@.

OK nicm@ gilles@

Revision 1.37 / (download) - annotate - [select for diffs], Wed Mar 3 10:52:31 2010 UTC (14 years, 3 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.36: +38 -42 lines
Diff to previous 1.36 (colored)

tweak mda.c rev. 1.36: eliminate risk of busy waiting for socket
to become writable, and make code more idiomatic.

tested by nicm@

ok gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Mon Mar 1 22:00:52 2010 UTC (14 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.35: +51 -17 lines
Diff to previous 1.35 (colored)

mda_event() assumed the mbox fp to be a file when it could be a pipe, do
not fatal on read/write errors otherwise a broken pipe in an external mda
will bring smtpd down.

mda_store() assumed write would succeed and fatal otherwise, change code
so that EINTR/EAGAIN trigger a new write while other errors gracefully
return causing the message to be rescheduled later.

these two prevent a fatal() from being hit when execution of a filter or
external mda fails (bug experienced and fix verified by nicm@)

while at it, fix a small bug where logs would not display the recipient
when mail went through a ~/.forward / aliases expansion.

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jan 3 14:37:37 2010 UTC (14 years, 5 months ago) by chl
Branch: MAIN
Changes since 1.34: +10 -1 lines
Diff to previous 1.34 (colored)

Implement "log verbose" and "log brief" to enable or disable verbose debug
logging on runtime.

Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd.

With help/ideas/testing from gilles@ jacekm@ todd@

ok jacekm@

Revision 1.34 / (download) - annotate - [select for diffs], Mon Dec 14 16:44:14 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.33: +4 -1 lines
Diff to previous 1.33 (colored)

Impose sessions limit on the delivery sessions (mta and mda).

Revision 1.33 / (download) - annotate - [select for diffs], Mon Dec 14 13:17:51 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.32: +89 -50 lines
Diff to previous 1.32 (colored)

Do non-blocking I/O when delivering locally over a pipe.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Nov 13 12:01:54 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.31: +9 -11 lines
Diff to previous 1.31 (colored)

Add logging of failed local deliveries.

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

add missing headers needed by time()

ok jacekm@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Sep 23 09:40:39 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.29: +24 -19 lines
Diff to previous 1.29 (colored)

Plug memleak.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Sep 4 16:28:42 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.28: +10 -1 lines
Diff to previous 1.28 (colored)

Prepend Return-Path.

Revision 1.28 / (download) - annotate - [select for diffs], Fri Sep 4 11:49:23 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.27: +192 -142 lines
Diff to previous 1.27 (colored)

Major mda update:
- Fix: check external mda / mail.local exit code.
- Fix: check maildir rename(2) return code.
- Fix: check read(2) and write(2) return codes.
- Fix: in parent, batchp->env was not set to the env of the current process.
- Fix: clean file in tmp if maildir delivery fails.
- Fix: mark message as temporarily failed upon start, unmark upon sucessful
delivery. (safe default)
- Fix: kill all message drops, aka. PERMFAILUREs, with one exception: when the
local user no longer exists.
- Cleanup: store.c is merged with its only user, mda.c
- Feature: in parent, child_add now returns pointer to the new child struct.
This is used to store and later access child->mda_batch member in order to
associate children with their batches.
- Feature: in parent, external mda / mail.local will timeout after 5 minutes.

Revision 1.27 / (download) - annotate - [select for diffs], Thu Sep 3 08:19:13 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

imsg_get sets errno so use fatal instead of fatalx.

Revision 1.26 / (download) - annotate - [select for diffs], Wed Sep 2 12:47:06 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

Include mbox write errors in "show stats".  Suggested by gilles.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Sep 2 11:11:10 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.24: +6 -3 lines
Diff to previous 1.24 (colored)

Do not lose mail when write(2) to mbox fails.

Revision 1.24 / (download) - annotate - [select for diffs], Thu Aug 6 13:40:45 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.23: +2 -8 lines
Diff to previous 1.23 (colored)

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@

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jun 7 05:56:25 2009 UTC (15 years ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

Change the way fds passed over a socket are retreived on the receiving side.

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@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jun 6 04:14:21 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.21: +20 -14 lines
Diff to previous 1.21 (colored)

Sync with relayd:
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@

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jun 5 20:43:57 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.20: +7 -7 lines
Diff to previous 1.20 (colored)

make smtpd's imsg lib ready, just like relayd and ospfd.
ok gilles@, jacekm@

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jun 3 22:04:15 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.19: +1 -11 lines
Diff to previous 1.19 (colored)

simplify struct batch; ok gilles@

Revision 1.19 / (download) - annotate - [select for diffs], Mon Jun 1 13:20:56 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.18: +16 -25 lines
Diff to previous 1.18 (colored)

Fix EV_READ/EV_WRITE testing inside IMSG handlers. Based on similar change
to the routing daemons by claudio@; ok gilles@

Revision 1.18 / (download) - annotate - [select for diffs], Sun May 24 14:38:56 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Parent process forks 3 types of processes, track them all in a single tree
using newly introduced child struct.

Manage process titles centrally in struct smtpd.

ok gilles@

Revision 1.17 / (download) - annotate - [select for diffs], Tue May 19 11:24:24 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.16: +22 -13 lines
Diff to previous 1.16 (colored)

Verify the amount of IMSG payload is exactly as expected; ok gilles@

Revision 1.16 / (download) - annotate - [select for diffs], Thu May 14 15:05:12 2009 UTC (15 years ago) by eric
Branch: MAIN
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

use the nitems() macro where appropriate

ok gilles@, jacekm@

Revision 1.15 / (download) - annotate - [select for diffs], Tue Apr 28 21:27:25 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.14: +1 -20 lines
Diff to previous 1.14 (colored)

let mta, mda, and mfa become idle - no functional change; ok gilles@

Revision 1.14 / (download) - annotate - [select for diffs], Tue Apr 21 14:37:32 2009 UTC (15 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.13: +4 -4 lines
Diff to previous 1.13 (colored)

correct some fatal(x) calls and error strings

ok gilles@ jacekm@

Revision 1.13 / (download) - annotate - [select for diffs], Sun Mar 29 14:18:20 2009 UTC (15 years, 2 months ago) by jacekm
Branch: MAIN
Changes since 1.12: +7 -7 lines
Diff to previous 1.12 (colored)

turn some log_debugs into log_warns or even fatals; "looks ok" gilles@

Revision 1.12 / (download) - annotate - [select for diffs], Mon Mar 23 08:25:15 2009 UTC (15 years, 2 months ago) by tobias
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

Fixed a leaking of a fd each time a file is delivered to a mbox, which
was introduced in revision 1.7.

ok and log message by gilles

Revision 1.11 / (download) - annotate - [select for diffs], Sun Mar 15 19:15:25 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.10: +53 -19 lines
Diff to previous 1.10 (colored)

the mda process no longer uses struct batch as its central structure to
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.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Mar 10 22:33:26 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.9: +10 -1 lines
Diff to previous 1.9 (colored)

implement basic logging, needs more work; ok gilles@

Revision 1.9 / (download) - annotate - [select for diffs], Sun Feb 22 19:07:33 2009 UTC (15 years, 3 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (colored)

add missing headers

ok gilles@

Revision 1.8 / (download) - annotate - [select for diffs], Sun Feb 15 10:32:23 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (colored)

New config.c that allows for process cloning. Done by pyr@ for
relayd at n2k9, and adapted to smtpd; ok gilles@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jan 27 22:48:29 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

first bricks of enqueue code which allows smtpctl to submit mail to queue
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.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Jan 1 16:15:47 2009 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.5: +1 -5 lines
Diff to previous 1.5 (colored)

remove unnecessary includes; ok gilles@

Revision 1.5 / (download) - annotate - [select for diffs], Sat Dec 13 23:19:34 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

IMSG_* namespace cleanup.

ok gilles@

Revision 1.4 / (download) - annotate - [select for diffs], Fri Dec 5 19:09:59 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.3: +9 -9 lines
Diff to previous 1.3 (colored)

- more err/errx -> fatal/fatalx, warn/warnx -> log_warn/log_warnx
	contains bits based on an old diff from Jacek Masiulaniec and
	other bits from me.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Dec 5 02:51:32 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.2: +52 -5 lines
Diff to previous 1.2 (colored)

- last part of the new queue code: the runner process (unprivileged and
	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.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Nov 5 12:14:45 2008 UTC (15 years, 7 months ago) by sobrado
Branch: MAIN
Changes since 1.1: +2 -0 lines
Diff to previous 1.1 (colored)

add a few missing id tags; there are a bunch of files, and developers
will probably miss this change when working on more important matters,
so it is probably better to sort them now.  there is a risk of losing
the tags if a change needs to be reverted too.

written with excellent advice from jmc@

ok gilles@

Revision 1.1 / (download) - annotate - [select for diffs], Sat Nov 1 21:35:28 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN

smtpd is a smtp server implementation for OpenBSD. It is a work in progress
which still lacks many features. bringing it in tree will help working on it
more easily.

"at this stage it should go in" henning@, "move ahead" deraadt@

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.