OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.442 / (download) - annotate - [select for diffs], Wed Mar 20 17:52:43 2024 UTC (2 months, 2 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.441: +2 -2 lines
Diff to previous 1.441 (colored)

fix ORCPT handling

due to a swapped strlcpy() arguments we don't save the ORCPT argument
after validation.  There's no buffer overflow since dsn_orcpt is zeroed.
Spotted by Tassilo Philipp, thanks!

ok millert gilles

Revision 1.441 / (download) - annotate - [select for diffs], Sun Jan 28 17:23:17 2024 UTC (4 months, 1 week ago) by op
Branch: MAIN
Changes since 1.440: +2 -2 lines
Diff to previous 1.440 (colored)

allow escaping inside quotes

RFC5322 allows for escapes using \ inside quotes.  Otherwise, headers
such as

	From: "\"Doe, John\"" <op>

get mangled as "\"Doe@localhost, John\" <op> since \ would be treated as
ordinary character and not the escape for the quote.

Bug reported by TobiasEgg on the OpenSMTPD-portable github repository.

ok millert@

Revision 1.440 / (download) - annotate - [select for diffs], Sat Jan 20 09:01:03 2024 UTC (4 months, 2 weeks ago) by claudio
Branch: MAIN
Changes since 1.439: +14 -12 lines
Diff to previous 1.439 (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.439 / (download) - annotate - [select for diffs], Wed Jan 3 08:11:15 2024 UTC (5 months ago) by op
Branch: MAIN
Changes since 1.438: +8 -9 lines
Diff to previous 1.438 (colored)

relax ORCPT syntax validation

We expected the ORCPT parameter to be a valid rfc822 address.  This is
wrong on multiple levels:

 - any other IANA-registered "addr-type" can be used
 - the parameter may be encoded and we didn't decode it prior validation
 - RFC3461 explicitly states that "[..] the address associated with the
   ORCPT keyword is NOT constrained to conform to the syntax rules for
   that 'addr-type'".

Instead, just validate the xtext and preserve the ORCPT value as-is.

Issue originally reported by Tim Kuijsten, Tassilo Philipp and others.

ok millert@

Revision 1.438 / (download) - annotate - [select for diffs], Sat Dec 23 10:29:05 2023 UTC (5 months, 2 weeks ago) by op
Branch: MAIN
Changes since 1.437: +12 -12 lines
Diff to previous 1.437 (colored)

remove trailing whitespaces

Revision 1.437 / (download) - annotate - [select for diffs], Fri Nov 3 13:38:28 2023 UTC (7 months ago) by op
Branch: MAIN
Changes since 1.436: +2 -2 lines
Diff to previous 1.436 (colored)

cast tv_usec to long for *printf

mostly for -portable; on darwin suseconds_t is an int.

ok tb@

Revision 1.436 / (download) - annotate - [select for diffs], Mon Oct 9 20:55:32 2023 UTC (7 months, 4 weeks ago) by millert
Branch: MAIN
Changes since 1.435: +2 -2 lines
Diff to previous 1.435 (colored)

Add Message-Id as needed for messages received on the submission port.

Since listener->port is in network byte order we need to compare
against htons(587).  The fix for this got dropped in the rewrite
in revision 1.335.

Revision 1.435 / (download) - annotate - [select for diffs], Fri Jun 23 18:32:28 2023 UTC (11 months, 2 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.434: +11 -4 lines
Diff to previous 1.434 (colored)

smtpd: allow arguments on NOOP

per RFC3521 ยง 4.1.1.9 the NOOP command allows optionally one argument
that SHOULD be ignored.  For semplicity, relax it to allow anything after it.

Original diff by Sebastian J. Bronner, GitHub PR 1150, tweaked by me to
add smtp_check_noop().

Gilles agrees, ok millert@

Revision 1.434 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months, 1 week ago) by op
Branch: MAIN
Changes since 1.433: +2 -1 lines
Diff to previous 1.433 (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.433 / (download) - annotate - [select for diffs], Thu Oct 20 01:16:04 2022 UTC (19 months, 2 weeks ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.432: +5 -3 lines
Diff to previous 1.432 (colored)

Display the correct recipient in a Received: header with one recipient.
If multiple recipients are specified but only one is valid, use the
first entry in the recipient list for the Received: header, not the
value from the last "RCPT TO:" command (which could be invalid).
From Chris Waddey

Revision 1.432 / (download) - annotate - [select for diffs], Thu Jul 1 07:42:16 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.431: +1 -6 lines
Diff to previous 1.431 (colored)

remove useless and confusing log message when client has no certificate

ok millert@

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

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

ok jung@

Revision 1.430 / (download) - annotate - [select for diffs], Thu May 20 07:33:32 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.429: +7 -2 lines
Diff to previous 1.429 (colored)

Call tls_accept_socket() and tls_connect_socket() immediatly instead of
going through a deferred event. It makes the code simplier and eliminates
the need to keep the listener tls context in the io structure.

ok tb@

Revision 1.429 / (download) - annotate - [select for diffs], Fri Mar 5 12:37:32 2021 UTC (3 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.428: +31 -131 lines
Diff to previous 1.428 (colored)

Start porting smtpd to libtls.

Note that it changes the way SNI works: The certificate to use is now
selected by looking at the names found in the certificates themselves,
rather than the names of the pki entries in the configuration file.
The set of certificates for a tls listener must be defined explicitly by
using the pki listener option multiple times.

ok tb@

Revision 1.428 / (download) - annotate - [select for diffs], Mon Dec 21 11:44:07 2020 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
Changes since 1.427: +3 -3 lines
Diff to previous 1.427 (colored)

Use NI_NUMERICSERV. We don't use the result and it's faster and is a
workaround for the memory-leak in asr.

smtp_session part from eric@
OK eric@ gilles@

Revision 1.427 / (download) - annotate - [select for diffs], Fri Nov 20 20:37:56 2020 UTC (3 years, 6 months ago) by jung
Branch: MAIN
Changes since 1.426: +3 -2 lines
Diff to previous 1.426 (colored)

partially revert revision 1.423 which went a bit too far

slightly relax the ORCPT check by not enforcing that a
domain is required, allowing e.g.: ORCPT=rfc822;root

originally reported via github issue #1084 by Leo Gaspard

with input from gilles
ok kn

Revision 1.426 / (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.425: +5 -1 lines
Diff to previous 1.425 (colored)

strip trailing CRs at smtp level rather than io level

ok millert@

Revision 1.425 / (download) - annotate - [select for diffs], Sun Mar 15 16:34:57 2020 UTC (4 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.424: +2 -2 lines
Diff to previous 1.424 (colored)

Add missing casts to unsigned char when using ctype(3).
From Hiltjo Posthuma

Revision 1.424 / (download) - annotate - [select for diffs], Mon Feb 3 15:53:52 2020 UTC (4 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.423: +5 -1 lines
Diff to previous 1.423 (colored)

ORCPT addresses are prefixed with an address type, the stricter check cause
the prefix to be rejected as it contains a character not allowed in address

reported by Scott Vanderbilt

Revision 1.423 / (download) - annotate - [select for diffs], Sat Feb 1 15:33:46 2020 UTC (4 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.422: +4 -2 lines
Diff to previous 1.422 (colored)

be much stricter about ORCPT, it isn't in the code path of local delivery
and doesn't have an associated context variable, but let's be paranoid.

ok millert@

Revision 1.415.2.1 / (download) - annotate - [select for diffs], Tue Jan 28 21:39:20 2020 UTC (4 years, 4 months ago) by gilles
Branch: OPENBSD_6_6
Changes since 1.415: +15 -17 lines
Diff to previous 1.415 (colored) next main 1.416 (colored)

this is errata 6.6/019_smtpd_exec.patch.sig

Revision 1.389.2.2 / (download) - annotate - [select for diffs], Tue Jan 28 21:38:28 2020 UTC (4 years, 4 months ago) by gilles
Branch: OPENBSD_6_5
Changes since 1.389.2.1: +15 -17 lines
Diff to previous 1.389.2.1 (colored) to branchpoint 1.389 (colored) next main 1.390 (colored)

this is errata 6.5/030_smtpd_exec.patch.sig

Revision 1.422 / (download) - annotate - [select for diffs], Tue Jan 28 21:35:00 2020 UTC (4 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.421: +15 -17 lines
Diff to previous 1.421 (colored)

Fix a security vulnerability discovered by Qualys which can lead to a
privileges escalation on mbox deliveries and unprivileged code execution
on lmtp deliveries, due to a logic issue causing a sanity check to be
missed.

ok eric@, millert@

Revision 1.421 / (download) - annotate - [select for diffs], Wed Jan 8 00:05:38 2020 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.420: +11 -10 lines
Diff to previous 1.420 (colored)

reorder reporting events so they are triggered _after_ protocol-server
events. this ensures that both smtp-in and smtp-out receive the events
in the same order.

Revision 1.420 / (download) - annotate - [select for diffs], Tue Jan 7 23:03:37 2020 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.419: +23 -3 lines
Diff to previous 1.419 (colored)

fix reporting of tx-mail and tx-rcpt for smtp-out

Revision 1.419 / (download) - annotate - [select for diffs], Fri Jan 3 22:01:29 2020 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.418: +2 -2 lines
Diff to previous 1.418 (colored)

upon return of authentication we log the username and generate an smtp-in
report for the authentication result, however we use a buffer that is too
small and usernames from virtual accounts may get truncated in logs.

reported by Bjorn Kalkbrenner

Revision 1.418 / (download) - annotate - [select for diffs], Sat Dec 21 10:23:37 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.417: +1 -5 lines
Diff to previous 1.417 (colored)

do not pass rdns, fcrdns, ss_src and ss_dest with IMSG_FILTER_SMTP_BEGIN,
but gather the information from the link-connect reporting event instead.
this removes redundant code and makes it easier to prepare for smtp-out.

Revision 1.417 / (download) - annotate - [select for diffs], Sat Dec 21 07:16:02 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.416: +219 -31 lines
Diff to previous 1.416 (colored)

do not generate smtp reports for unfiltered sessions, the events will be
discarded in lookup process anyways and this goes in the way of smtp-out
work

Revision 1.416 / (download) - annotate - [select for diffs], Mon Nov 25 14:18:33 2019 UTC (4 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.415: +2 -1 lines
Diff to previous 1.415 (colored)

store smtp session username in envelope and allow ruleset to match specific
users or mailaddr:

match auth "gilles@openbsd.org" [...]
match auth "@openbsd.org" [...]

ok eric@

Revision 1.415 / (download) - annotate - [select for diffs], Fri Oct 4 08:34:29 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.414: +1 -10 lines
Diff to previous 1.414 (colored)

remove strict \r check, the downside overweights the advantages, we'll
revisit a proper fix post release

committing on behalf of martijn@, ok eric@ and I

Revision 1.414 / (download) - annotate - [select for diffs], Thu Oct 3 05:08:21 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.413: +11 -7 lines
Diff to previous 1.413 (colored)

we should never hit the smtp reports with an s->tx set to NULL but better
be safe than sorry, check upfront

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

fix possible use-after-free in error code path

Revision 1.412 / (download) - annotate - [select for diffs], Sat Sep 21 09:01:52 2019 UTC (4 years, 8 months ago) by semarie
Branch: MAIN
Changes since 1.411: +1 -2 lines
Diff to previous 1.411 (colored)

remove dead assignment

ok gilles@

Revision 1.411 / (download) - annotate - [select for diffs], Thu Sep 19 16:00:59 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.410: +14 -7 lines
Diff to previous 1.410 (colored)

second attempt at fixing how we display inet6 addresses in smtpd. this diff
is simpler than my initial reverted attempt, corrects the likely reason for
the initial revert and has been running successfully for the day on my MX
with tons of incoming and outgoing inet6 trafic.

ok millert@

Revision 1.410 / (download) - annotate - [select for diffs], Wed Sep 11 04:19:19 2019 UTC (4 years, 8 months ago) by martijn
Branch: MAIN
Changes since 1.409: +5 -3 lines
Diff to previous 1.409 (colored)

Sprinkle around some __attribute__((__format__ (printf(...))).

OK gilles@

Revision 1.409 / (download) - annotate - [select for diffs], Wed Sep 4 07:28:27 2019 UTC (4 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.408: +19 -3 lines
Diff to previous 1.408 (colored)

introduce the 'junk' builtin filter action which marks a session or
transaction as junked when a filter matches. this with the maildir
junk option allows classifying messages in Spam folder instead of
rejecting/disconnecting.

ok semarie@, eric@, martijn@

Revision 1.408 / (download) - annotate - [select for diffs], Wed Aug 28 15:50:36 2019 UTC (4 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.407: +2 -1 lines
Diff to previous 1.407 (colored)

Add a link-greeting report. This allows us to get the active domain name
in use for the current request.

OK gilles@

Revision 1.407 / (download) - annotate - [select for diffs], Wed Aug 14 21:11:25 2019 UTC (4 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.406: +4 -20 lines
Diff to previous 1.406 (colored)

revert the inet6 format diff, regression observed by florian@

Revision 1.406 / (download) - annotate - [select for diffs], Tue Aug 13 16:02:33 2019 UTC (4 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.405: +20 -4 lines
Diff to previous 1.405 (colored)

use proper format to display inet6 addresses in logs as well as to store in
disk envelopes. smtpd used the Received and helo response format that isn't
valid in a relay url and looks wrong in logs.

spotted and tested ok@ by semarie

Revision 1.405 / (download) - annotate - [select for diffs], Sun Aug 11 16:35:10 2019 UTC (4 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.404: +25 -11 lines
Diff to previous 1.404 (colored)

fix rewrite action on filtering of MAIL FROM phase
basically the transaction must be created in the proceed function for the
mail from phase, not in the checking function, otherwise the second pass
in the check function will fail due to the tx already existing.

reported by Niklas Hallqvist <niklas@appli.se>

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

this introduces experimental proxy v2 support which is fairly isolated to a
single proxy.c file, importing it to work in tree

initial work from Antoine Kaufmann <toni@famkaufmann.info>

Revision 1.389.2.1 / (download) - annotate - [select for diffs], Thu Aug 1 23:09:35 2019 UTC (4 years, 10 months ago) by gilles
Branch: OPENBSD_6_5
Changes since 1.389: +10 -4 lines
Diff to previous 1.389 (colored)

smtpd can crash on excessively large input, causing a denial of service.
the crash is caused by a logic error leading to a fatal()

ok deraadt@ bluhm@ benno@

Revision 1.337.2.1 / (download) - annotate - [select for diffs], Thu Aug 1 23:09:12 2019 UTC (4 years, 10 months ago) by gilles
Branch: OPENBSD_6_4
Changes since 1.337: +10 -4 lines
Diff to previous 1.337 (colored) next main 1.338 (colored)

smtpd can crash on excessively large input, causing a denial of service.
the crash is caused by a logic error leading to a fatal()

ok deraadt@ bluhm@ benno@

Revision 1.403 / (download) - annotate - [select for diffs], Thu Aug 1 23:08:23 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.402: +10 -4 lines
Diff to previous 1.402 (colored)

smtpd can crash on excessively large input, causing a denial of service.
the crash is caused by a logic error leading to a fatal()

ok deraadt@ bluhm@ benno@

Revision 1.402 / (download) - annotate - [select for diffs], Fri Jul 26 06:30:13 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.401: +3 -3 lines
Diff to previous 1.401 (colored)

even though RSET can be issued outside a tx, RFC states it's noop outside a
transaction so rename link-reset to tx-reset and only issue the smtp report
when a reset _actually_ has a side-effect.

note that rset is implicit on a message commit or rollback, so tx-reset get
issued even though there was no explicit RSET. the filters are MUCH simpler
to write when you don't need to track every event that can reset a tx :-)

Revision 1.401 / (download) - annotate - [select for diffs], Wed Jul 24 19:50:10 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.400: +32 -31 lines
Diff to previous 1.400 (colored)

Two problems:
- RFC 2034 Section 3 (item 4) requires that the status code is always followed
  by one or more spaces. However, OpenSMTPD has a colon right after the status
  code in many of the replies it sends.
- RFC 2034 Section 4 states: "When responses are continued across multiple lines
  the same status code must appear at the beginning of the text in each line of
  the response." However, OpenSMTPD only has the enhanced status code for the
  last reply line it sends. Still, there is only one case in which it sends
  such a multi-line reply: the HELP command.

diff from Stephan Bosch

Revision 1.400 / (download) - annotate - [select for diffs], Thu Jul 11 21:40:03 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.399: +4 -1 lines
Diff to previous 1.399 (colored)

introduce link-auth to the smtp reporting stream so that filters may know
if a link has been authenticated successfully or not and for which user

Revision 1.399 / (download) - annotate - [select for diffs], Thu Jul 11 21:04:59 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.398: +3 -3 lines
Diff to previous 1.398 (colored)

modify link-identify so it reports if HELO or EHLO was used

Revision 1.398 / (download) - annotate - [select for diffs], Thu Jul 11 20:58:54 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.397: +3 -1 lines
Diff to previous 1.397 (colored)

introduce link-reset to let smtpd report resets happening in a session

Revision 1.397 / (download) - annotate - [select for diffs], Thu Jul 11 11:56:52 2019 UTC (4 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.396: +7 -3 lines
Diff to previous 1.396 (colored)

there are three ways to authenticate 'AUTH PLAIN', 'AUTH PLAIN <creds>' and
'AUTH LOGIN', this ensures all three have credentials obfuscated in smtp
reports

Revision 1.396 / (download) - annotate - [select for diffs], Wed Jul 10 19:53:52 2019 UTC (4 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.395: +5 -2 lines
Diff to previous 1.395 (colored)

obfuscate auth parameters in smtp reporting

Revision 1.395 / (download) - annotate - [select for diffs], Wed Jul 3 03:24:03 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.394: +2 -2 lines
Diff to previous 1.394 (colored)

snprintf/vsnprintf return < 0 on error, rather than -1.

Revision 1.394 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:51 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.393: +2 -2 lines
Diff to previous 1.393 (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.393 / (download) - annotate - [select for diffs], Thu Jun 27 13:10:48 2019 UTC (4 years, 11 months ago) by kili
Branch: MAIN
Changes since 1.392: +5 -5 lines
Diff to previous 1.392 (colored)

Move the check wether line is NULL above further accesses of it.

ok gilles@

Revision 1.392 / (download) - annotate - [select for diffs], Wed Jun 26 08:46:08 2019 UTC (4 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.391: +10 -1 lines
Diff to previous 1.391 (colored)

reject DATA containing <CR> that's not part of <CRLF> line terminators
as they are not allowed by RFC, have never been generated by a regular
MUA/MTA and can cause issues with some filters if we let them through.

ok jung@ on an earlier version of the diff, eric@ suggested the new diff

Revision 1.391 / (download) - annotate - [select for diffs], Wed Jun 12 17:42:53 2019 UTC (4 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.390: +9 -9 lines
Diff to previous 1.390 (colored)

change "ssl" to "tls" in various identifiers.
no functional change.

ok gilles@

Revision 1.390 / (download) - annotate - [select for diffs], Wed May 15 11:56:19 2019 UTC (5 years ago) by eric
Branch: MAIN
Changes since 1.389: +2 -2 lines
Diff to previous 1.389 (colored)

do not use CRLF when passing data lines to filters.

ok gilles@

Revision 1.389 / (download) - annotate - [select for diffs], Wed Feb 20 11:56:27 2019 UTC (5 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE
Branch point for: OPENBSD_6_5
Changes since 1.388: +2 -2 lines
Diff to previous 1.388 (colored)

fix a regression in the 'hostnames' mapping to select hostname based on the
IP address of a listener, it should use the listener address not the client
address as a selector, otherwise it will always display the default name if
you don't connect from the local host.

Revision 1.388 / (download) - annotate - [select for diffs], Wed Feb 6 07:45:43 2019 UTC (5 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.387: +16 -3 lines
Diff to previous 1.387 (colored)

in SMTP status, display rcpt address in errors happening at RCPT level

ok millert@, sunil@

Revision 1.387 / (download) - annotate - [select for diffs], Sat Jan 5 09:43:39 2019 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.386: +2 -1 lines
Diff to previous 1.386 (colored)

introduce smtp 'timeout' reporting event to notify filters that a timeout
occured during the smtp session

Revision 1.386 / (download) - annotate - [select for diffs], Sat Jan 5 08:38:41 2019 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.385: +7 -22 lines
Diff to previous 1.385 (colored)

move the DATA bytes accounting a bit earlier so that we don't have to deal
with it using special cases for when filters are enabled or not.

Revision 1.385 / (download) - annotate - [select for diffs], Thu Jan 3 15:46:07 2019 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.384: +9 -8 lines
Diff to previous 1.384 (colored)

be less verbose on resolver "errors", only log_warnx() real errors and not
EAI_NODATA / EAI_NONAME in cases where these are expected and already part
of a log line.

ok eric@

Revision 1.384 / (download) - annotate - [select for diffs], Thu Jan 3 14:40:25 2019 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.383: +1 -5 lines
Diff to previous 1.383 (colored)

do not strip dot-escaping when sending to filters, dot-escape is removed on
return otherwise there are cases which can lead to a truncated mail.

ok eric@

Revision 1.383 / (download) - annotate - [select for diffs], Fri Dec 28 11:35:25 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.382: +12 -12 lines
Diff to previous 1.382 (colored)

rename smtp_session's hostname field to rdns, to make it clear what it
stores and differentiate it further from smtpname and listener->hostname

ok eric@

Revision 1.382 / (download) - annotate - [select for diffs], Fri Dec 28 07:29:49 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.381: +37 -1 lines
Diff to previous 1.381 (colored)

move the smtp_mailaddr() calls _before_ filters indirection as filters MUST
only receive valid MAIL FROM and RCPT TO parameters.

Revision 1.381 / (download) - annotate - [select for diffs], Wed Dec 26 11:29:13 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.380: +6 -3 lines
Diff to previous 1.380 (colored)

when passing message to filters, do not worry yet about handling DATA
errors as this requires more work and is caught on stream back anyways

Revision 1.380 / (download) - annotate - [select for diffs], Sun Dec 23 16:37:53 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.379: +1 -192 lines
Diff to previous 1.379 (colored)

remove dead code

ok gilles@

Revision 1.379 / (download) - annotate - [select for diffs], Fri Dec 21 14:41:41 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.378: +54 -48 lines
Diff to previous 1.378 (colored)

start simplifying log lines, they're no longer intended to be parseable, we
have a reporting API for tools that want to analyze events, maillog is just
for us, hoomans.

similar work will be brought to other logs in upcoming diffs

ok eric@

Revision 1.378 / (download) - annotate - [select for diffs], Fri Dec 21 14:33:52 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.377: +15 -27 lines
Diff to previous 1.377 (colored)

bring in new grammar for filters, allowing filter chains and plugging of
different filters & chains on different interfaces.

in this diff, proc filters are still disabled as they're missing on very
important piece of logic.

ok eric@

Revision 1.377 / (download) - annotate - [select for diffs], Thu Dec 20 19:57:30 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.376: +2 -2 lines
Diff to previous 1.376 (colored)

the ciphers part of tls log lines doesn't need to be quoted, mta_session.c
has it right, make smtp_session.c use the same format

Revision 1.376 / (download) - annotate - [select for diffs], Thu Dec 20 17:57:44 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.375: +21 -1 lines
Diff to previous 1.375 (colored)

call smtp_check_noparam() on RSET, DATA, NOOP, QUIT, WIZ

Revision 1.375 / (download) - annotate - [select for diffs], Fri Dec 14 09:18:03 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.374: +114 -17 lines
Diff to previous 1.374 (colored)

use new cert helpers for incoming smtp sessions

ok gilles@

Revision 1.374 / (download) - annotate - [select for diffs], Wed Dec 12 21:27:49 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.373: +13 -5 lines
Diff to previous 1.373 (colored)

add tx-data reporting event

Revision 1.373 / (download) - annotate - [select for diffs], Wed Dec 12 10:50:04 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.372: +12 -5 lines
Diff to previous 1.372 (colored)

upon MAIL or RCPT errors, only trigger report_smtp_tx_{mail,rcpt} events if
error happened within an SMTP transaction.

Revision 1.372 / (download) - annotate - [select for diffs], Tue Dec 11 13:40:30 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.371: +8 -8 lines
Diff to previous 1.371 (colored)

do some imsg renaming to make them more clear

Revision 1.371 / (download) - annotate - [select for diffs], Tue Dec 11 13:29:52 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.370: +19 -19 lines
Diff to previous 1.370 (colored)

factor smtp-in and smtp-out reporting code

Revision 1.370 / (download) - annotate - [select for diffs], Tue Dec 11 11:29:44 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.369: +9 -1 lines
Diff to previous 1.369 (colored)

report filter responses to smtp

Revision 1.369 / (download) - annotate - [select for diffs], Tue Dec 11 10:31:45 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.368: +2 -1 lines
Diff to previous 1.368 (colored)

fix previous

ok gilles@

Revision 1.368 / (download) - annotate - [select for diffs], Tue Dec 11 08:40:56 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.367: +5 -1 lines
Diff to previous 1.367 (colored)

generate an event when a helo name identifies a link

Revision 1.367 / (download) - annotate - [select for diffs], Tue Dec 11 07:57:31 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.366: +7 -28 lines
Diff to previous 1.366 (colored)

remove unnecessary calls to getsockname()

ok gilles@

Revision 1.366 / (download) - annotate - [select for diffs], Sun Dec 9 17:37:15 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.365: +1 -2 lines
Diff to previous 1.365 (colored)

no longer pass rdns in all filtering requests, they can be retrieved from
the filter session.

Revision 1.365 / (download) - annotate - [select for diffs], Sun Dec 9 17:08:52 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.364: +3 -2 lines
Diff to previous 1.364 (colored)

unbreak builtin filters after last simplification in smtp_session

Revision 1.364 / (download) - annotate - [select for diffs], Sun Dec 9 16:37:51 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.363: +5 -1 lines
Diff to previous 1.363 (colored)

add client and listener address, as well as client rDNS and FCrDNS lookup
result to the filter_session structure upon filter session allocation. it
will allow me to simplify all filter hooks.

Revision 1.363 / (download) - annotate - [select for diffs], Sun Dec 9 15:26:03 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.362: +2 -2 lines
Diff to previous 1.362 (colored)

when doing the rDNS lookup, require getnameinfo to return a hostname not an
address by passing the NI_NAMREQD flag

ok eric@

Revision 1.362 / (download) - annotate - [select for diffs], Fri Dec 7 14:18:17 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.361: +12 -3 lines
Diff to previous 1.361 (colored)

properly handle EAI_NODATA and EAI_NONAME in fc-rdns lookups

ok eric@

Revision 1.361 / (download) - annotate - [select for diffs], Thu Dec 6 16:05:04 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.360: +2 -2 lines
Diff to previous 1.360 (colored)

link-connect event report had an empty fcrdns field, but now that eric@ has
plugged fcrdns in the smtp_session we can fill the field with a value

Revision 1.360 / (download) - annotate - [select for diffs], Thu Dec 6 15:32:06 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.359: +15 -2 lines
Diff to previous 1.359 (colored)

introduce tx-mail and tx-rcpt report events

Revision 1.359 / (download) - annotate - [select for diffs], Thu Dec 6 13:57:06 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.358: +15 -7 lines
Diff to previous 1.358 (colored)

allow passing data lines to proc filters

ok eric@

Revision 1.358 / (download) - annotate - [select for diffs], Thu Dec 6 12:09:50 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.357: +228 -17 lines
Diff to previous 1.357 (colored)

bring the first bits of DATA filtering plumbing but bypass it for now

ok eric@

Revision 1.357 / (download) - annotate - [select for diffs], Mon Dec 3 21:19:10 2018 UTC (5 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.356: +43 -3 lines
Diff to previous 1.356 (colored)

Perform forward-confirmed reverse DNS verification on incoming connections.
Only flag the session for now.

input from and ok gilles@ sunil@

Revision 1.356 / (download) - annotate - [select for diffs], Fri Nov 30 15:33:40 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.355: +2 -2 lines
Diff to previous 1.355 (colored)

prepare for smtp-out reporting and while at it, make a few changes to the
report format

Revision 1.355 / (download) - annotate - [select for diffs], Thu Nov 29 12:48:16 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.354: +30 -2 lines
Diff to previous 1.354 (colored)

introduce FILTER_COMMIT which will allow taking a decision at DATA commit
time, unusable yet but necessary for the upcoming serie of diffs.

ok eric@

Revision 1.354 / (download) - annotate - [select for diffs], Thu Nov 29 08:30:27 2018 UTC (5 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.353: +8 -9 lines
Diff to previous 1.353 (colored)

simplify

ok gilles@

Revision 1.353 / (download) - annotate - [select for diffs], Fri Nov 16 20:55:23 2018 UTC (5 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.352: +5 -7 lines
Diff to previous 1.352 (colored)

when using smtps, tls initialisation must occur after FILTER_CONNECTED
has been evaluated.

ok gilles@

Revision 1.352 / (download) - annotate - [select for diffs], Thu Nov 8 13:21:00 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.351: +4 -3 lines
Diff to previous 1.351 (colored)

when reporting tx events, report tx id
when reporting tx commit, report data size
report tx-envelope events

Revision 1.351 / (download) - annotate - [select for diffs], Wed Nov 7 17:45:01 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.350: +2 -1 lines
Diff to previous 1.350 (colored)

report "." as a protocol-client event, it is the commit command, not really
part of DATA

Revision 1.350 / (download) - annotate - [select for diffs], Sat Nov 3 14:53:44 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.349: +4 -4 lines
Diff to previous 1.349 (colored)

s->filter_phase and s->filter_param must be assigned earlier

Revision 1.349 / (download) - annotate - [select for diffs], Sat Nov 3 14:39:46 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.348: +17 -2 lines
Diff to previous 1.348 (colored)

only apply filter rules to filtered interfaces

Revision 1.348 / (download) - annotate - [select for diffs], Sat Nov 3 13:56:49 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.347: +2 -1 lines
Diff to previous 1.347 (colored)

check-rdns builtin filter, to be improved

Revision 1.347 / (download) - annotate - [select for diffs], Sat Nov 3 13:47:46 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.346: +15 -7 lines
Diff to previous 1.346 (colored)

bring plumbing for proc filters

ok millert@, eric@, jung@

Revision 1.346 / (download) - annotate - [select for diffs], Sat Nov 3 13:42:24 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.345: +250 -89 lines
Diff to previous 1.345 (colored)

bring plumbing for builtin filters

ok millert@, eric@, jung@

Revision 1.345 / (download) - annotate - [select for diffs], Fri Nov 2 17:20:22 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.344: +2 -2 lines
Diff to previous 1.344 (colored)

report rDNS in link connect event

Revision 1.344 / (download) - annotate - [select for diffs], Fri Nov 2 17:16:30 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.343: +4 -4 lines
Diff to previous 1.343 (colored)

smtp_report_link_connect() should be called from smtp_connected()

Revision 1.343 / (download) - annotate - [select for diffs], Fri Nov 2 16:50:23 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.342: +3 -3 lines
Diff to previous 1.342 (colored)

pass struct sockaddr_storage instead of ss_to_text() in reporting

Revision 1.342 / (download) - annotate - [select for diffs], Fri Nov 2 16:09:57 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.341: +4 -4 lines
Diff to previous 1.341 (colored)

report connection event earlier

Revision 1.341 / (download) - annotate - [select for diffs], Thu Nov 1 14:48:49 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.340: +13 -2 lines
Diff to previous 1.340 (colored)

teach smtp process how to report smtp events to lka and teach lka how to
report these events to a proc

ok millert@

Revision 1.340 / (download) - annotate - [select for diffs], Wed Oct 31 16:45:24 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.339: +19 -9 lines
Diff to previous 1.339 (colored)

smtp_tx_mail_from() and smtp_tx_rcpt_to() should take a const char *line

Revision 1.339 / (download) - annotate - [select for diffs], Wed Oct 31 16:40:35 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.338: +3 -1 lines
Diff to previous 1.338 (colored)

set a banner_sent flag in a session when banner was sent, this is noop as
of now but will reduce an upcoming diff

Revision 1.338 / (download) - annotate - [select for diffs], Wed Oct 31 15:13:21 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.337: +2 -2 lines
Diff to previous 1.337 (colored)

log tls events as "tls" not "starttls" it has confused people

Revision 1.337 / (download) - annotate - [select for diffs], Mon Sep 3 19:01:29 2018 UTC (5 years, 9 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE
Branch point for: OPENBSD_6_4
Changes since 1.336: +357 -208 lines
Diff to previous 1.336 (colored)

simplify the smtp_command() function by splitting cmd handlers into
two sets of functions smtp_check_<verb> and smtp_proceed_<verb>. we
use the check functions to validate that verb is acceptable at this
point of a session and proceed to actually move the session forward

ok eric@

Revision 1.336 / (download) - annotate - [select for diffs], Mon Sep 3 17:41:55 2018 UTC (5 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.335: +2 -2 lines
Diff to previous 1.335 (colored)

bump max line size

ok eric@

Revision 1.335 / (download) - annotate - [select for diffs], Fri Aug 31 07:28:27 2018 UTC (5 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.334: +153 -136 lines
Diff to previous 1.334 (colored)

switch to improved incoming message parser:
- simpler interface not using callbacks
- no hard-coded line length
- avoid unnecessary string copy

ok gilles@

Revision 1.334 / (download) - annotate - [select for diffs], Wed Jul 25 16:00:48 2018 UTC (5 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.333: +19 -23 lines
Diff to previous 1.333 (colored)

Implement a generic interface to forward resolver queries to the lka
process.  Use it for the reverse lookups required by smtp and mta.

Until now, DNS-related lookups were implemented using ad-hoc IMSGs
between the lka and other processes. It turns out to be confusing and
difficult to maintain/extend.  So we want to replace this with a better
set of IMSGs matching the standard resolver interface.

ok gilles@

Revision 1.333 / (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.332: +20 -24 lines
Diff to previous 1.332 (colored)

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

suggested by eric@, ok millert@

Revision 1.332 / (download) - annotate - [select for diffs], Mon Jun 18 18:14:39 2018 UTC (5 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.331: +8 -3 lines
Diff to previous 1.331 (colored)

split smtp_accept() in two parts: the accept part, the session init part,
while at it allow smtp_session() to receive a pre-allocated struct io

ok millert@
diff contributed by Antoine Kaufmann

Revision 1.331 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.330: +4 -4 lines
Diff to previous 1.330 (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.330 / (download) - annotate - [select for diffs], Thu May 10 07:21:47 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.329: +79 -97 lines
Diff to previous 1.329 (colored)

reorganize code

ok gilles@

Revision 1.329 / (download) - annotate - [select for diffs], Fri May 4 10:49:49 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.328: +2 -2 lines
Diff to previous 1.328 (colored)

fix use-after-free

Revision 1.328 / (download) - annotate - [select for diffs], Sun Apr 29 09:23:00 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.327: +10 -10 lines
Diff to previous 1.327 (colored)

remove useless indirections

Revision 1.327 / (download) - annotate - [select for diffs], Sun Apr 29 08:59:30 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.326: +65 -47 lines
Diff to previous 1.326 (colored)

move "mail from" and "rcpt to" code into their own function.

ok gilles@

Revision 1.326 / (download) - annotate - [select for diffs], Sat Apr 28 16:13:37 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.325: +11 -26 lines
Diff to previous 1.325 (colored)

simplify code

ok gilles@

Revision 1.325 / (download) - annotate - [select for diffs], Sat Apr 28 11:09:18 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.324: +138 -138 lines
Diff to previous 1.324 (colored)

move code around

Revision 1.324 / (download) - annotate - [select for diffs], Sat Apr 28 10:53:12 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.323: +18 -24 lines
Diff to previous 1.323 (colored)

use the transaction as argument to the message parser.

ok gilles@

Revision 1.323 / (download) - annotate - [select for diffs], Sat Apr 28 10:10:47 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.322: +62 -46 lines
Diff to previous 1.322 (colored)

pass transaction instead of session to smtp_message_*() functions.

ok gilles@

Revision 1.322 / (download) - annotate - [select for diffs], Sat Apr 28 08:58:36 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.321: +72 -72 lines
Diff to previous 1.321 (colored)

move code around. no functional change.

ok gilles@

Revision 1.321 / (download) - annotate - [select for diffs], Sat Apr 28 08:49:13 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.320: +45 -47 lines
Diff to previous 1.320 (colored)

pass a struct smtp_tx pointer to functions that apply to SMTP transactions,
rather than a struct smtp_session pointer. Tweak names while there.

ok gilles@

Revision 1.320 / (download) - annotate - [select for diffs], Fri Apr 27 15:16:12 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.319: +25 -32 lines
Diff to previous 1.319 (colored)

factorize code

ok gilles@

Revision 1.319 / (download) - annotate - [select for diffs], Wed Mar 14 22:02:51 2018 UTC (6 years, 2 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.318: +2 -2 lines
Diff to previous 1.318 (colored)

Message-Id header is not added if sent over submission port because the
port is stored in the listener structure using the network order.

ok eric@

Revision 1.318 / (download) - annotate - [select for diffs], Wed Mar 7 21:37:14 2018 UTC (6 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.317: +5 -1 lines
Diff to previous 1.317 (colored)

rfc4954 provides more than one method to submit the same credentials and in
a recent cleanup we accidentally removed one of the ways breaking some .net
lib apparently, sorry.

this commit reintroduces the "pass password in the same line as username"
method

ok millert@

Revision 1.317 / (download) - annotate - [select for diffs], Fri Feb 16 20:57:30 2018 UTC (6 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.316: +13 -5 lines
Diff to previous 1.316 (colored)

bump max line length to 16K for incoming mail.
SMTP commands are still limited to LINE_MAX.

ok gilles@

Revision 1.316 / (download) - annotate - [select for diffs], Fri Feb 9 09:29:03 2018 UTC (6 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.315: +27 -25 lines
Diff to previous 1.315 (colored)

isolate calls to the rfc2822 parser and handling of "." in smtp_dataline()

ok gilles@

Revision 1.315 / (download) - annotate - [select for diffs], Sat Nov 18 08:23:14 2017 UTC (6 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.314: +14 -93 lines
Diff to previous 1.314 (colored)

merge the masquerade and missing domain header callbacks into one function.

ok gilles@

Revision 1.314 / (download) - annotate - [select for diffs], Fri Oct 20 12:23:36 2017 UTC (6 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.313: +4 -3 lines
Diff to previous 1.313 (colored)

When adding a missing "Date" header, use the same timestamp as the "Received"
header for consistency.

ok gilles@

Revision 1.313 / (download) - annotate - [select for diffs], Thu Oct 19 19:50:32 2017 UTC (6 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.312: +1 -3 lines
Diff to previous 1.312 (colored)

remove useless initialisation

Revision 1.312 / (download) - annotate - [select for diffs], Fri Sep 8 16:51:22 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.311: +2 -2 lines
Diff to previous 1.311 (colored)

remove more filter-related cruft

ok gilles@

Revision 1.311 / (download) - annotate - [select for diffs], Fri Sep 8 07:34:50 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.310: +57 -50 lines
Diff to previous 1.310 (colored)

use plain values for transaction error codes rather than a bitmask.
rename ill-named "msgflags" to "error" while there.

ok gilles@

Revision 1.310 / (download) - annotate - [select for diffs], Fri Sep 1 20:49:49 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.309: +18 -40 lines
Diff to previous 1.309 (colored)

more code cleanup after filter removal

ok gilles@

Revision 1.309 / (download) - annotate - [select for diffs], Fri Sep 1 07:06:41 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.308: +1 -12 lines
Diff to previous 1.308 (colored)

the wait_filter_data session set is now pointless

Revision 1.308 / (download) - annotate - [select for diffs], Wed Aug 30 11:09:02 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.307: +7 -13 lines
Diff to previous 1.307 (colored)

rename smtp_filter_fd() to smtp_message_fd() and cleanup code.

ok gilles@

Revision 1.307 / (download) - annotate - [select for diffs], Wed Aug 30 07:11:25 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.306: +4 -4 lines
Diff to previous 1.306 (colored)

rename function

Revision 1.306 / (download) - annotate - [select for diffs], Wed Aug 30 06:43:42 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.305: +59 -199 lines
Diff to previous 1.305 (colored)

remove smtp_filter_*() indirections.

ok gilles@

Revision 1.305 / (download) - annotate - [select for diffs], Sun Aug 13 11:10:30 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.304: +30 -142 lines
Diff to previous 1.304 (colored)

bypass the filter code for incoming smtp sessions.
experimental support for filters has been removed from the config
parser already, and we want to get rid of the remaining code.

ok gilles@

Revision 1.304 / (download) - annotate - [select for diffs], Mon Jun 19 08:35:56 2017 UTC (6 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.303: +4 -4 lines
Diff to previous 1.303 (colored)

fix descriptor leak in the smtp congestion mechanism

diff from Henri Kemppainen; ok gilles@ eric@

Revision 1.303 / (download) - annotate - [select for diffs], Wed May 17 14:00:06 2017 UTC (7 years ago) by deraadt
Branch: MAIN
Changes since 1.302: +3 -5 lines
Diff to previous 1.302 (colored)

Introduce more use of freezero().  Also, remove ptr conditionals before
many functions which are free(NULL)-compat
ok gilles

Revision 1.302 / (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.301: +9 -9 lines
Diff to previous 1.301 (colored)

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

ok gilles@ sunil@

Revision 1.301 / (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.300: +61 -68 lines
Diff to previous 1.300 (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.300 / (download) - annotate - [select for diffs], Thu Nov 24 21:25:21 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.299: +5 -5 lines
Diff to previous 1.299 (colored)

add an io_paused() function.

ok gilles@

Revision 1.299 / (download) - annotate - [select for diffs], Thu Nov 24 20:52:13 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.298: +3 -3 lines
Diff to previous 1.298 (colored)

add an io_fileno() accessor

ok gilles@

Revision 1.298 / (download) - annotate - [select for diffs], Thu Nov 24 20:44:04 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.297: +9 -9 lines
Diff to previous 1.297 (colored)

add an io_ssl() accessor

ok gilles@

Revision 1.297 / (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.296: +2 -2 lines
Diff to previous 1.296 (colored)

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

ok gilles@

Revision 1.296 / (download) - annotate - [select for diffs], Thu Nov 24 07:57:48 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.295: +1 -25 lines
Diff to previous 1.295 (colored)

reset the io event when data is queued.
remove all calls to io_reload() which are now unnecessary.

ok gilles@ sunil@

Revision 1.295 / (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.294: +2 -6 lines
Diff to previous 1.294 (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.294 / (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.293: +18 -19 lines
Diff to previous 1.293 (colored)

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

ok sunil@ gilles@

Revision 1.293 / (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.292: +8 -4 lines
Diff to previous 1.292 (colored)

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

ok sunil@ gilles@

Revision 1.292 / (download) - annotate - [select for diffs], Fri Nov 18 09:35:27 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.291: +30 -23 lines
Diff to previous 1.291 (colored)

fix regression introduced in previous commit

spotted by Heiko Zimmermann

ok gilles@

Revision 1.291 / (download) - annotate - [select for diffs], Thu Nov 17 07:33:06 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.290: +22 -24 lines
Diff to previous 1.290 (colored)

remove IO_TLSVERIFIED which is not a io event, and inline necessary code
where the callback functions are called for this event.

ok gilles@

Revision 1.290 / (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.289: +8 -8 lines
Diff to previous 1.289 (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.289 / (download) - annotate - [select for diffs], Sun Oct 16 17:15:15 2016 UTC (7 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.288: +9 -26 lines
Diff to previous 1.288 (colored)

Remove the "phase" state variable from the smtp session.  Simply check
"helo[0]" to see if an HELO/EHLO command was received (reset after
starttls), and "tx" to know if we are in a transaction.

ok  gilles@ millert@

Revision 1.288 / (download) - annotate - [select for diffs], Thu Oct 13 15:47:32 2016 UTC (7 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.287: +3 -1 lines
Diff to previous 1.287 (colored)

A logic issue in smtpd's header parsing can cause SMTP sessions to hang.

diff by eric@, ok me

Revision 1.284.4.2 / (download) - annotate - [select for diffs], Thu Oct 13 15:46:05 2016 UTC (7 years, 7 months ago) by gilles
Branch: OPENBSD_6_0
Changes since 1.284.4.1: +3 -1 lines
Diff to previous 1.284.4.1 (colored) to branchpoint 1.284 (colored) next main 1.285 (colored)

"A logic issue in smtpd's header parsing can cause SMTP sessions to hang"
errata 014

Revision 1.268.2.2 / (download) - annotate - [select for diffs], Thu Oct 13 15:44:09 2016 UTC (7 years, 7 months ago) by gilles
Branch: OPENBSD_5_9
Changes since 1.268.2.1: +3 -1 lines
Diff to previous 1.268.2.1 (colored) to branchpoint 1.268 (colored) next main 1.269 (colored)

"A logic issue in smtpd's header parsing can cause SMTP sessions to hang."
errata 031

Revision 1.284.4.1 / (download) - annotate - [select for diffs], Tue Oct 4 00:12:27 2016 UTC (7 years, 8 months ago) by jsg
Branch: OPENBSD_6_0
Changes since 1.284: +3 -1 lines
Diff to previous 1.284 (colored)

OpenBSD 6.0 errata 10, Oct 3, 2016

A bug in the smtp session logic can lead to a server crash.
Found and reported by Mickael Torres.

Revision 1.287 / (download) - annotate - [select for diffs], Mon Oct 3 19:36:11 2016 UTC (7 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.286: +3 -1 lines
Diff to previous 1.286 (colored)

fix smtp session logic bug that can lead to a server crash.

Revision 1.286 / (download) - annotate - [select for diffs], Sat Sep 3 22:59:06 2016 UTC (7 years, 9 months ago) by giovanni
Branch: MAIN
Changes since 1.285: +46 -33 lines
Diff to previous 1.285 (colored)

log IP/hostname for all SMTP operations.
patch from Pavel Korovin, thanks
ok gilles@

Revision 1.285 / (download) - annotate - [select for diffs], Fri Jul 29 08:53:07 2016 UTC (7 years, 10 months ago) by giovanni
Branch: MAIN
Changes since 1.284: +10 -7 lines
Diff to previous 1.284 (colored)

log ip addresses as well in authentication phase
ok gilles@

Revision 1.284 / (download) - annotate - [select for diffs], Fri Jul 22 12:12:29 2016 UTC (7 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE
Branch point for: OPENBSD_6_0
Changes since 1.283: +79 -99 lines
Diff to previous 1.283 (colored)

Create a smtp transaction context on a session only for the duration of
that transaction.

ok gilles@

Revision 1.283 / (download) - annotate - [select for diffs], Sat Jul 2 09:32:30 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.282: +1 -5 lines
Diff to previous 1.282 (colored)

remove misleading comment. it's not true anymore.

ok gilles@

Revision 1.282 / (download) - annotate - [select for diffs], Sat Jul 2 08:47:30 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.281: +5 -7 lines
Diff to previous 1.281 (colored)

datain counter is part of the transaction state

ok gilles@

Revision 1.281 / (download) - annotate - [select for diffs], Sat Jul 2 07:55:59 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.280: +12 -9 lines
Diff to previous 1.280 (colored)

set the msgid on the transaction

ok gilles@ jung@

Revision 1.280 / (download) - annotate - [select for diffs], Fri Jul 1 19:52:31 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.279: +3 -3 lines
Diff to previous 1.279 (colored)

always refer to the helo string stored on the session

ok gilles@

Revision 1.279 / (download) - annotate - [select for diffs], Fri Jul 1 17:53:23 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.278: +2 -2 lines
Diff to previous 1.278 (colored)

flag the local socket listener as local.
clarify check for local listeners.

ok gilles@ millert@

Revision 1.278 / (download) - annotate - [select for diffs], Wed Jun 29 06:46:06 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.277: +35 -14 lines
Diff to previous 1.277 (colored)

Explicitely enclose SMTP transactions between BEGIN and COMMIT/ROLLBACK
filter events. Bump filter API version.

ok gilles@ jung@

Revision 1.277 / (download) - annotate - [select for diffs], Thu Jun 23 11:56:19 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.276: +191 -150 lines
Diff to previous 1.276 (colored)

move transaction-specific states from struct smtp_session to struct smtp_tx

ok gilles@

Revision 1.276 / (download) - annotate - [select for diffs], Fri Jun 17 18:56:51 2016 UTC (7 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.275: +2 -2 lines
Diff to previous 1.275 (colored)

Also add missing date or message-id when listening on the submit port
ok gilles@

Revision 1.275 / (download) - annotate - [select for diffs], Wed Jun 15 21:52:47 2016 UTC (7 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.274: +4 -1 lines
Diff to previous 1.274 (colored)

properly reset the transaction when a filter rejects a message.

ok gilles@

Revision 1.274 / (download) - annotate - [select for diffs], Wed Jun 15 19:56:07 2016 UTC (7 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.273: +2 -2 lines
Diff to previous 1.273 (colored)

'Received' header violates RFC when receiving a TLS session, rework format

reported by vstakhov

Revision 1.273 / (download) - annotate - [select for diffs], Wed Jun 8 06:52:56 2016 UTC (8 years ago) by gilles
Branch: MAIN
Changes since 1.272: +6 -6 lines
Diff to previous 1.272 (colored)

quote space-containing values in smtpd logs or they become hard to parse

diff by Pavel Korovin <p@tristero.se>, ok giovanni@

Revision 1.272 / (download) - annotate - [select for diffs], Sun May 22 16:31:21 2016 UTC (8 years ago) by gilles
Branch: MAIN
Changes since 1.271: +44 -36 lines
Diff to previous 1.271 (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.268.2.1 / (download) - annotate - [select for diffs], Mon May 16 19:29:13 2016 UTC (8 years ago) by gilles
Branch: OPENBSD_5_9
Changes since 1.268: +4 -1 lines
Diff to previous 1.268 (colored)

fix logic in error code path of smtp state machine that can lead to invalid
state and result in fatal(), while at it plug file pointer leak.

errata 006

ok eric@, millert@

Revision 1.271 / (download) - annotate - [select for diffs], Mon May 16 19:25:05 2016 UTC (8 years ago) by gilles
Branch: MAIN
Changes since 1.270: +4 -1 lines
Diff to previous 1.270 (colored)

fix logic in error code path of smtp state machine that can lead to an
invalid state ending in fatal(), while at it plug a file pointer leak.

ok eric@, millert@

Revision 1.270 / (download) - annotate - [select for diffs], Sun May 8 20:24:01 2016 UTC (8 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.269: +2 -2 lines
Diff to previous 1.269 (colored)

The "loop detected" message should not print the errno string.
OK gilles@

Revision 1.269 / (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.268: +2 -2 lines
Diff to previous 1.268 (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.268 / (download) - annotate - [select for diffs], Fri Feb 5 19:15:15 2016 UTC (8 years, 4 months ago) by jung
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE
Branch point for: OPENBSD_5_9
Changes since 1.267: +2 -2 lines
Diff to previous 1.267 (colored)

use SMTPD_NAME define

ok gilles

Revision 1.267 / (download) - annotate - [select for diffs], Thu Feb 4 20:27:33 2016 UTC (8 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.266: +22 -23 lines
Diff to previous 1.266 (colored)

Make code more readable by putting the message parsing logic in a single place.

ok gilles@ sunil@ jung@

Revision 1.266 / (download) - annotate - [select for diffs], Wed Feb 3 13:38:40 2016 UTC (8 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.265: +53 -35 lines
Diff to previous 1.265 (colored)

Add helpers function to talk to the queue. Make the code simpler.

ok gilles@ sunil@

Revision 1.265 / (download) - annotate - [select for diffs], Wed Feb 3 11:16:19 2016 UTC (8 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.264: +3 -1 lines
Diff to previous 1.264 (colored)

tell filters to rollback the current transaction if MAIL or EOM fails

ok gilles@ jung@

Revision 1.264 / (download) - annotate - [select for diffs], Mon Dec 28 22:08:30 2015 UTC (8 years, 5 months ago) by jung
Branch: MAIN
Changes since 1.263: +3 -3 lines
Diff to previous 1.263 (colored)

remove spaces after '!'

no binary change

ok millert

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

remove trailing whitespace

ok sunil gilles

Revision 1.262 / (download) - annotate - [select for diffs], Sun Dec 13 10:54:11 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.261: +269 -153 lines
Diff to previous 1.261 (colored)

refactor smtp_session to plug into the filters infrastructure

Revision 1.261 / (download) - annotate - [select for diffs], Sun Dec 13 10:33:42 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.260: +8 -4 lines
Diff to previous 1.260 (colored)

remove prototype to now unused function + pass fallback hint to lka

Revision 1.260 / (download) - annotate - [select for diffs], Sun Dec 13 09:52:44 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.259: +2 -36 lines
Diff to previous 1.259 (colored)

refactor a bit to move the SNI handling away from smtp_session into smtp

ok sunil@, jung@

Revision 1.259 / (download) - annotate - [select for diffs], Sat Dec 12 20:02:31 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.258: +14 -14 lines
Diff to previous 1.258 (colored)

remove CA from pki and no longer allow specifying a CA with 'pki' keyword.
introduce 'ca' keyword to allow specifying a custom CA.
making CA part of pki was a bad idea and several people hit use-cases that
plain couldn't work.

instead of:
    pki foobar.org ca "/etc/mail/CA.pem"

use now:
    ca foobar.org certificate "/etc/mail/CA.pem"


ok sunil@, jung@

Revision 1.258 / (download) - annotate - [select for diffs], Sat Dec 12 18:49:38 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.257: +6 -1 lines
Diff to previous 1.257 (colored)

when using senders map to restrict email address a user may use in SMTP
dialogue, if `masquerade' is used as a parameter then rewrite the email
address of the DATA From header to the email address in the map.

Revision 1.257 / (download) - annotate - [select for diffs], Sat Dec 12 18:42:58 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.256: +167 -1 lines
Diff to previous 1.256 (colored)

add the plumbing for masquerading

ok sunil@, jung@

Revision 1.256 / (download) - annotate - [select for diffs], Sat Dec 12 14:33:35 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.255: +3 -4 lines
Diff to previous 1.255 (colored)

rename enum value

Revision 1.255 / (download) - annotate - [select for diffs], Sat Dec 12 14:27:03 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.254: +8 -9 lines
Diff to previous 1.254 (colored)

remove whitespaces

Revision 1.254 / (download) - annotate - [select for diffs], Sat Dec 12 14:15:53 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.253: +2 -2 lines
Diff to previous 1.253 (colored)

do not limit smtp session username to LOGIN_NAME_MAX it could be a virtual
username

Revision 1.253 / (download) - annotate - [select for diffs], Sat Dec 12 14:01:56 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.252: +1 -3 lines
Diff to previous 1.252 (colored)

remove redundant check

Revision 1.252 / (download) - annotate - [select for diffs], Sat Dec 12 11:31:29 2015 UTC (8 years, 5 months ago) by sunil
Branch: MAIN
Changes since 1.251: +43 -5 lines
Diff to previous 1.251 (colored)

Implement senders map.

senders table allows to restrict the addresses that an authenticated
user can use in the SMTP dialogue.

Ok gilles@

Revision 1.251 / (download) - annotate - [select for diffs], Sat Dec 12 10:35:52 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.250: +5 -1 lines
Diff to previous 1.250 (colored)

add a log_trace() for debugging purposes

Revision 1.250 / (download) - annotate - [select for diffs], Sat Dec 12 10:33:21 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.249: +6 -1 lines
Diff to previous 1.249 (colored)

prepare struct smtp_session for handling of filters

Revision 1.249 / (download) - annotate - [select for diffs], Sat Dec 12 10:31:01 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.248: +4 -1 lines
Diff to previous 1.248 (colored)

add watermark define which will be needed for filters
add two session flags which will be needed for filters

Revision 1.248 / (download) - annotate - [select for diffs], Sat Dec 12 10:27:18 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.247: +7 -3 lines
Diff to previous 1.247 (colored)

if ca name not specified, pass hint to lka that a wildcard can match

Revision 1.247 / (download) - annotate - [select for diffs], Sat Dec 12 10:24:27 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.246: +5 -5 lines
Diff to previous 1.246 (colored)

declare and init filter wait queues (unused yet)

Revision 1.246 / (download) - annotate - [select for diffs], Sat Dec 12 10:22:39 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.245: +13 -1 lines
Diff to previous 1.245 (colored)

add filter_dataline prototype + empty function

Revision 1.245 / (download) - annotate - [select for diffs], Sat Dec 12 09:59:04 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.244: +4 -4 lines
Diff to previous 1.244 (colored)

fix prototypes

Revision 1.244 / (download) - annotate - [select for diffs], Fri Dec 11 21:44:01 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.243: +3 -3 lines
Diff to previous 1.243 (colored)

rename field member + whitespaces

Revision 1.243 / (download) - annotate - [select for diffs], Fri Dec 11 21:23:42 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.242: +5 -5 lines
Diff to previous 1.242 (colored)

rename header_masquerade_callback() to header_domain_append_callback(), the
name was confusing on what this function really does

Revision 1.242 / (download) - annotate - [select for diffs], Thu Dec 3 21:11:33 2015 UTC (8 years, 6 months ago) by jung
Branch: MAIN
Changes since 1.241: +3 -6 lines
Diff to previous 1.241 (colored)

introduce limit session keyword replacing fixed values

original diff from Renaud Allard

ok gilles

Revision 1.241 / (download) - annotate - [select for diffs], Tue Dec 1 18:22:30 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.240: +9 -1 lines
Diff to previous 1.240 (colored)

add received-auth parameter to listener to identify authenticated sessions
in locally appended Received header when enabled

ok millert@, jung@

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

mechanical rename of some IMSG constants

ok sunil@, ok jung@

Revision 1.239 / (download) - annotate - [select for diffs], Thu Nov 5 08:55:09 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.238: +3 -1 lines
Diff to previous 1.238 (colored)

when a message consists solely of headers and does not end them with an
empty line, the message parser gets confused, and forgets to flush last
header to message file.

detect if we're still in headers when hitting EOM, and flush if that is
the case.

reported by Philipp Takacs <philipp@bureaucracy.de>

ok millert@, jung@, sunil@, eric@

Revision 1.238 / (download) - annotate - [select for diffs], Wed Oct 21 16:44:28 2015 UTC (8 years, 7 months ago) by jsing
Branch: MAIN
Changes since 1.237: +3 -2 lines
Diff to previous 1.237 (colored)

Only enable SSL_VERIFY_PEER when the verify option is set on a listener.

Always enabling SSL_VERIFY_PEER unnecessarily increases the number of
messages/bytes in the TLS handshake and increases our attack surface,
since we request and then process client certificates.

ok gilles@

Revision 1.237 / (download) - annotate - [select for diffs], Fri Oct 16 21:13:33 2015 UTC (8 years, 7 months ago) by sthen
Branch: MAIN
Changes since 1.236: +2 -2 lines
Diff to previous 1.236 (colored)

Use SSL_get_version() not SSL_get_cipher_version(); the former gives the TLS
version used for the connection, the latter gives "the SSL/TLS protocol version
that first defined the cipher". Fixes "TLS version=TLSv1/SSLv3" in received/log
lines.

ok millert@ "I was going to commit this today, so yes definitely" ok gilles@

Revision 1.236 / (download) - annotate - [select for diffs], Tue Oct 13 11:32:47 2015 UTC (8 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.235: +62 -78 lines
Diff to previous 1.235 (colored)

Add a helper for writing the message to simplify the code.
It also fixes the reported message length by taking prepended
headers into account and adds missing error checks there.

ok millert@ gilles@

Revision 1.235 / (download) - annotate - [select for diffs], Mon Oct 12 20:16:31 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.234: +12 -1 lines
Diff to previous 1.234 (colored)

add Date header when a session iniated locally doesn't add one

ok millert@, ok eric@

Revision 1.215.4.2 / (download) - annotate - [select for diffs], Fri Oct 2 01:33:33 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_6
Changes since 1.215.4.1: +85 -39 lines
Diff to previous 1.215.4.1 (colored) to branchpoint 1.215 (colored) next main 1.216 (colored)

Errata 031:
fix multiple security and reliability issues found during an audit by
Qualys Security

Revision 1.227.2.2 / (download) - annotate - [select for diffs], Fri Oct 2 01:28:43 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_7
Changes since 1.227.2.1: +85 -39 lines
Diff to previous 1.227.2.1 (colored) to branchpoint 1.227 (colored) next main 1.228 (colored)

Errata 017:
fix multiple security and reliability issues found during an audit by
Qualys Security

Revision 1.230.4.1 / (download) - annotate - [select for diffs], Fri Oct 2 00:55:02 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_8
Changes since 1.230: +85 -39 lines
Diff to previous 1.230 (colored) next main 1.231 (colored)

Errata 004:
fix multiple security and reliability issues found during an audit by
Qualys Security

Revision 1.234 / (download) - annotate - [select for diffs], Fri Oct 2 00:44:30 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.233: +85 -39 lines
Diff to previous 1.233 (colored)

detect that a certificate chain will not fit in imsg calls before passing
part of it and failing others, this may leave the lookup process in a weird
state and cause use-after-free and out-of-bounds memory reads, leading to
crashes or potential arbitrary code execution in unprivileged process.

reported by Qualys Security

Revision 1.233 / (download) - annotate - [select for diffs], Mon Sep 7 15:36:53 2015 UTC (8 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.232: +23 -1 lines
Diff to previous 1.232 (colored)

when bypassing the enqueuer, insert Message-Id header if none was found and
the client has connected from a loopback interface.

ok millert@ eric@

Revision 1.232 / (download) - annotate - [select for diffs], Thu Sep 3 05:10:19 2015 UTC (8 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.231: +4 -38 lines
Diff to previous 1.231 (colored)

the session kicking mechanism has an accounting bug leading to some legit
sessions being kicked if they generate too many consecutive errors.
remove the mechanism altogether until it is redesigned.

Revision 1.231 / (download) - annotate - [select for diffs], Sat Aug 15 17:27:43 2015 UTC (8 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.230: +2 -7 lines
Diff to previous 1.230 (colored)

assume messages use 8bit bytes by default, not just when 8BITMIME extension
is used, this is what the world expects, this is what other MTA do.

Revision 1.230 / (download) - annotate - [select for diffs], Fri May 15 07:34:45 2015 UTC (9 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE
Branch point for: OPENBSD_5_8
Changes since 1.229: +11 -3 lines
Diff to previous 1.229 (colored)

the code to prevent AUTH PLAIN from logging credentials upon authentication
failure does not catch the AUTH LOGIN case. rework to use the session state
rather than using the session command.

spotted by pkern@debian.org

Revision 1.227.2.1 / (download) - annotate - [select for diffs], Sun Apr 19 20:30:33 2015 UTC (9 years, 1 month ago) by gilles
Branch: OPENBSD_5_7
Changes since 1.227: +19 -11 lines
Diff to previous 1.227 (colored)

Incorrect logic in smtpd(8) can lead to unexpected client disconnect, invalid
certificate in SNI negotiation or server crash.

spotted by Edwin Torok

Revision 1.215.4.1 / (download) - annotate - [select for diffs], Sun Apr 19 20:30:06 2015 UTC (9 years, 1 month ago) by gilles
Branch: OPENBSD_5_6
Changes since 1.215: +19 -11 lines
Diff to previous 1.215 (colored)

Incorrect logic in smtpd(8) can lead to unexpected client disconnect, invalid
certificate in SNI negotiation or server crash.

spotted by Edwin Torok

Revision 1.196.2.1 / (download) - annotate - [select for diffs], Sun Apr 19 20:29:43 2015 UTC (9 years, 1 month ago) by gilles
Branch: OPENBSD_5_5
Changes since 1.196: +19 -10 lines
Diff to previous 1.196 (colored) next main 1.197 (colored)

Incorrect logic in smtpd(8) can lead to unexpected client disconnect, invalid
certificate in SNI negotiation or server crash.

spotted by Edwin Torok

Revision 1.229 / (download) - annotate - [select for diffs], Sun Apr 19 20:29:12 2015 UTC (9 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.228: +19 -11 lines
Diff to previous 1.228 (colored)

Incorrect logic in smtpd(8) can lead to unexpected client disconnect, invalid
certificate in SNI negotiation or server crash.

spotted by Edwin Torok

Revision 1.228 / (download) - annotate - [select for diffs], Mon Apr 6 13:47:00 2015 UTC (9 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.227: +6 -6 lines
Diff to previous 1.227 (colored)

remove superfluous ';' in Received lines

Revision 1.227 / (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_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.226: +14 -14 lines
Diff to previous 1.226 (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.226 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:21 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.225: +2 -1 lines
Diff to previous 1.225 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.225 / (download) - annotate - [select for diffs], Wed Jan 14 08:50:32 2015 UTC (9 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.224: +23 -17 lines
Diff to previous 1.224 (colored)

bring back reverted commits, the crash was unrelated

Revision 1.224 / (download) - annotate - [select for diffs], Sun Jan 11 18:25:54 2015 UTC (9 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.223: +17 -23 lines
Diff to previous 1.223 (colored)

revert two latest commits until a crash is fixed

Revision 1.223 / (download) - annotate - [select for diffs], Wed Jan 7 18:28:12 2015 UTC (9 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.222: +5 -4 lines
Diff to previous 1.222 (colored)

fix ctype casting bug spotted by Jonas 'Sortie' Termansen

Revision 1.222 / (download) - annotate - [select for diffs], Tue Jan 6 10:31:09 2015 UTC (9 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.221: +20 -15 lines
Diff to previous 1.221 (colored)

move the message parser init earlier to avoid a possible use after free in
an unlikely error code path

Revision 1.221 / (download) - annotate - [select for diffs], Wed Dec 17 15:49:23 2014 UTC (9 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.220: +2 -2 lines
Diff to previous 1.220 (colored)

Use log_warnx() not log_warn() for mail loop warning since errno
is not set.  OK gilles@

Revision 1.220 / (download) - annotate - [select for diffs], Sun Nov 2 21:46:03 2014 UTC (9 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.219: +6 -1 lines
Diff to previous 1.219 (colored)

increment s->datalen counter in append domain code to correctly account for
the data we wrote

Revision 1.219 / (download) - annotate - [select for diffs], Sun Nov 2 21:13:32 2014 UTC (9 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.218: +155 -51 lines
Diff to previous 1.218 (colored)

rework domain append by locating either the brackets or the last component
of an address and appending domain if not already there. this works better
than trying to parse addresses and render them back, while allowing us to
do the append "in place" and cope nicely with multi-line addresses.

Revision 1.218 / (download) - annotate - [select for diffs], Wed Oct 15 08:09:02 2014 UTC (9 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.217: +163 -29 lines
Diff to previous 1.217 (colored)

when From, To and Cc headers present users without domains, append the
listener hostname to avoid smtpd relaying a header that will be rewritten
by the destination MX.

ok eric@

Revision 1.217 / (download) - annotate - [select for diffs], Sat Oct 4 08:43:24 2014 UTC (9 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.216: +14 -1 lines
Diff to previous 1.216 (colored)

some MUA will bypass the local enqueuer and send an empty BCC header in the
DATA part of the SMTP transaction. force smtpd to strip these headers when
it sees them.

Revision 1.216 / (download) - annotate - [select for diffs], Thu Oct 2 21:27:54 2014 UTC (9 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.215: +9 -10 lines
Diff to previous 1.215 (colored)

when no domain is specified in MAIL FROM or RCPT TO, assume local user

Revision 1.215 / (download) - annotate - [select for diffs], Wed Jul 9 12:44:54 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE
Branch point for: OPENBSD_5_6
Changes since 1.214: +10 -6 lines
Diff to previous 1.214 (colored)

add a "no-dsn" listener option to disable DSN extension.

Revision 1.214 / (download) - annotate - [select for diffs], Tue Jul 8 20:14:46 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.213: +14 -14 lines
Diff to previous 1.213 (colored)

get rid of mfa leftovers

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

fix typos.

ok jmc@

Revision 1.212 / (download) - annotate - [select for diffs], Fri Jul 4 15:24:46 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.211: +27 -5 lines
Diff to previous 1.211 (colored)

It makes much more sense to do the loop checking on incoming mails rather
than on outgoing mails...

ok gilles@

Revision 1.211 / (download) - annotate - [select for diffs], Sat May 17 20:07:54 2014 UTC (10 years ago) by chl
Branch: MAIN
Changes since 1.210: +2 -1 lines
Diff to previous 1.210 (colored)

add missing header needed by str* and mem* functions

ok gilles@

Revision 1.210 / (download) - annotate - [select for diffs], Tue Apr 29 19:13:13 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.209: +5 -10 lines
Diff to previous 1.209 (colored)

Implement RSA privilege separation for OpenSMTPD, based on my previous
implementation for relayd(8).  The smtpd(8) pony processes (mta
client, smtp server) don't keep the private keys in memory but send
their private key operations as imsgs to the "lookup"/mta process.
It's worth mentioning that this prevents acidental private key leakage
as it could have been caused by "Heartbleed".

ok gilles@

Revision 1.209 / (download) - annotate - [select for diffs], Tue Apr 29 12:18:27 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.208: +2 -5 lines
Diff to previous 1.208 (colored)

Remove unused arguments from ssl_smtp_init()

ok gilles@

Revision 1.208 / (download) - annotate - [select for diffs], Tue Apr 29 10:18:06 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.207: +3 -3 lines
Diff to previous 1.207 (colored)

use explicit_bzero() instead of memset() to clear out sensitive data.

ok gilles@

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

knf

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

add a missing strlcpy() check in MAIL FROM's DSN parameters parsing, the
truncation would lead to a failure later in the code path but we can fail
earlier with a nice enhanced status code

Revision 1.205 / (download) - annotate - [select for diffs], Sat Apr 19 16:56:34 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.204: +5 -5 lines
Diff to previous 1.204 (colored)

(void) cast strlcpy() calls that cannot truncate (copies between buffers of
	same size with a truncation check on the initial buffer)

Revision 1.204 / (download) - annotate - [select for diffs], Sat Apr 19 16:52:20 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.203: +2 -2 lines
Diff to previous 1.203 (colored)

(void) cast a strlcpy() that cannot truncate because lka.c ensures the
	reply will fit in the buffer before returning the answer

Revision 1.203 / (download) - annotate - [select for diffs], Sat Apr 19 16:50:28 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.202: +2 -2 lines
Diff to previous 1.202 (colored)

(void) cast strlcpy() that cannot truncate, dns.c ensures the reply will
	fit in the buffer before returning the answer

Revision 1.202 / (download) - annotate - [select for diffs], Sat Apr 19 16:44:01 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.201: +9 -9 lines
Diff to previous 1.201 (colored)

(void) cast strlcpy() calls that cannot truncate or where the source data
	has a length check right before the copy

Revision 1.201 / (download) - annotate - [select for diffs], Sat Apr 19 16:26:23 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.200: +2 -2 lines
Diff to previous 1.200 (colored)

(void) cast a snprintf() call that cannot truncate

Revision 1.200 / (download) - annotate - [select for diffs], Wed Apr 9 18:55:19 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.199: +82 -79 lines
Diff to previous 1.199 (colored)

Zap the mfa process. It is not currently doing anything, and content filtering
will be done at session level anyway.

ok gilles@

Revision 1.199 / (download) - annotate - [select for diffs], Wed Apr 9 12:47:23 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.198: +2 -2 lines
Diff to previous 1.198 (colored)

remove useless define for banner

ok gilles@

Revision 1.198 / (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.197: +53 -50 lines
Diff to previous 1.197 (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.197 / (download) - annotate - [select for diffs], Fri Mar 14 11:14:11 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.196: +3 -2 lines
Diff to previous 1.196 (colored)

more informative log message on unknown SNI.

looks better to tedu@, ok gilles@

Revision 1.196 / (download) - annotate - [select for diffs], Mon Feb 17 11:06:54 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE
Branch point for: OPENBSD_5_5
Changes since 1.195: +13 -5 lines
Diff to previous 1.195 (colored)

do not lookup pki based on hostname if one was specified for the listener
otherwise we may fail to find it and reject client.

Revision 1.195 / (download) - annotate - [select for diffs], Tue Feb 4 15:44:05 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.194: +206 -54 lines
Diff to previous 1.194 (colored)

Add support for DSN and Enhanced Status Code

Revision 1.194 / (download) - annotate - [select for diffs], Tue Feb 4 13:44:41 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.193: +76 -32 lines
Diff to previous 1.193 (colored)

pki code cleanup

- rename "struct ssl" and "cert" to "struct pki" and "cert" to "pki_name"
- inherit pki conf on fork instead of passing it through imsg at startup
- implement SNI on smtp listeners

Revision 1.193 / (download) - annotate - [select for diffs], Tue Feb 4 09:50:31 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.192: +6 -5 lines
Diff to previous 1.192 (colored)

add base64_encode/base64_decode helpers

Revision 1.192 / (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.191: +9 -9 lines
Diff to previous 1.191 (colored)

bcopy -> memmove
bzero -> memset

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

better response

Revision 1.190 / (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.189: +2 -2 lines
Diff to previous 1.189 (colored)

unsigned char casts for ctype
ok gilles@

Revision 1.189 / (download) - annotate - [select for diffs], Mon Nov 18 12:24:26 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.188: +4 -0 lines
Diff to previous 1.188 (colored)

Allow overriding the local ca

Revision 1.188 / (download) - annotate - [select for diffs], Wed Nov 6 10:01:29 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.187: +93 -21 lines
Diff to previous 1.187 (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.187 / (download) - annotate - [select for diffs], Mon Oct 28 17:02:08 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.186: +14 -8 lines
Diff to previous 1.186 (colored)

Report the ssl certificate verification status in the mail header.
Log ssl certificate validation errors.
Fix several ssl-related leaks.

Revision 1.186 / (download) - annotate - [select for diffs], Sun Oct 27 11:01:47 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.185: +3 -11 lines
Diff to previous 1.185 (colored)

Make the filter infrastructure move forward.
This is a work-in-progress and it's not supposed to be useable for now.

Revision 1.185 / (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.184: +2 -2 lines
Diff to previous 1.184 (colored)

%i -> %d in format strings

Revision 1.184 / (download) - annotate - [select for diffs], Fri Jul 19 21:18:54 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.183: +49 -12 lines
Diff to previous 1.183 (colored)

When accepting a message, log one line per recipient with the number of
generated envelopes for each.

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.182 / (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.181: +9 -9 lines
Diff to previous 1.181 (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.181 / (download) - annotate - [select for diffs], Thu Feb 21 14:22:52 2013 UTC (11 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.180: +8 -4 lines
Diff to previous 1.180 (colored)

do not send disconnect event to the mfa if connect event was not sent.

ok gilles@

Revision 1.180 / (download) - annotate - [select for diffs], Sat Feb 16 16:20:07 2013 UTC (11 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.179: +2 -2 lines
Diff to previous 1.179 (colored)

only use local hostname in Received lines if listener has not overriden it,
otherwise use the listener hostname

ok eric@

Revision 1.179 / (download) - annotate - [select for diffs], Fri Feb 15 17:36:08 2013 UTC (11 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.178: +5 -3 lines
Diff to previous 1.178 (colored)

terminate session instead of fatal() if getsockname() fails.

ok gilles@

Revision 1.178 / (download) - annotate - [select for diffs], Tue Feb 5 11:45:18 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.177: +3 -2 lines
Diff to previous 1.177 (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.177 / (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.176: +1251 -964 lines
Diff to previous 1.176 (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.176 / (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.175: +41 -25 lines
Diff to previous 1.175 (colored)

knf

ok gilles@

Revision 1.175 / (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.174: +42 -17 lines
Diff to previous 1.174 (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.174 / (download) - annotate - [select for diffs], Fri Nov 2 19:30:57 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.173: +26 -5 lines
Diff to previous 1.173 (colored)

Add a "kick counter" that gets incremented on each command, to detect
clients that don't do their best to do something useful, and just hog
the session.  When that kick counter reaches the limit, the client is
disconnected.  The counter is reset after the first HELO/EHLO command,
after tls is established, after a succesful authentication, and after
a message is accepted. It is decremented when a RCPT is accepted.

ok gilles@

Revision 1.173 / (download) - annotate - [select for diffs], Sun Oct 28 08:46:26 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.172: +15 -1 lines
Diff to previous 1.172 (colored)

Limit the number of messages that can be enqueued on a single SMTP
connection, and the number of recipients in each of them.

ok gilles@ chl@

Revision 1.172 / (download) - annotate - [select for diffs], Thu Oct 11 21:24:51 2012 UTC (11 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.171: +2 -2 lines
Diff to previous 1.171 (colored)

- ssize_t -> size_t

spotted with clang, ok eric@ and chl@

Revision 1.171 / (download) - annotate - [select for diffs], Tue Oct 9 20:33:02 2012 UTC (11 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.170: +16 -1 lines
Diff to previous 1.170 (colored)

- allow a listen statement to impose tls on its clients;
- make listen statements impose authentication if 'auth' is specified and
	to make it optional if 'auth-optional' is specified;
- sync documentation accordingly

with ideas and input from beck@ and halex@, ok eric@

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

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

ok gilles@

Revision 1.169 / (download) - annotate - [select for diffs], Fri Sep 14 19:22:04 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.168: +12 -9 lines
Diff to previous 1.168 (colored)

Remove s_ssl from the smtp session since it is duplicated in the io struct.
Change ssl_session_init to ssl_smtp_init and make it simpler:  only create
an SSL* from the SSL_CTX* passed as parameter, so it does not have to know
about the struct session itself.  Kill some dead prototypes while there.

ok chl@ gilles@

Revision 1.168 / (download) - annotate - [select for diffs], Sat Aug 25 10:23:12 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.167: +10 -10 lines
Diff to previous 1.167 (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.167 / (download) - annotate - [select for diffs], Fri Aug 24 18:46:46 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.166: +7 -4 lines
Diff to previous 1.166 (colored)

When an smtp session fails and IMSG_QUEUE_REMOVE_MESSAGE is sent to the
queue, also notify the scheduler so it can rollback the current update.
Send only the msgid while there.

ok gilles@

Revision 1.166 / (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.165: +4 -4 lines
Diff to previous 1.165 (colored)

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

ok eric@

Revision 1.165 / (download) - annotate - [select for diffs], Sat Aug 18 18:18:23 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.164: +13 -16 lines
Diff to previous 1.164 (colored)

- introduce stat_backend, an API for pluggable statistic backends
  > statistics are no longer static structures in shared memory
  > statistics are only set, smtpd never uses them in its logic
  > each statistic is a key/value where key can be any (dynamic) string
- convert all uses of the former API to use the new one
- implement stat_ramstat that keeps non-persistent stats in ram structure

ok eric@, ok chl@

Revision 1.164 / (download) - annotate - [select for diffs], Sat Aug 18 16:05:54 2012 UTC (11 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.163: +3 -3 lines
Diff to previous 1.163 (colored)

Disallow empty domain/address sent after HELO/EHLO command.

ok gilles@ eric@

Revision 1.163 / (download) - annotate - [select for diffs], Fri Aug 10 11:05:55 2012 UTC (11 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.162: +8 -1 lines
Diff to previous 1.162 (colored)

Move mta and smtp specific defines into their own files.
Some formatting cleanups while there.

ok gilles@

Revision 1.162 / (download) - annotate - [select for diffs], Tue May 8 11:52:57 2012 UTC (12 years, 1 month ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.161: +14 -38 lines
Diff to previous 1.161 (colored)

fix and re-enable connect notification to the mfa.
filtering now occurs before setting up ssl on smtps connections.

ok chl@ gilles@

Revision 1.161 / (download) - annotate - [select for diffs], Sun Jan 29 16:51:00 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.160: +3 -3 lines
Diff to previous 1.160 (colored)

For some reason, all recipients are rejected if the msg field is not
initialized here. Fix it, but this requires further investigation.

ok gilles@

Revision 1.160 / (download) - annotate - [select for diffs], Sun Jan 29 15:33:08 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.159: +8 -1 lines
Diff to previous 1.159 (colored)

disable connection filter hook for now. fixes smtps.

ok gilles@

Revision 1.159 / (download) - annotate - [select for diffs], Sun Jan 29 11:37:32 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.158: +197 -266 lines
Diff to previous 1.158 (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.158 / (download) - annotate - [select for diffs], Fri Jan 27 00:01:04 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.157: +1 -4 lines
Diff to previous 1.157 (colored)

that log_debug is no longer needed

Revision 1.157 / (download) - annotate - [select for diffs], Thu Jan 26 23:59:28 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.156: +8 -10 lines
Diff to previous 1.156 (colored)

in session_read_data() do NOT enable back read event otherwise it will
corrupt the session and cause a fatal.

reported by Roman Kravchuk, with this diff in OpenSMTPD survives again the
evil smtp_tester.py :-p

Revision 1.156 / (download) - annotate - [select for diffs], Thu Jan 26 23:18:08 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.155: +4 -6 lines
Diff to previous 1.155 (colored)

Do not call session_respond() AND session_imsg() from the same handler as
they are exclusive. In the quit handler, it will lead to a corrupted
session as the F_QUIT is set and session_respond() will kill the session
before session_imsg() is done.

For now, comment session_imsg(IMSG_MFA_QUIT) as we don't have filters
enabled anyways. The proper fix will be to have session_imsg() called
from the handler THEN upon return in smtp process do the session_respond()
call.

Fixes a segv reported by Roman Kravchuk. While at it, revert my last commit
in session_error() which was probably needed because of this bug.

Revision 1.155 / (download) - annotate - [select for diffs], Sat Jan 21 19:50:30 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.154: +5 -2 lines
Diff to previous 1.154 (colored)

in session_error(), do not call session_destroy() when the F_WRITEONLY
session flag is set, set F_QUIT instead.

fixes a "corrupted session" fatalx() that triggers when a client
disconnects after sending the end of message '.' but without waiting
for server to acknowledge.

reported by Roman Kravchuk <kravchuk.kp@gmail.com> a while ago, could not
reproduce until today.

Revision 1.154 / (download) - annotate - [select for diffs], Wed Jan 18 13:41:54 2012 UTC (12 years, 4 months ago) by chl
Branch: MAIN
Changes since 1.153: +34 -6 lines
Diff to previous 1.153 (colored)

Add new filters callbacks for:
- network events (CONNECT/CLOSE)
- commands (QUIT/RSET)

ok gilles@ eric@

Revision 1.153 / (download) - annotate - [select for diffs], Fri Jan 13 14:27:55 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.152: +12 -12 lines
Diff to previous 1.152 (colored)

remove the status field from struct envelope, move it to the smtp
session, and cleanup the DS_* flags.

ok gilles@ chl@

Revision 1.152 / (download) - annotate - [select for diffs], Thu Jan 12 12:57:26 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.151: +6 -6 lines
Diff to previous 1.151 (colored)

alter line contents before writing it, rather than after...

ok gilles@

Revision 1.151 / (download) - annotate - [select for diffs], Mon Dec 12 17:20:36 2011 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.150: +82 -37 lines
Diff to previous 1.150 (colored)

add a session_enter_state() function to change the state of an smtp
session and allow those state changes to be traced (add traces flags
for upcoming changes while there).

ok chl@ gilles@

Revision 1.150 / (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.149: +38 -38 lines
Diff to previous 1.149 (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.149 / (download) - annotate - [select for diffs], Mon Oct 3 19:20:51 2011 UTC (12 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.148: +6 -5 lines
Diff to previous 1.148 (colored)

- fix a segv caused by a deep recursion introduced with a recent quick-fix
  and triggering if clients sent a large number of DATA lines in one write

Revision 1.148 / (download) - annotate - [select for diffs], Wed Sep 28 18:19:10 2011 UTC (12 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.147: +6 -2 lines
Diff to previous 1.147 (colored)

removing annoying debug log

Revision 1.147 / (download) - annotate - [select for diffs], Mon Sep 12 20:47:15 2011 UTC (12 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.146: +9 -5 lines
Diff to previous 1.146 (colored)

- introduce filtermask in struct smtpd
- do not forward lines to mfa when FILTER_DATALINE is not set in filtermask

prevents smtpd from handling mails slowly while I'm hacking on filters
support

Revision 1.146 / (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.145: +2 -4 lines
Diff to previous 1.145 (colored)

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

ok gilles@ chl@

Revision 1.145 / (download) - annotate - [select for diffs], Thu Sep 1 09:42:15 2011 UTC (12 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.144: +1 -3 lines
Diff to previous 1.144 (colored)

- if no filter is setup, do not overwrite the data line with filtmsg buffer
- remove annoying debug lines
- disable back filters at smtpd.conf level

committing on behalf of gilles@

Revision 1.144 / (download) - annotate - [select for diffs], Wed Aug 31 18:56:30 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.143: +33 -8 lines
Diff to previous 1.143 (colored)

add support for per-line DATA callbacks, this allows filters to take their
decisions *while* the message is being received by the client.

Revision 1.143 / (download) - annotate - [select for diffs], Sat Aug 27 22:32:41 2011 UTC (12 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.142: +38 -29 lines
Diff to previous 1.142 (colored)

initial support for a session-time filtering API

currently only HELO/EHLO, MAIL, RCPT are supported, however ... I have
voluntarily disabled filters at smtpd.conf level so people don't play with
it until the API has stabilized a bit

discussed with several people in private, no one opposed the feature

Revision 1.142 / (download) - annotate - [select for diffs], Mon May 16 21:05:52 2011 UTC (13 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.141: +39 -38 lines
Diff to previous 1.141 (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.141 / (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.140: +28 -28 lines
Diff to previous 1.140 (colored)

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

discussed with and ok gilles@

Revision 1.140 / (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.139: +58 -59 lines
Diff to previous 1.139 (colored)

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

Revision 1.139 / (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.138: +11 -12 lines
Diff to previous 1.138 (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.138 / (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.137: +3 -8 lines
Diff to previous 1.137 (colored)

remove all unused headers

Revision 1.137 / (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.136: +3 -1 lines
Diff to previous 1.136 (colored)

a bit of .h cleanups, no functionnal change

Revision 1.136 / (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.135: +57 -48 lines
Diff to previous 1.135 (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.135 / (download) - annotate - [select for diffs], Tue Jun 1 23:06:23 2010 UTC (14 years ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.134: +48 -57 lines
Diff to previous 1.134 (colored)

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.133 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.132: +48 -57 lines
Diff to previous 1.132 (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.132 / (download) - annotate - [select for diffs], Sat Apr 24 19:16:11 2010 UTC (14 years, 1 month ago) by chl
Branch: MAIN
Changes since 1.131: +2 -3 lines
Diff to previous 1.131 (colored)

fix format string

while there, print SIZE unconditonnally (prompted by gilles@)

ok gilles@

Revision 1.131 / (download) - annotate - [select for diffs], Wed Apr 21 20:32:57 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.130: +4 -37 lines
Diff to previous 1.130 (colored)

my evbuffer_readln_crlf() hack can be killed now that nicm@ has brought us
an update to libevent that ships with evbuffer_readln(). beers for nicm@ !

Revision 1.130 / (download) - annotate - [select for diffs], Mon Apr 19 10:26:40 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.129: +31 -28 lines
Diff to previous 1.129 (colored)

initial support for ENHANCEDSTATUSCODES, has been sitting in my tree for
a month or so

Revision 1.129 / (download) - annotate - [select for diffs], Mon Apr 19 10:12:48 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.128: +16 -1 lines
Diff to previous 1.128 (colored)

basic support for SIZE extension, has been sitting in my tree for a month
or so ...

okayd by jacekm@ a while ago

Revision 1.128 / (download) - annotate - [select for diffs], Thu Dec 31 15:37:55 2009 UTC (14 years, 5 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.127: +10 -2 lines
Diff to previous 1.127 (colored)

when separating command from parameters in smtp session, the parser tries
to use ':' as a separator then fallbacks to ' ' so that it can detect the
command names that contain more than one words (MAIL FROM and RCPT TO) or
the one word ones (HELO, DATA, ...).

this is incorrect and the parser can get confused if the parameter to any
command contains a ':', for example "HELO [ipv6:...]" cause the parser to
lookup for command "HELO [ipv6".

fix this by using ':' as a delimiter for 'mail from' and 'rcpt to', while
using ' ' as a delimiter for all other commands.

fixes bug 6285/system reported by Lionel Le Folgoc <lionel@lefolgoc.net>

Revision 1.127 / (download) - annotate - [select for diffs], Sun Dec 13 22:02:55 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.126: +9 -10 lines
Diff to previous 1.126 (colored)

Use safe fd limits in smtp, lka, queue, and control.  Removes a
possibility for fd-starvation fatal when under heavy load.

Revision 1.126 / (download) - annotate - [select for diffs], Mon Nov 16 10:38:11 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.125: +10 -24 lines
Diff to previous 1.125 (colored)

Kill dead code.

Revision 1.125 / (download) - annotate - [select for diffs], Fri Nov 13 11:40:06 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.124: +5 -3 lines
Diff to previous 1.124 (colored)

Log all 4yz and 5yz replies that we send to our clients.

Revision 1.124 / (download) - annotate - [select for diffs], Fri Nov 13 11:37:27 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.123: +3 -2 lines
Diff to previous 1.123 (colored)

Include recipient address in "Recipient rejected" reply.

Revision 1.123 / (download) - annotate - [select for diffs], Thu Nov 5 23:30:01 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.122: +37 -3 lines
Diff to previous 1.122 (colored)

evbuffer_readline() assumes end of line to be \r, \n, \r\n, \n\r or \r\r.
smtp protocol expects lines to end with \r\n.

if a client sends a very long line which is unfortunately read up to \r,
evbuffer_readline() will return the line, then will detect another line
when the buffer is filled again and starts with \n, returning again with
an empty line. this is a bug which trigger very rarely and usually shows
up as an empty line in the middle of headers, causing all subsequent
headers to appear as part of the body to most mail user agents.

upstream fixes this with evbuffer_readln() in version 2.0 of libevent, a
mail will be sent to see if they can backport it, meanwhile we fix it by
introducing evbuffer_readln_crlf().

discussed with and ok jacekm@

Revision 1.122 / (download) - annotate - [select for diffs], Mon Oct 19 20:48:13 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.121: +2 -1 lines
Diff to previous 1.121 (colored)

currently, smtpd is capable of having multiple listeners with different
options but they will all share the same ruleset. this means that there
is no way to have a rule apply to a session established on one listener
but not applied on another.

this commit brings initial support for tagging listeners and having the
rules able to match these specific listeners. The following will define
a rule which will only apply to interfaces tagged as "mynet":

listen on lo0			# implicit lo0 tag
listen on fxp0 tag mynet
listen on fxp1 tag mynet

accept on mynet for domain "example.org" deliver to mbox

Revision 1.121 / (download) - annotate - [select for diffs], Tue Oct 6 18:20:44 2009 UTC (14 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.120: +6 -1 lines
Diff to previous 1.120 (colored)

disallow AUTH once a session is in progress, this prevents a fatal from
being triggered in smtp process when client sends AUTH after MAIL.

bug reported and fix tested by James Turner <james@bsdgroup.org>

Revision 1.120 / (download) - annotate - [select for diffs], Sat Sep 12 12:24:51 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.119: +21 -26 lines
Diff to previous 1.119 (colored)

Simplify line len checking: use one limit for all SMTP exchanges.
This is not as strict as various RFCs want it, but we can make it
more granular later.  For now, let all mails flow by using the
maximum of all limits found in the RFCs.
ok gilles@

Revision 1.119 / (download) - annotate - [select for diffs], Sat Sep 12 09:50:31 2009 UTC (14 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.118: +3 -3 lines
Diff to previous 1.118 (colored)

fix a wrong computation in session_readline() where the length of line was
deduced from the buffer size prior and after evbuffer_readline() call. the
problem is that this accounts for the characters which evbuffer_readline()
removed and we do not know how many they were (\n, \r\n ..). fix just does
a strlen() call of line which is a bit slower but way safer.

This could very well fix the broken headers issue some people reported

Revision 1.118 / (download) - annotate - [select for diffs], Sat Sep 12 09:38:45 2009 UTC (14 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.117: +3 -2 lines
Diff to previous 1.117 (colored)

cmdlinetoolong stat was incremented at the wrong place, fix

Revision 1.117 / (download) - annotate - [select for diffs], Sat Sep 12 09:22:33 2009 UTC (14 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.116: +5 -4 lines
Diff to previous 1.116 (colored)

- fix a compile time warning
- add a new stats counter to distinguish between command lines which
  exceeded the limit and data lines which exceeded the limits

Revision 1.116 / (download) - annotate - [select for diffs], Sat Sep 12 09:01:19 2009 UTC (14 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.115: +2 -3 lines
Diff to previous 1.115 (colored)

replace a fwrite || fwrite construct with a fprintf which achieves the same
while being less error prone

Revision 1.115 / (download) - annotate - [select for diffs], Tue Sep 1 15:23:02 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.114: +15 -1 lines
Diff to previous 1.114 (colored)

Log all 4yz/5yz responses we send when in debug mode; ok gilles@

Revision 1.114 / (download) - annotate - [select for diffs], Wed Aug 12 13:32:19 2009 UTC (14 years, 10 months ago) by jacekm
Branch: MAIN
Changes since 1.113: +20 -12 lines
Diff to previous 1.113 (colored)

Fix unwanted rejects by parsing (and ignoring) AUTH=<...> MAIL
command argument.  Testers, you want this.
Committing on gilles@'s behalf.

Revision 1.113 / (download) - annotate - [select for diffs], Sat Aug 8 00:02:22 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.112: +4 -4 lines
Diff to previous 1.112 (colored)

import some changes from portable smtpd to reduce the delta between both.
this commit contains mostly missing casts and cosmethic changes, do not
expect to build this anywhere but on OpenBSD, it does not contain any of
the portable glue.

Revision 1.112 / (download) - annotate - [select for diffs], Fri Aug 7 21:59:01 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.111: +2 -2 lines
Diff to previous 1.111 (colored)

smtp_session: ssl/ssl.h -> openssl/ssl.h

Revision 1.111 / (download) - annotate - [select for diffs], Fri Aug 7 20:21:48 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.110: +5 -6 lines
Diff to previous 1.110 (colored)

we were linking to libkeynote to use kn_base64_encode/decode, but honestly
this was a ugly hack, and i'd rather include resolv.h and use __b64_encode
and __b64_decode as openssh does. this commit kills all references to
libkeynote in smtpd, should help a bit with porting ... no functionnal
change.

Revision 1.110 / (download) - annotate - [select for diffs], Thu Aug 6 17:09:13 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.109: +3 -2 lines
Diff to previous 1.109 (colored)

in smtp_session, fix logging so that when we accepted an empty envelope for
the sender, we dont log 'from=<@>' but from=<> instead

Revision 1.109 / (download) - annotate - [select for diffs], Sat Aug 1 15:33:28 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.108: +2 -6 lines
Diff to previous 1.108 (colored)

when receiving characters with the most significant bit set over a session
not flagged with F_8BITMIME, clear the bit instead of permanently erroring
the whole message. some mta's do not always request 8BITMIME when they are
sending messages which are not 8bit clean, this lets us be less strict for
them while not violating RFC ourselves.

ok jacekm@

Revision 1.108 / (download) - annotate - [select for diffs], Sun Jul 19 19:06:02 2009 UTC (14 years, 10 months ago) by jacekm
Branch: MAIN
Changes since 1.107: +2 -2 lines
Diff to previous 1.107 (colored)

fix fwrite return code checking.
bug exposed by recent change to fwrite, and reported by oga.
ok gilles

Revision 1.107 / (download) - annotate - [select for diffs], Sat Jun 6 04:14:21 2009 UTC (15 years ago) by pyr
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.106: +3 -3 lines
Diff to previous 1.106 (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.106 / (download) - annotate - [select for diffs], Fri Jun 5 20:43:57 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (colored)

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

Revision 1.105 / (download) - annotate - [select for diffs], Mon Jun 1 14:53:18 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.104: +9 -1 lines
Diff to previous 1.104 (colored)

display ssl negociation information in the received line of incoming
sessions; ok jacekm@

Revision 1.104 / (download) - annotate - [select for diffs], Sun May 31 18:34:48 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.103: +2 -2 lines
Diff to previous 1.103 (colored)

when entering mta_connect() reset session fd to -1
when connect timesout and we close the fd, reset session fd to -1
in session_destroy(), only attempt to close session fd if != -1

fixes a fatal in session_destroy() which happened because we closed a fd
after a timeout, but the session still assumed the fd to be opened.

Revision 1.103 / (download) - annotate - [select for diffs], Sat May 30 16:22:07 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.102: +19 -10 lines
Diff to previous 1.102 (colored)

fix a bug where sessions_active counter, used to compute accept limits, was
decremented below 0 after the recent change that moved stats to shared mmap
memory. session_destroy() which is called from mta and smtp processes didnt
differentiate between them and decremented the counter when we had outgoing
sessions destroyed.

Revision 1.102 / (download) - annotate - [select for diffs], Thu May 28 08:50:08 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.101: +5 -2 lines
Diff to previous 1.101 (colored)

Log the incoming message size; ok gilles@

Revision 1.101 / (download) - annotate - [select for diffs], Thu May 28 08:48:46 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.100: +12 -3 lines
Diff to previous 1.100 (colored)

Log the "for <foo@bar.com>" part in the Received field; ok gilles@

Revision 1.100 / (download) - annotate - [select for diffs], Wed May 27 13:14:18 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.99: +7 -1 lines
Diff to previous 1.99 (colored)

Insert Received: at receive time instead of delivery time; ok gilles@

Revision 1.99 / (download) - annotate - [select for diffs], Wed May 27 13:11:39 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.98: +10 -5 lines
Diff to previous 1.98 (colored)

After a successful AUTH command completes, reject any further AUTH commands.

ok gilles@

Revision 1.98 / (download) - annotate - [select for diffs], Wed May 27 13:09:07 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.97: +60 -12 lines
Diff to previous 1.97 (colored)

request flood mitigation:
1) each state may have 2 responses sent quickly;
2) more responses are delayed exponentially, up to a defined limit.

Delay count is user visible (smtp.errors.delays).

ok gilles@

Revision 1.97 / (download) - annotate - [select for diffs], Mon May 25 13:29:47 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.96: +1 -5 lines
Diff to previous 1.96 (colored)

Recent event masking scheme change turned the S_GREETED and S_HELO cases
in session_pickup into unreached code, so remove them; ok gilles@

Revision 1.96 / (download) - annotate - [select for diffs], Sun May 24 15:47:31 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.95: +97 -106 lines
Diff to previous 1.95 (colored)

Parent process shouldn't be base64-decoding untrusted strings, move
this code to privsep smtp process; ok gilles@

Revision 1.95 / (download) - annotate - [select for diffs], Sun May 24 14:58:43 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.94: +16 -16 lines
Diff to previous 1.94 (colored)

Implement pipelining detection inside session_readline, makes the calling
code cleaner; ok gilles@

Revision 1.94 / (download) - annotate - [select for diffs], Sun May 24 14:22:24 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.93: +14 -16 lines
Diff to previous 1.93 (colored)

Instead of keeping stats private to each process, and querying every
process individually whenever stats need to be fetched, keep stats
in MAP_ANON shared memory allocated by parent.

This means control has direct access to stats and can respond very
quickly without troubling any other daemon processes.

ok gilles@

Revision 1.93 / (download) - annotate - [select for diffs], Wed May 20 16:12:11 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.92: +4 -3 lines
Diff to previous 1.92 (colored)

Delay enabling of EV_READ until S_INIT (smtps) or S_TLS (starttls).
ok gilles@

Revision 1.92 / (download) - annotate - [select for diffs], Wed May 20 14:29:44 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.91: +23 -3 lines
Diff to previous 1.91 (colored)

first step towards configuration reload in smtpd, smtpctl reload will parse
the configuration file again and replace current configuration with new one
in all processes. what we don't support yet is graceful restart, clients in
sessions at the moment of the reload will have a temp failure thrown at 'em
which is ok RFC-wise but which we will try to improve anyway.

tested with various setups, "diff reads good" jacekm@

Revision 1.91 / (download) - annotate - [select for diffs], Tue May 19 12:33:53 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.90: +6 -1 lines
Diff to previous 1.90 (colored)

Accept STARTTLS only after EHLO; ok gilles@

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

- Don't advertise nor accept STARTTLS command when session is secure.
- Make the condition when STARTTLS and AUTH are advertised & accepted
more readable.

ok gilles@

Revision 1.89 / (download) - annotate - [select for diffs], Mon May 18 20:23:35 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.88: +241 -150 lines
Diff to previous 1.88 (colored)

Complete rework of bufferevent event masking allowing for  more
strictness:
- Drop clients attempting command pipelining; protects the daemon
from all kinds of abuse.
- Replace F_EVLOCKED flag with F_WRITEONLY which has cleaner sematics:
when up, session must not be destroyed nor read from, but may be
written to.
- Write callback becomes a central place for enabling EV_READ.
- Delay bufferevent creation until after ssl handshake is completed.

A bunch of session error stats were added to smtpctl's "show stats".
These could help spotting event masking errors in the future.

ok gilles@

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

use the nitems() macro where appropriate

ok gilles@, jacekm@

Revision 1.87 / (download) - annotate - [select for diffs], Thu May 14 08:29:37 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 (colored)

correct function name in fatal

Revision 1.86 / (download) - annotate - [select for diffs], Sun May 10 14:24:19 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.85: +3 -2 lines
Diff to previous 1.85 (colored)

use both read and write timeout arguments in the bufferevent_settimeout
call; ok gilles@

Revision 1.85 / (download) - annotate - [select for diffs], Sun May 10 13:06:23 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.84: +5 -5 lines
Diff to previous 1.84 (colored)

use rfc number 4954 in auth_plain handler name, rfc 4616 is implied
because rfc 4954 references it.

Revision 1.84 / (download) - annotate - [select for diffs], Sun May 10 11:29:40 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.83: +6 -13 lines
Diff to previous 1.83 (colored)

assert copyright; ok gilles@

Revision 1.83 / (download) - annotate - [select for diffs], Sun May 10 11:23:04 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

RFC 4954 says the response to "AUTH PLAIN" must be "334 ", not "334";
ok gilles@

Revision 1.82 / (download) - annotate - [select for diffs], Sat May 9 23:23:38 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.81: +5 -5 lines
Diff to previous 1.81 (colored)

correct AUTH PLAIN rfc number, no functional change.

Revision 1.81 / (download) - annotate - [select for diffs], Sat May 9 20:03:07 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.80: +13 -13 lines
Diff to previous 1.80 (colored)

give few states more meaningful names; ok gilles@

Revision 1.80 / (download) - annotate - [select for diffs], Sat May 9 18:59:09 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

fix function names in log_debug

Revision 1.79 / (download) - annotate - [select for diffs], Tue Apr 28 21:56:45 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.78: +3 -18 lines
Diff to previous 1.78 (colored)

don't use strlcpy before calling a function that uses strlcpy
internally anyway; ok gilles@

Revision 1.78 / (download) - annotate - [select for diffs], Tue Apr 28 21:55:16 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.77: +11 -24 lines
Diff to previous 1.77 (colored)

make S_DATAREQUEST state similar to S_{MAIL,RCPT}REQUEST; ok gilles@

Revision 1.77 / (download) - annotate - [select for diffs], Mon Apr 27 20:17:21 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.76: +3 -11 lines
Diff to previous 1.76 (colored)

kill 2-line session_msg_submit, used just once; ok gilles@ long ago.

Revision 1.76 / (download) - annotate - [select for diffs], Mon Apr 27 16:20:34 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.75: +17 -26 lines
Diff to previous 1.75 (colored)

session_cleanup call in MAIL FROM handler may be removed as a
consequence of rev. 1.70. This makes session_destroy the only
caller so merge the two; ok gilles@

Revision 1.75 / (download) - annotate - [select for diffs], Mon Apr 27 16:10:20 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.74: +8 -4 lines
Diff to previous 1.74 (colored)

Disable EV_READ when setting F_QUIT flag up. Malicious client may
send more commands after QUIT, these must not be processed; ok gilles@

Revision 1.74 / (download) - annotate - [select for diffs], Fri Apr 24 15:26:59 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.73: +1 -4 lines
Diff to previous 1.73 (colored)

in session_pickup, do not handle S_RCPT state, it must never be
called in this state; ok gilles@

Revision 1.73 / (download) - annotate - [select for diffs], Fri Apr 24 09:38:11 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

Enclose common imsg handling code in a function, which additionally
does some sanity checking. Fix a bug that could lead to fatal under
rare circumstances, exposed by this newly added check; ok gilles@

Revision 1.72 / (download) - annotate - [select for diffs], Fri Apr 24 08:35:48 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.71: +8 -59 lines
Diff to previous 1.71 (colored)

use same timeout at each session state, and make use of
bufferevent_settimeout instead of rolling our own; ok gilles@

Revision 1.71 / (download) - annotate - [select for diffs], Fri Apr 24 08:32:12 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.70: +4 -12 lines
Diff to previous 1.70 (colored)

kill unnecessary struct message_recipient; ok gilles@

Revision 1.70 / (download) - annotate - [select for diffs], Mon Apr 20 18:48:23 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.69: +6 -1 lines
Diff to previous 1.69 (colored)

Allow MAIL FROM only in the S_HELO state, which results in behaviour
dictated by rfc in "4.1.4 Order of commands".

pointed out and initial diff by pea@, ok gilles@

Revision 1.69 / (download) - annotate - [select for diffs], Mon Apr 20 17:40:38 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.68: +6 -8 lines
Diff to previous 1.68 (colored)

fix previous, evtimer_set should be called only once, in session_init.

Revision 1.68 / (download) - annotate - [select for diffs], Mon Apr 20 17:07:01 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.67: +35 -37 lines
Diff to previous 1.67 (colored)

Rewrite smtp session timeouts; use evtimer_* from event(3) instead
of regularly walking session tree in search of idle clients. Gives
the smtp process a chance to become idle.

As a bonus, add smtp.sessions.timeout counter to "smtpctl show stats".

ok gilles@

Revision 1.67 / (download) - annotate - [select for diffs], Sun Apr 19 12:48:27 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.66: +49 -34 lines
Diff to previous 1.66 (colored)

Wrap the EV_READ+EVLOCKED dance in one well documented function.
Additionally, check that EVLOCKED is not already set, which would
indicate an attempt to send IMSG w/o waiting for reply for some
other IMSG sent earlier.

ok gilles@

Revision 1.66 / (download) - annotate - [select for diffs], Thu Apr 16 15:35:06 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.65: +3 -2 lines
Diff to previous 1.65 (colored)

Total rewrite of the sendmail interface. Adds support for -t, -v,
and -F cmdline args. Also, date and Message-Id headers are added
when missing.

The main trouble with the current enqueue code is that it requires
dealing with problems in the control process that are already solved
in the smtp process, ie. duplicating a lot of code which interacts
with untrusted clients. This diff solves this by making sendmail
obtain a SMTP socket from smtp via smtpd.sock, and using that socket
to deliver the message. For smtpd it looks as if connection was
made from the network, only difference being the F_MESSAGE_ENQUEUED
message flag, handy when differentation between local and remote
deliveries is wanted.

Most of the features come from the femail program, created by henning@.

Additional testing by Nigel J. Taylor.

ok gilles@, henning@ happy with smtpd using femail code

Revision 1.65 / (download) - annotate - [select for diffs], Thu Apr 9 20:19:03 2009 UTC (15 years, 2 months ago) by todd
Branch: MAIN
Changes since 1.64: +15 -5 lines
Diff to previous 1.64 (colored)

fixes for smtp auth LOGIN, inspired from smtp auth PLAIN fixes
(NUL terminate buffers, duh!)
with suggestions from oga@
"please commit" jacekm@, ok gilles@ oga@

Revision 1.64 / (download) - annotate - [select for diffs], Thu Apr 9 19:49:34 2009 UTC (15 years, 2 months ago) by jacekm
Branch: MAIN
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

change syntax of the "listen on" and "relay via" directives:
1) kill the ssmtp keyword in "ssmtp listen on ...";
2) kill the use keyword in "... use certificate foo";
3) tls no longer implicit, user must explicitely use the tls or smtps option.
4) for "relay via", move the tls/smtps options to right after the
port specification; makes it similar to "listen on".

These directives:

  ssmtp listen on fxp0 use ceritifate "foo"
  accept for all relay via tls "mx.bar.com"

now become:

  listen on fxp0 smtps certificate "foo"
  accept for all relay via "mx.bar.com" tls

ok gilles@

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

since we are going to share code in smtp sessions and mta sessions, we need
to also share the statistics structure, still being worked on

Revision 1.62 / (download) - annotate - [select for diffs], Sun Mar 15 18:12:15 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.61: +9 -9 lines
Diff to previous 1.61 (colored)

save 4 bytes per message by moving the datafp field of struct message to
struct session where it really belongs.

Revision 1.61 / (download) - annotate - [select for diffs], Wed Mar 11 09:58:20 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

fix log_info(), while other processes know about message uid, the smtp
process only knows about message id

bug spotted by pea@

Revision 1.60 / (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.59: +10 -1 lines
Diff to previous 1.59 (colored)

implement basic logging, needs more work; ok gilles@

Revision 1.59 / (download) - annotate - [select for diffs], Sun Mar 8 19:11:22 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.58: +4 -4 lines
Diff to previous 1.58 (colored)

shrink struct message a bit by removing a couple fields which are no longer
used and by moving the rcpt count in struct session where it really belongs

while at it, remove some unused splay tree generation in mfa

Revision 1.58 / (download) - annotate - [select for diffs], Sun Feb 22 11:59:12 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.57: +5 -37 lines
Diff to previous 1.57 (colored)

put repeated inet_ntop calls into new func ss_to_text, which uses
getnameinfo internally; ok gilles@

Revision 1.57 / (download) - annotate - [select for diffs], Thu Feb 19 11:33:25 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.56: +7 -2 lines
Diff to previous 1.56 (colored)

don't let libevent buffer long lines forever; ok gilles@

Revision 1.56 / (download) - annotate - [select for diffs], Wed Feb 18 00:29:52 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.55: +5 -1 lines
Diff to previous 1.55 (colored)

previous commit was incomplete, this fixes ssmtp

Revision 1.55 / (download) - annotate - [select for diffs], Wed Feb 18 00:17:39 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.54: +1 -11 lines
Diff to previous 1.54 (colored)

smtp_accept() now requests from lka that it performs the hostname lookup
and inserts the session into the session tree. session_init() is called
only when we receive the resolution answer.

this fixes a race condition that would sometimes cause the hostname to
appear as "<unknown>" in headers just because dns was lagging, and it
unbreaks ssmtp support which suffered from th very same race condition.

Revision 1.54 / (download) - annotate - [select for diffs], Tue Feb 17 21:53:55 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored)

after a message has been commited to queue, do not incondtionnally clear
the message id and uid immediately. only do it if session has been flagged
with F_QUIT, otherwise session_pickup() will do it when in state S_DONE.

this fixes a bug reported by pea@ where the message id was not displayed
in the "message accepted for delivery" line.

Revision 1.53 / (download) - annotate - [select for diffs], Fri Feb 13 19:59:49 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.52: +11 -2 lines
Diff to previous 1.52 (colored)

Ensure ss is never dereferenced when NULL. Can't happen with current code,
but it could in future, and fatal is better than segv. Reported by sthen@.
ok gilles@ sthen@

Revision 1.52 / (download) - annotate - [select for diffs], Fri Jan 30 21:52:55 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.51: +2 -1 lines
Diff to previous 1.51 (colored)

when decreasing ssl related counters, make sure the session was flagged as
F_SECURE. while at it, add "smtp.sessions.aborted" which keeps track of
sessions which were interrupted before completion.

Revision 1.51 / (download) - annotate - [select for diffs], Fri Jan 30 21:40:21 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.50: +3 -3 lines
Diff to previous 1.50 (colored)

improve statistics for smtp process. not only collect the current sessions
count, but also the total sessions count, ssmtp sessions (both current and
total) and starttls sessions (both current and total)

# ./smtpctl/smtpctl show stats|grep smtp.sessions
smtp.sessions = 0
smtp.sessions.active = 0
smtp.sessions.ssmtp = 0
smtp.sessions.ssmtp.active = 0
smtp.sessions.starttls = 0
smtp.sessions.starttls.active = 0
#

Revision 1.50 / (download) - annotate - [select for diffs], Fri Jan 30 21:22:33 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.49: +3 -5 lines
Diff to previous 1.49 (colored)

clear the F_EVLOCK flag earlier to prevent the error event handler from
being called again with F_EVLOCK set. this fixes a bug where disconnect
after smtpd sends greeting and before entering any command failed to go
into session_destroy().

while at it, rename the "smtp.clients" statistic to "smtp.sessions" and
add counters to struct s_smtp so that I can add ssmtp and starttls with
my next commit ;)

Revision 1.49 / (download) - annotate - [select for diffs], Fri Jan 30 17:34:58 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.48: +3 -5 lines
Diff to previous 1.48 (colored)

bump descriptors limit to the max and set the maximum connections count to
three quarters of that limit (a session typically has 3 descriptors). when
we hit that limit, we stop accepting connections, and when client closes a
session, we start accepting connections again. this prevents us from going
into a session that is likely to fail because of scarce resources.

idea discussed with jacekm@, code mostly ripped from relayd

Revision 1.48 / (download) - annotate - [select for diffs], Fri Jan 30 16:37:52 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.47: +28 -11 lines
Diff to previous 1.47 (colored)

fix a very annoying events masking issue which would cause a fatal() to be
hit under certain conditions; while tracking the bug I ran into other bugs
which were kind of related and could cause us to hit a fatal() too.

fix by me, but with lots of testing and investigation with jacekm@,
ok jacekm@

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jan 29 21:59:15 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.46: +7 -1 lines
Diff to previous 1.46 (colored)

Implement "smtpctl show stats"; ok gilles@

Revision 1.46 / (download) - annotate - [select for diffs], Thu Jan 29 15:40:35 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.45: +1 -3 lines
Diff to previous 1.45 (colored)

missing prototype for session_respond() in mta, move session_respond()'s
prototype to smtpd.h
spotted and diff from Oleg Safiullin <form@pdp-11.org.ru>

Revision 1.45 / (download) - annotate - [select for diffs], Thu Jan 29 15:27:34 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.44: +1 -4 lines
Diff to previous 1.44 (colored)

- remove debug message

Revision 1.44 / (download) - annotate - [select for diffs], Thu Jan 29 15:20:34 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.43: +4 -1 lines
Diff to previous 1.43 (colored)

Received header line was incomplete for mail submitted through the enqueuer
as well as for some outgoing messages, this is fixed now

Revision 1.43 / (download) - annotate - [select for diffs], Wed Jan 28 18:10:19 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.42: +2 -29 lines
Diff to previous 1.42 (colored)

reuse recipient_to_path; ok gilles@

Revision 1.42 / (download) - annotate - [select for diffs], Wed Jan 28 17:29:11 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

Make races between queue and runner impossible by implementing the policy:
1) queue never reads /queue.
2) queue writes to /queue only at message injection time.
3) runner does all reading, and all writing apart from 2).

ok gilles@

Revision 1.41 / (download) - annotate - [select for diffs], Wed Jan 28 11:27:57 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.40: +3 -1 lines
Diff to previous 1.40 (colored)

add a struct path to struct message so that we can keep track of the RCPT
provided recipient even after aliases/forwards expansion, we'll need this
for loop detection.

message id and uid being MAXPATHLEN long is a waste, define MAX_ID_SIZE
which is currently set to 64 (but can probably be further reduced) and
make sure that structures and the few strlcpy's use the right define.

original idea by jacekm@ a while ago

Revision 1.40 / (download) - annotate - [select for diffs], Mon Jan 12 19:56:27 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.39: +10 -2 lines
Diff to previous 1.39 (colored)

dot escaping, as required by rfc; ok gilles@

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jan 4 00:58:59 2009 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.38: +5 -8 lines
Diff to previous 1.38 (colored)

aliases/forwards expansion was not done correctly and a race could
cause delivery to happen before expansion is over, causing some of
the recipients to never receive the mail. change how the mfa, lka,
queue and smtp processes communicate to ensure smtp never receives
an acknowledgment before ALL expanded envelopes are on disk. While
at it, lka was doing work which belongs in mfa, fix that also.

this is based on an idea from a talk with jacekm@, change not over
but already better than what we had.

Revision 1.38 / (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.37: +1 -3 lines
Diff to previous 1.37 (colored)

remove unnecessary includes; ok gilles@

Revision 1.37 / (download) - annotate - [select for diffs], Mon Dec 22 13:21:39 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.36: +7 -7 lines
Diff to previous 1.36 (colored)

cleanup

Revision 1.36 / (download) - annotate - [select for diffs], Mon Dec 22 00:44:32 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.35: +1 -2 lines
Diff to previous 1.35 (colored)

To reset state, it's enough to set s->s_state = S_HELO, rcptcount
is zeroed in MAIL FROM handler; ok gilles@

Revision 1.35 / (download) - annotate - [select for diffs], Sun Dec 21 19:27:57 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.34: +3 -5 lines
Diff to previous 1.34 (colored)

fix session flags resetting; ok gilles@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Dec 21 18:51:08 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.33: +6 -3 lines
Diff to previous 1.33 (colored)

- missing prototype + smtp.c was misusing session_auth_pickup()
- unlike starttls, ssmtp sets the F_SECURE flag on session before helo/ehlo
	handlers are called. this means that if we clear all flags in helo/
	helo handlers, we prevent smtpd from advertising AUTH as it will do
	so only for F_SECURE sessions. This commits unbreaks SMTP AUTH with
	smtp sessions. Problem spotted by James Turner <james@bsdgroup.org>

Revision 1.33 / (download) - annotate - [select for diffs], Sun Dec 21 02:18:46 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.32: +120 -18 lines
Diff to previous 1.32 (colored)

- AUTH PLAIN may receive credentials as a parameter to AUTH or on a
	following line, this commit brings support for the latter which was
	not supported yet.
- AUTH LOGIN is now supported, allowing smtp auth support on clients that
	do not support AUTH PLAIN (ie: my mobile phone for instance ;)

Revision 1.32 / (download) - annotate - [select for diffs], Sat Dec 20 00:18:03 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.31: +17 -12 lines
Diff to previous 1.31 (colored)

- import first bricks of SMTP AUTH support. currently only AUTH PLAIN is
	supported, AUTH LOGIN will follow soon. AUTH will only work if a
	listen directive has "enable auth" keywords, AND session is safe
	(ssmtp or starttls).

Revision 1.31 / (download) - annotate - [select for diffs], Thu Dec 18 23:57:17 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Introduce safe_fclose, which tries to push file to the disk as
quickly as possible; it fails under temporary error conditions,
letting caller react appropriately.

ok gilles@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Dec 18 23:49:56 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.29: +6 -1 lines
Diff to previous 1.29 (colored)

Declarations for functions used only in smtp_session.c were moved
to that file from smtpd.h.

ok gilles@

Revision 1.29 / (download) - annotate - [select for diffs], Thu Dec 18 23:38:12 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.28: +66 -39 lines
Diff to previous 1.28 (colored)

Check fwrite return code at DATA stage.

Add basic line length checking, as required by rfc.

It is no longer required to disable EV_READ upon evbuffer_readline failure.

ok gilles@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Dec 18 15:11:21 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.27: +23 -20 lines
Diff to previous 1.27 (colored)

Cleanup /incoming before handling each MAIL FROM.
Improve cleanup condition to cover more cases.

ok gilles@

Revision 1.27 / (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.26: +4 -4 lines
Diff to previous 1.26 (colored)

IMSG_* namespace cleanup.

ok gilles@

Revision 1.26 / (download) - annotate - [select for diffs], Sun Dec 7 15:41:16 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

Disable EV_READ when sending IMSG_PARENT_AUTHENTICATE.

This is for consistency, code is not reached yet.

ok gilles@

Revision 1.25 / (download) - annotate - [select for diffs], Sun Dec 7 15:38:35 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.24: +72 -103 lines
Diff to previous 1.24 (colored)

Replace evbuffer_add_printf calls with wrapper function, session_respond,
which additionally suffixes <CRLF>, and enables EV_WRITE.

Remove bufferevent_enable(.., EV_WRITE) from session_command and
session_pickup so that EV_WRITE is enabled in exactly one place,
session_respond.

Change some responses slightly to make code fit 80 columns.

ok gilles@

Revision 1.24 / (download) - annotate - [select for diffs], Sun Dec 7 01:03:25 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.23: +1 -9 lines
Diff to previous 1.23 (colored)

Don't check / reset s->s_msg.datafp where its state is obviously known.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Dec 6 14:58:09 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

In session_destroy, use "if (s->s_state >= S_MAIL)", and not
"if (s->s_state > S_MAIL)". Otherwise, session timeout after
MAIL FROM would leave mess in queue.

ok gilles@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Dec 6 14:30:51 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.21: +1 -2 lines
Diff to previous 1.21 (colored)

Don't include <err.h> where log.c API must be used.

ok gilles@

Revision 1.21 / (download) - annotate - [select for diffs], Sat Dec 6 04:49:52 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

NULL-ify s_msg.datafp upon fclose unconditionally.

ok gilles

Revision 1.20 / (download) - annotate - [select for diffs], Sat Dec 6 02:43:58 2008 UTC (15 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.19: +1 -3 lines
Diff to previous 1.19 (colored)

evbuffer_readline already strips <CRLF> so that callers don't have to.

ok gilles

Revision 1.19 / (download) - annotate - [select for diffs], Fri Dec 5 17:29:11 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

- cosmethic, no functionnal change

Revision 1.18 / (download) - annotate - [select for diffs], Thu Dec 4 23:02:12 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.17: +2 -1 lines
Diff to previous 1.17 (colored)

- in session_read(), set EV_WRITE if we are going to send a "transaction
	failed" error. found by Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.17 / (download) - annotate - [select for diffs], Thu Dec 4 04:09:55 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.16: +6 -4 lines
Diff to previous 1.16 (colored)

- when in state S_DATACONTENT, do not disable EV_READ if the last line we
	read is empty, instead return and only disable EV_READ when we read
	"."

Revision 1.16 / (download) - annotate - [select for diffs], Thu Dec 4 02:04:50 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.15: +5 -3 lines
Diff to previous 1.15 (colored)

- when doing the session timeout lookup, do not remove the last session
	that timed out twice.

Revision 1.15 / (download) - annotate - [select for diffs], Thu Dec 4 01:16:14 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.14: +15 -11 lines
Diff to previous 1.14 (colored)

- fix event masking for DATA and make DATA look more like MAIL and RCPT
	with regard to communication with queue process (one state before
	sending imsg, another state when imsg has returned). this fixes an
	issue that I observed when clients send DATA and content without
	even looking at server replies.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Dec 3 17:58:00 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.13: +49 -46 lines
Diff to previous 1.13 (colored)

- fix event masking issues in smtp process which could lead to a fatal() if
	queue process did not answer fast enough to an imsg. spotted by
	Jacek Masiulaniec <jacekm@dobremiasto.net>
- queue layout was mostly to bootstrap the project, it does not behave good
	under load, it does complex things to stay in a recoverable state
	and it probably didnt do it too well. New queue code is simpler,
	smaller and allows for atomic submissions (a mail can never be in a
	state where it needs to be recovered). It still needs some work but
	works better than previous code, no regression.

Revision 1.13 / (download) - annotate - [select for diffs], Tue Nov 25 20:35:54 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.12: +2 -1 lines
Diff to previous 1.12 (colored)

- plug memory leak

Revision 1.12 / (download) - annotate - [select for diffs], Tue Nov 25 15:58:14 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

- update email address for bug reports when replying to HELP

Revision 1.11 / (download) - annotate - [select for diffs], Tue Nov 25 15:55:13 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.10: +1 -4 lines
Diff to previous 1.10 (colored)

- F_IMSG_SENT is no longer used, kill
	suggested by Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.10 / (download) - annotate - [select for diffs], Mon Nov 24 23:55:25 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

- when using fread/fwrite, do not swap the size and nmemb arguments. no
	functionnal change here, just making use of fonctions the way C
	intended it ;-)
From Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.9 / (download) - annotate - [select for diffs], Mon Nov 17 21:56:18 2008 UTC (15 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (colored)

add missing header needed by time(), ctime_r() and tzset().

ok gilles@

Revision 1.8 / (download) - annotate - [select for diffs], Mon Nov 17 21:52:00 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.7: +3 -2 lines
Diff to previous 1.7 (colored)

- clear session flags upon helo/ehlo

Revision 1.7 / (download) - annotate - [select for diffs], Mon Nov 17 21:50:43 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.6: +6 -1 lines
Diff to previous 1.6 (colored)

- until now a client could issue a command from an extension even though it
	greeted with helo and not ehlo. introduce session flag F_EHLO and
	make sure the session_command() dispatch only looks at extensions
	when a session does not have the F_EHLO flag.

Revision 1.6 / (download) - annotate - [select for diffs], Mon Nov 17 20:11:27 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.5: +8 -10 lines
Diff to previous 1.5 (colored)

- remove several constructs where format strings are used in an evbuffer
	printf with constant parameters, turn them into a constant string.
- when client sends EHLO without a parameter, send the appropriate error
	message ("EHLO takes ..." instead of "HELO takes ...")

From Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.5 / (download) - annotate - [select for diffs], Tue Nov 11 01:08:08 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.4: +25 -50 lines
Diff to previous 1.4 (colored)

- queue process no longer schedules messages which do not have flag
	F_MESSAGE_COMPLETE
- submit recipients to the queue as we read them from RCPT instead of
	submiting them all at once when DATA is over. this prevents us
	from having to keep a potentially large number of recipients in
	memory during the whole session.
- remove all code that dealt with the recipients queue of a message as
	it is no longer used.
- several small changes to make sure the server is always in a recoverable
	state in case of an unexpected shutdown.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Nov 10 23:18:47 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.3: +22 -13 lines
Diff to previous 1.3 (colored)

- open the message file earlier after a successful MAIL command instead of
	waiting for the DATA command. this currently has no impact on the
	session but is needed for another change that will make submission
	of recipients safer with regard to "unexpected shutdowns at bad
	timings"

Revision 1.3 / (download) - annotate - [select for diffs], Mon Nov 10 17:24:24 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

spaces fixed while reading code

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.