OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.248 / (download) - annotate - [select for diffs], Tue Apr 23 13:34:51 2024 UTC (6 weeks, 4 days ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.247: +2 -2 lines
Diff to previous 1.247 (colored)

correct indentation; no functional change
ok tb@

Revision 1.247 / (download) - annotate - [select for diffs], Wed Jan 3 08:11:15 2024 UTC (5 months ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.246: +3 -6 lines
Diff to previous 1.246 (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.246 / (download) - annotate - [select for diffs], Wed Nov 8 08:46:35 2023 UTC (7 months ago) by op
Branch: MAIN
Changes since 1.245: +5 -1 lines
Diff to previous 1.245 (colored)

RFC 7505 ("Null MX") handling

mail delivery will not be attempted if a domain advertises a single MX
record with preference 0 and a zero-length label.

based on an initial diff from Philipp (philipp+openbsd [at] bureaucracy
[dot] de), thanks!

ok jung@

Revision 1.245 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months, 1 week ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.244: +2 -1 lines
Diff to previous 1.244 (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.244 / (download) - annotate - [select for diffs], Tue May 16 17:48:52 2023 UTC (12 months, 3 weeks ago) by op
Branch: MAIN
Changes since 1.243: +11 -8 lines
Diff to previous 1.243 (colored)

some fatal -> fatalx to improved logging

errno doesn't generally contains anything useful after libtls functions,
and in most cases it's explicitly cleared to avoid misuse, so change a
few fatal() calls to fatalx() when logging libtls failures.  Also, add
the real error string, via tls_error() or tls_config_error(), that was
missing before.

ok millert@

Revision 1.243 / (download) - annotate - [select for diffs], Fri Feb 18 16:57:36 2022 UTC (2 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.242: +7 -1 lines
Diff to previous 1.242 (colored)

Revert changes to use the new libtls signer api
There are bugs in the new libtls signer that can lead to a crash.
OK tb@ jsing@

Revision 1.242 / (download) - annotate - [select for diffs], Sat Feb 12 18:22:04 2022 UTC (2 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.241: +2 -8 lines
Diff to previous 1.241 (colored)

use new libtls signer api

ok tb@

Revision 1.241 / (download) - annotate - [select for diffs], Thu Feb 10 14:59:35 2022 UTC (2 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.240: +4 -8 lines
Diff to previous 1.240 (colored)

Do not verify the cert or CA for a relay using opportunistic TLS.
If a relay is not explicitly configured to use TLS but the remote
side supports STARTTLS, we will try to use it.  However, in this
case we should not verify the cert or CA (which may be self-signed).
This restores the relay behavior before the switch to libtls was made.
There is no change if the relay is explicitly configured to use TLS.
OK eric@

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

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

ok jung@

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

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

ok florian@ millert@

Revision 1.238 / (download) - annotate - [select for diffs], Fri Apr 9 16:43:43 2021 UTC (3 years, 2 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.237: +9 -5 lines
Diff to previous 1.237 (colored)

allow to specify tls ciphers and protocols on listeners

ok tb@

Revision 1.237 / (download) - annotate - [select for diffs], Fri Apr 2 06:30:55 2021 UTC (3 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.236: +6 -3 lines
Diff to previous 1.236 (colored)

if cipher list is not specified for a relay action, use the global
cipher list if defined. otherwise fallback to libtls default.

ok millert@

Revision 1.236 / (download) - annotate - [select for diffs], Wed Mar 31 17:47:16 2021 UTC (3 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.235: +10 -5 lines
Diff to previous 1.235 (colored)

allow to specify tls protocols and ciphers on relay actions

ok espie@ sthen@ tb@

Revision 1.235 / (download) - annotate - [select for diffs], Fri Mar 5 12:37:32 2021 UTC (3 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.234: +74 -1 lines
Diff to previous 1.234 (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.234 / (download) - annotate - [select for diffs], Sat Dec 21 10:34:07 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.233: +2 -1 lines
Diff to previous 1.233 (colored)

keep track of the relay action in relays, will be used for smtp-out
reporting

Revision 1.233 / (download) - annotate - [select for diffs], Wed Dec 18 07:57:51 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.232: +5 -1 lines
Diff to previous 1.232 (colored)

teach relay action how to do domain-based relay host, this allows declaring
a single relay action with a mapping of relay hosts per domain.

ok eric@

Revision 1.232 / (download) - annotate - [select for diffs], Fri Sep 20 17:46:05 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.231: +8 -1 lines
Diff to previous 1.231 (colored)

teach smtpd how to do SRS so hosts that act as forwarders don't break SPF.
this basic implementation does SRS0/SRS1 encoding/decoding, validating time
and checksums.

with insight from semarie@, ok eric@ and millert@

Revision 1.231 / (download) - annotate - [select for diffs], Wed Sep 18 11:26:30 2019 UTC (4 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.230: +10 -5 lines
Diff to previous 1.230 (colored)

Implement server certificate validation in smtp(1).
Check certificate against MX name in smtpd(8) mta.

ok gilles@

Revision 1.230 / (download) - annotate - [select for diffs], Sat Sep 14 06:20:27 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.229: +9 -1 lines
Diff to previous 1.229 (colored)

in mta_relay_cmp() properly check that authlabel or backupname are not NULL
before comparing their value with other relays

diff from Caspar Schutijser <caspar@schutijser.com>

Revision 1.229 / (download) - annotate - [select for diffs], Mon Aug 19 15:42:24 2019 UTC (4 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.228: +5 -2 lines
Diff to previous 1.228 (colored)

use a specific and more relevant status message for failed smarthost
resolution.

ok gilles@

Revision 1.228 / (download) - annotate - [select for diffs], Fri Jun 14 19:55:25 2019 UTC (4 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.227: +17 -19 lines
Diff to previous 1.227 (colored)

simplify the runq interface:

- remove (unused) per-job callback
- rename runq_schedule() to runq_schedule_at() and runq_delay()
  to runq_schedule()
- remove unused runq_next()

ok sunil@ gilles@

Revision 1.227 / (download) - annotate - [select for diffs], Sun Dec 23 16:37:53 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.226: +1 -9 lines
Diff to previous 1.226 (colored)

remove dead code

ok gilles@

Revision 1.226 / (download) - annotate - [select for diffs], Mon Sep 24 16:14:34 2018 UTC (5 years, 8 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.225: +19 -2 lines
Diff to previous 1.225 (colored)

Allow to use the "tls" keyword on any relay action to force TLS, with
strict certificate validation.  The "no-verify" becomes optional.

ok gilles@ millert@ semarie@

Revision 1.225 / (download) - annotate - [select for diffs], Wed Sep 19 05:31:12 2018 UTC (5 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.224: +8 -9 lines
Diff to previous 1.224 (colored)

rename the ill-named "flags" member to "as_host" in domain structure.
remove yet another useless relay flag while there.

ok gilles@

Revision 1.224 / (download) - annotate - [select for diffs], Mon Sep 17 12:16:27 2018 UTC (5 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.223: +9 -9 lines
Diff to previous 1.223 (colored)

simplify code path for backup relay and remove useless flag

ok gilles@

Revision 1.223 / (download) - annotate - [select for diffs], Sat Sep 8 10:05:07 2018 UTC (5 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.222: +27 -10 lines
Diff to previous 1.222 (colored)

use symbolic integer values for the different tls options when relaying,
rather than a confusing set of flags.

ok gilles@

Revision 1.222 / (download) - annotate - [select for diffs], Wed Aug 22 10:11:43 2018 UTC (5 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.221: +12 -1 lines
Diff to previous 1.221 (colored)

Fix a crash when relaying with authentication but auth table is not set.

found by and ok stsp@

Revision 1.221 / (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.220: +1 -5 lines
Diff to previous 1.220 (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.220 / (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.219: +2 -2 lines
Diff to previous 1.219 (colored)

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

suggested by eric@, ok millert@

Revision 1.219 / (download) - annotate - [select for diffs], Thu Jun 7 11:31:51 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.218: +2 -2 lines
Diff to previous 1.218 (colored)

use RELAY_* flags where appropriate

ok gilles@

Revision 1.218 / (download) - annotate - [select for diffs], Thu Jun 7 07:06:06 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.217: +7 -15 lines
Diff to previous 1.217 (colored)

simplify the codepath for backup relay setup

ok gilles@

Revision 1.217 / (download) - annotate - [select for diffs], Wed Jun 6 19:12:09 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.216: +5 -4 lines
Diff to previous 1.216 (colored)

code cleanup

ok gilles@ semarie@

Revision 1.216 / (download) - annotate - [select for diffs], Wed Jun 6 12:00:26 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.215: +11 -37 lines
Diff to previous 1.215 (colored)

remove fields that are found in struct dispatcher from struct relayhost

ok gilles@

Revision 1.215 / (download) - annotate - [select for diffs], Tue Jun 5 11:34:21 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.214: +37 -36 lines
Diff to previous 1.214 (colored)

remove struct relayhost from struct envelope.

ok gilles@

Revision 1.214 / (download) - annotate - [select for diffs], Fri Jun 1 12:24:16 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.213: +4 -1 lines
Diff to previous 1.213 (colored)

Require a valid certificate by default when relaying through a smarthost.
Add "tls no-verify" relay option to disable it.

suggested and initial diff by semarie@.

ok gilles@

Revision 1.213 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.212: +28 -32 lines
Diff to previous 1.212 (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.212 / (download) - annotate - [select for diffs], Thu May 31 11:56:10 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.211: +9 -12 lines
Diff to previous 1.211 (colored)

simplify

ok gilles@

Revision 1.211 / (download) - annotate - [select for diffs], Tue May 29 20:43:07 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.210: +5 -1 lines
Diff to previous 1.210 (colored)

no need to parse and dump the relayhost in the lookup process.

ok gilles@

Revision 1.210 / (download) - annotate - [select for diffs], Mon May 28 19:13:37 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.209: +13 -1 lines
Diff to previous 1.209 (colored)

fix mail-from in relay rules, was not propagated from grammar to mta

reported by a user

Revision 1.209 / (download) - annotate - [select for diffs], Mon May 28 17:10:15 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.208: +2 -1 lines
Diff to previous 1.208 (colored)

stop processing envelope if smarthost parsing failed

ok gilles@

Revision 1.208 / (download) - annotate - [select for diffs], Mon May 28 11:12:12 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.207: +2 -1 lines
Diff to previous 1.207 (colored)

missing m_close()

ok gilles@

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

switch smtpd to new grammar

ok eric@

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

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

ok gilles@ sunil@

Revision 1.205 / (download) - annotate - [select for diffs], Fri Sep 15 11:50:39 2017 UTC (6 years, 8 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.204: +89 -80 lines
Diff to previous 1.204 (colored)

move the envelope handling code to its own function to clarify the
imsg dispatch function.

ok gilles@

Revision 1.204 / (download) - annotate - [select for diffs], Mon Sep 11 17:09:09 2017 UTC (6 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.203: +1 -19 lines
Diff to previous 1.203 (colored)

remove dead code.

ok gilles@

Revision 1.203 / (download) - annotate - [select for diffs], Mon Jan 9 09:53:23 2017 UTC (7 years, 5 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.202: +2 -2 lines
Diff to previous 1.202 (colored)

smtpd joins the 7 other daemons that share the same log.c file.

The only major difference was the "log_trace" concept that is only
used by smtpd - move it from log.c into util.c and make it a local
concept.  This also needed to rename the global "verbose" variable to
"tracing" in a few places.

OK krw@ gilles@ eric@

Revision 1.202 / (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.201: +3 -3 lines
Diff to previous 1.201 (colored)

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

Revision 1.201 / (download) - annotate - [select for diffs], Sun May 22 16:31:21 2016 UTC (8 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.200: +6 -6 lines
Diff to previous 1.200 (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.200 / (download) - annotate - [select for diffs], Thu Jan 14 18:56:55 2016 UTC (8 years, 4 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.199: +3 -3 lines
Diff to previous 1.199 (colored)

Check whether a string from imsg is empty by dereferencing the char*
rather than using strlen. That way we don't have to walk through the
entire string.

ok sunnil@

Revision 1.199 / (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.198: +5 -5 lines
Diff to previous 1.198 (colored)

remove spaces after '!'

no binary change

ok millert

Revision 1.198 / (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.197: +3 -3 lines
Diff to previous 1.197 (colored)

remove trailing whitespace

ok sunil gilles

Revision 1.197 / (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.196: +13 -1 lines
Diff to previous 1.196 (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.196 / (download) - annotate - [select for diffs], Tue Dec 1 10:48:21 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.195: +2 -2 lines
Diff to previous 1.195 (colored)

whitespace

Revision 1.195 / (download) - annotate - [select for diffs], Tue Dec 1 10:41:35 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.194: +6 -5 lines
Diff to previous 1.194 (colored)

delay between retries when operating as a secondary MX increases too much,
reduce it to something saner. while at it cleanup some whitespaces and set
the relay task pointer to NULL before iterating over tasks

Revision 1.194 / (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.193: +3 -3 lines
Diff to previous 1.193 (colored)

mechanical rename of some IMSG constants

ok sunil@, ok jung@

Revision 1.193 / (download) - annotate - [select for diffs], Thu Nov 26 08:51:22 2015 UTC (8 years, 6 months ago) by tim
Branch: MAIN
Changes since 1.192: +5 -5 lines
Diff to previous 1.192 (colored)

Don't dereference a route and then reference it again. In this particular case,
the route would be referenced at least twice, so there is no use after free.

Prompted by a mail from David CARLIER to misc@opensmtpd.

OK eric@

Revision 1.192 / (download) - annotate - [select for diffs], Wed Oct 14 22:01:43 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.191: +4 -4 lines
Diff to previous 1.191 (colored)

whitespaces

Revision 1.191 / (download) - annotate - [select for diffs], Tue Jan 20 17:37:54 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.190: +8 -8 lines
Diff to previous 1.190 (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.190 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:20 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.189: +2 -1 lines
Diff to previous 1.189 (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.189 / (download) - annotate - [select for diffs], Tue Jul 8 13:02:42 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.188: +2 -1 lines
Diff to previous 1.188 (colored)

make sure to clear the WAIT flag when cancelling the connector timeout.

Revision 1.188 / (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.187: +2 -2 lines
Diff to previous 1.187 (colored)

fix typos.

ok jmc@

Revision 1.187 / (download) - annotate - [select for diffs], Tue May 20 18:47:01 2014 UTC (10 years ago) by eric
Branch: MAIN
Changes since 1.186: +8 -8 lines
Diff to previous 1.186 (colored)

format string cleanup: change "%i" to "%d" and fix a few typos

Revision 1.186 / (download) - annotate - [select for diffs], Sat Apr 19 13:32:07 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.185: +78 -76 lines
Diff to previous 1.185 (colored)

(void) cast strlcpy() / strlcat() / snprintf() that cannot truncate

(void) cast a few calls that are ok to truncate because they are not used
in anything critical / unsafe, but just to make some debug/info logs a bit
more informative

Revision 1.185 / (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.184: +70 -121 lines
Diff to previous 1.184 (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.184 / (download) - annotate - [select for diffs], Sat Mar 8 15:47:52 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.183: +14 -14 lines
Diff to previous 1.183 (colored)

code cleanup

Revision 1.183 / (download) - annotate - [select for diffs], Thu Feb 20 17:42:29 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.182: +2 -2 lines
Diff to previous 1.182 (colored)

use strcasecmp() to compare domains.

Revision 1.182 / (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.181: +19 -5 lines
Diff to previous 1.181 (colored)

Add support for DSN and Enhanced Status Code

Revision 1.181 / (download) - annotate - [select for diffs], Tue Feb 4 15:22:39 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.180: +146 -3 lines
Diff to previous 1.180 (colored)

Allow the admin to pause relaying to a specific domain:
 - smtpctl pause mta from <source> for <domain>
 - smtpctl resume mta from <source> for <domain>
 - smtpctl show mta paused

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

internal improvements and cleanups

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

Revision 1.179 / (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.178: +12 -12 lines
Diff to previous 1.178 (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.178 / (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.177: +2 -2 lines
Diff to previous 1.177 (colored)

bcopy -> memmove
bzero -> memset

Revision 1.177 / (download) - annotate - [select for diffs], Fri Dec 6 14:12:34 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.176: +15 -1 lines
Diff to previous 1.176 (colored)

fix smtpctl resume route

Revision 1.176 / (download) - annotate - [select for diffs], Thu Dec 5 09:26:47 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.175: +1 -1 lines
Diff to previous 1.175 (colored)

When a relay fails, let the scheduler update all envelopes in the
holdq as if they tempfailed.

Revision 1.175 / (download) - annotate - [select for diffs], Tue Dec 3 09:06:26 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.174: +67 -40 lines
Diff to previous 1.174 (colored)

Rework the envelope flushing loops in mta to avoid sending all delivery
notifications in one go to the queue. Simplify code in the process.

Revision 1.174 / (download) - annotate - [select for diffs], Sat Nov 30 10:21:16 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.173: +22 -14 lines
Diff to previous 1.173 (colored)

do not send the holdq release message if no envelope were held for a relay.

Revision 1.173 / (download) - annotate - [select for diffs], Fri Nov 29 00:47:04 2013 UTC (10 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.172: +3 -3 lines
Diff to previous 1.172 (colored)

fix missing space from line break

Revision 1.172 / (download) - annotate - [select for diffs], Thu Nov 28 13:13:56 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.171: +3 -0 lines
Diff to previous 1.171 (colored)

limit the number of envelopes to recall in the hoststat cache.

Revision 1.171 / (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.170: +2 -0 lines
Diff to previous 1.170 (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.170 / (download) - annotate - [select for diffs], Wed Oct 30 21:37:48 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.169: +121 -1 lines
Diff to previous 1.169 (colored)

add "smtpctl show relays" and "smtpctl show hosts" commands

Revision 1.169 / (download) - annotate - [select for diffs], Tue Oct 29 17:04:45 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.168: +34 -3 lines
Diff to previous 1.168 (colored)

add missing heloname field for relayhost.
differenciate relays with different helotable/heloname.
improve code a bit.

Revision 1.168 / (download) - annotate - [select for diffs], Tue Oct 29 11:23:58 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.167: +12 -20 lines
Diff to previous 1.167 (colored)

Report mta sessions errors on the route rather than on the MX.
If a route has too many of these errors, disable it for a while.
Reset the error counter for a route when it is re-enabled or when
it could establish a connection successfully.

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

Set lastmxquery when the MX query returns, not when it is issued.
This fixes a potential race when several relays share a single domain,
resulting in temporary failures and unnecessary delays.

Revision 1.166 / (download) - annotate - [select for diffs], Sun Oct 27 17:47:53 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.165: +57 -2 lines
Diff to previous 1.165 (colored)

Implement a feedback mechanism which allows the mta to "hold" envelopes
in the scheduler when it has too many tasks for a given relay.  The
envelopes are put on a wait queue, and are not scheduled again until
the mta "releases" some envelopes from that queue.

It prevents from having too many inflight envelopes, which are out of reach
for the admin.

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

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

Revision 1.164 / (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.163: +9 -9 lines
Diff to previous 1.163 (colored)

%i -> %d in format strings

Revision 1.163 / (download) - annotate - [select for diffs], Fri Jul 19 21:14:52 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.162: +805 -368 lines
Diff to previous 1.162 (colored)

Many MTA improvements:

- Better transient error handling logic: failing destinations are
  automatically disabled for a while.  When a destination is active
  again, ask the scheduler to retry previous envelopes immediatly.
- More informative error report when all routes fail for a mail.
- Implement a "smtpctl show hoststats" command to get the latest stat
  message per MX domain.
- Implement a "smtpctl show routes" command to show the state the
  currently known routes to remote MXs.
- Implement a "smtpctl resume route" command to re-enable a route that
  has been disabled.
- Do not hardcode limits
- Minor code improvements

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

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

Revision 1.161 / (download) - annotate - [select for diffs], Fri Jul 19 11:14:08 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.160: +5 -3 lines
Diff to previous 1.160 (colored)

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

Remove useless SMTPD_FILTER_USER while there.

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

Remove useless sc_pid from struct smtpd.

Revision 1.159 / (download) - annotate - [select for diffs], Tue Jun 4 08:16:10 2013 UTC (11 years ago) by eric
Branch: MAIN
Changes since 1.158: +4 -4 lines
Diff to previous 1.158 (colored)

fix use-after-free in debug traces

Revision 1.158 / (download) - annotate - [select for diffs], Mon Jun 3 16:04:03 2013 UTC (11 years ago) by eric
Branch: MAIN
Changes since 1.157: +14 -7 lines
Diff to previous 1.157 (colored)

plug a couple of memleaks

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.156 / (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.155: +3 -3 lines
Diff to previous 1.155 (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.155 / (download) - annotate - [select for diffs], Mon Feb 18 13:37:14 2013 UTC (11 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.154: +2 -2 lines
Diff to previous 1.154 (colored)

missing comma in log message

ok gilles@

Revision 1.154 / (download) - annotate - [select for diffs], Fri Feb 8 13:29:09 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.153: +2 -2 lines
Diff to previous 1.153 (colored)

retain the MX address order as sent by the lka for MXs with the same
preference.

issue spotted by todd@

ok gilles@

Revision 1.153 / (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.152: +0 -2 lines
Diff to previous 1.152 (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.152 / (download) - annotate - [select for diffs], Tue Feb 5 10:53:57 2013 UTC (11 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.151: +3 -3 lines
Diff to previous 1.151 (colored)

Spelling fixes: retreive -> retrieve. ok gilles

Revision 1.151 / (download) - annotate - [select for diffs], Mon Jan 28 16:40:22 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.150: +41 -23 lines
Diff to previous 1.150 (colored)

use a stripped-down mta_envelope structure in the mta process.
reduces memory footprint by a great deal when relaying lots of messages.

ok gilles@

Revision 1.150 / (download) - annotate - [select for diffs], Mon Jan 28 11:09:53 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.149: +2 -5 lines
Diff to previous 1.149 (colored)

- introduce 'smtpctl trace lookup' to trace lookup process
- improve logging of the transfer process

trace by me, logging by eric

Revision 1.149 / (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.148: +1375 -288 lines
Diff to previous 1.148 (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.148 / (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.147: +27 -11 lines
Diff to previous 1.147 (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.147 / (download) - annotate - [select for diffs], Thu Oct 11 21:52:59 2012 UTC (11 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.146: +1 -2 lines
Diff to previous 1.146 (colored)

- no need to assign a separator to the last route flag since we're not
	going to use it

Revision 1.146 / (download) - annotate - [select for diffs], Wed Oct 10 17:57:05 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.145: +9 -3 lines
Diff to previous 1.145 (colored)

show the port number for a relay if specified.

ok gilles@

Revision 1.145 / (download) - annotate - [select for diffs], Sun Oct 7 14:55:48 2012 UTC (11 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

bump max number of connections to a route from 5 to 10, the limit is too
low as experienced by myself and another user.

discussed with and ok eric@

Revision 1.144 / (download) - annotate - [select for diffs], Fri Sep 28 14:03:00 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.143: +5 -10 lines
Diff to previous 1.143 (colored)

use xmemdup() and xcalloc() helpers

ok eric@

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

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

ok gilles@

Revision 1.142 / (download) - annotate - [select for diffs], Tue Sep 18 14:23:01 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.141: +2 -4 lines
Diff to previous 1.141 (colored)

- add xmemdup() helper.
- remove useless block in switch.

ok gilles@

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

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

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

ok gilles@

Revision 1.140 / (download) - annotate - [select for diffs], Thu Aug 30 18:16:25 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.139: +7 -2 lines
Diff to previous 1.139 (colored)

- correctly free the task if all rcpt where rejected
- fix refcounting
- add some stat counters

ok gilles@ chl@

Revision 1.139 / (download) - annotate - [select for diffs], Wed Aug 29 16:26:17 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.138: +1 -2 lines
Diff to previous 1.138 (colored)

Introduce the crypto_backend API and provide support for... encrypted queue
using the new API. By default, OpenSMTPD does not provide queue encryption,
but it can be enabled with "queue encryption [args]" and will transparently
encrypt/decrypt envelopes/messages as they hit the queue.

By default, it will use Blowfish in CBC mode with a different random IV for
each envelope and message. User provided key is expanded using sha256 but a
different cipher and digest may be specified in smtpd.conf

Queue encryption is compatible with compression and if both options are set
it will do them in correct order and transparently.

tested by chl@, a few users and myself
ok chl@ and I

Revision 1.138 / (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.137: +3 -2 lines
Diff to previous 1.137 (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.137 / (download) - annotate - [select for diffs], Wed Aug 22 11:44:34 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.136: +4 -1 lines
Diff to previous 1.136 (colored)

also need to compare backupname if set.

Revision 1.136 / (download) - annotate - [select for diffs], Tue Aug 21 20:19:46 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.135: +25 -12 lines
Diff to previous 1.135 (colored)

Allow smtpd to work as a backup MX, relaying only to MXs with higher
priority in the DNS record. For example:

   accept for domain "foo.org" relay backup "mx3.foo.org"

will relay mails for "foo.org" using only hosts with higher priority
(i.e. lower value) than "mx3.foo.org", which is supposed to be the
current server.

If the specified backup MX is not found in the DNS record, relaying
works as normal.

ok gilles@

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

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

ok gilles@

Revision 1.134 / (download) - annotate - [select for diffs], Sat Aug 18 15:45:12 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.133: +364 -11 lines
Diff to previous 1.133 (colored)

Major update of the mta internals.

Add a mta_route structure which describes a route through which
outgoing mails are to be sent.  This structure holds connection
parameters and limits.  When an envelope is received in a batch,
the route for it is looked up, and the envelope is added to the
a list of envelope to be sent for this message on that route: a
task.  When the batch is closed, each task is added to the list
of tasks for their respective route.

The routes are drained when new work can happen. The route will
create new mta sessions if necessary.  When a session is up and
ready, it picks the first pending task on the route if any.  In
the other case, it just closes the connection.

Errors on the connection are reported to the route, so that the
route could be flagged as broken.  Currently, three errors on a
an attempt to open a route is reported as a failure for all pen-
ding tasks.

ok gilles@

Revision 1.133 / (download) - annotate - [select for diffs], Sun Jul 29 13:56:24 2012 UTC (11 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.132: +1 -3 lines
Diff to previous 1.132 (colored)

remove the session tree from the global env and move it to mta_session.c,
along with mta_relay and mta_session definition.

ok gilles@

Revision 1.132 / (download) - annotate - [select for diffs], Fri May 11 12:12:02 2012 UTC (12 years, 1 month ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.131: +4 -810 lines
Diff to previous 1.131 (colored)

split the session logic off mta.c into mta_session.c

ok gilles@

Revision 1.131 / (download) - annotate - [select for diffs], Fri May 11 08:15:30 2012 UTC (12 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.130: +13 -23 lines
Diff to previous 1.130 (colored)

set the status line and log envelope change in mta_envelope_done().
get rid of mta_envelope_log() and makes the code a little more
straightforward.

ok gilles@

Revision 1.130 / (download) - annotate - [select for diffs], Fri Mar 30 16:48:30 2012 UTC (12 years, 2 months ago) by chl
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored)

increase timeout to 5m when connecting to a remote mail server, as required
by the RFC 5321 (section 4.5.3.2.1.)

ok gilles@

Revision 1.129 / (download) - annotate - [select for diffs], Tue Mar 27 12:53:33 2012 UTC (12 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.128: +10 -3 lines
Diff to previous 1.128 (colored)

Do not try STARTTLS if the server does not advertise support
for it (it apparently triggers very bizarre behaviour on some
servers). Also make sure we are not using AUTH over a clear
channel.

ok gilles@

Revision 1.128 / (download) - annotate - [select for diffs], Sun Mar 25 08:44:24 2012 UTC (12 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.127: +14 -3 lines
Diff to previous 1.127 (colored)

Do not fatal() when failing to connect to a relay.
Instead, drop the relay and try the next one.

ok gilles@

Revision 1.127 / (download) - annotate - [select for diffs], Wed Feb 1 20:30:40 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.126: +28 -51 lines
Diff to previous 1.126 (colored)

When updating an envelope status, the update is immediatly sent to the
queue and the envelope discarded from the mta batch.  Also make sure
that all condition leading to the MTA_DONE state have properly set the
status of all pending envelopes before. No envelope should be left when
entering that state.

Little cleanup while there: remove mta_message_status() and rename
remaining mta_message_*() to mta_envelope_* to avoid confusion.

ok gilles@

Revision 1.126 / (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.125: +473 -202 lines
Diff to previous 1.125 (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.125 / (download) - annotate - [select for diffs], Sat Jan 28 11:33:06 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.124: +20 -20 lines
Diff to previous 1.124 (colored)

- introduce the scheduler_backend API
- introduce the scheduler_ramqueue backend
- remove all occurences of ramqueue outside of the ramqueue backend
- teach runner how to use the new API

it is now possible to write custom schedulers !

ok eric@, ok chl@

Revision 1.124 / (download) - annotate - [select for diffs], Thu Jan 26 12:31:53 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.123: +2 -1 lines
Diff to previous 1.123 (colored)

Rewind the message fp before starting the SMTP dialog.
It could have been read before during an aborted session
on a previous MX.

reported by Vianney Bouchaud <vianney@poolp.org>

ok gilles@

Revision 1.123 / (download) - annotate - [select for diffs], Fri Jan 13 14:01:57 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.122: +11 -9 lines
Diff to previous 1.122 (colored)

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

- IMSG_QUEUE_DELIVERY_OK
- IMSG_QUEUE_DELIVERY_TEMPFAIL
- IMSG_QUEUE_DELIVERY_PERMFAIL

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

ok gilles@ chl@

Revision 1.122 / (download) - annotate - [select for diffs], Wed Jan 11 22:12:07 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.121: +1 -2 lines
Diff to previous 1.121 (colored)

remove bogus call

ok gilles@

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

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

ok chl@ gilles@

Revision 1.120 / (download) - annotate - [select for diffs], Sun Dec 11 17:02:10 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.119: +35 -48 lines
Diff to previous 1.119 (colored)

Make the mta code a bit more straightforward:
- fetch the ssl cert earlier on if needed
- skip mta_pickup() when handling the incoming fd

ok gilles@

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

when receiving an unexpected imsg, print its name.

with help and ideas from eric@

ok eric@ gilles@

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

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

While there, cast some time_t to int64_t

These will fix build warnings for portable smptd

ok gilles@ eric@

Revision 1.117 / (download) - annotate - [select for diffs], Sun Oct 23 17:09:56 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.116: +2 -1 lines
Diff to previous 1.116 (colored)

plug leak

spotted by chl@

ok chl@

Revision 1.116 / (download) - annotate - [select for diffs], Sun Oct 23 15:36:53 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.115: +12 -10 lines
Diff to previous 1.115 (colored)

a few important fixes:

- use correct endianness when dumping/loading port
- use the right flag set when dumping/loading flags
- keep and use the authmap name when needed, rather than an id that
  might change when smtpd is restarted
- dump/load the authmap name with the envelope
- remove the rule struct from rq_batch as only the relay info is useful

ok gilles@

Revision 1.115 / (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.114: +22 -22 lines
Diff to previous 1.114 (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.114 / (download) - annotate - [select for diffs], Sun Oct 9 18:39:53 2011 UTC (12 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.113: +3 -1 lines
Diff to previous 1.113 (colored)

show messages sent between processes in debug mode

ok gilles@ chl@

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

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

ok gilles@

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

add missing header needed by signal()

ok gilles@

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

add missing header needed by time()

ok gilles@

Revision 1.110 / (download) - annotate - [select for diffs], Wed Jul 20 10:22:54 2011 UTC (12 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.109: +10 -10 lines
Diff to previous 1.109 (colored)

Fix reporting of permanent/temporary failures for MX lookups.
Simplify code a bit while there.

ok gilles@

Revision 1.109 / (download) - annotate - [select for diffs], Tue Jul 19 13:15:54 2011 UTC (12 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.108: +3 -2 lines
Diff to previous 1.108 (colored)

Re-add the test which is needed in the case where the session fails
early (in MX or SECRET) and the data file is not yet opened.

ok gilles@

Revision 1.108 / (download) - annotate - [select for diffs], Wed Jul 6 20:56:16 2011 UTC (12 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.107: +2 -3 lines
Diff to previous 1.107 (colored)

fix that fscking "fgetln(): bad file descriptor" bug experienced by many.

long story short: datafp is reused by the possibly multiple client sessions
of a MTA session. fclosing it in client_close() will cause the file pointer
to be invalidated as soon as we fail the primary MX and attempt the second.

bug introduced while trying to fix a leak causing a crash for a user, now
smtpd will unconditionnally fclose() in MTA_DONE and if a leak still exists
then we should track why the mta session doesnt reach MTA_DONE.

Revision 1.107 / (download) - annotate - [select for diffs], Sat May 21 18:39:03 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.106: +1 -3 lines
Diff to previous 1.106 (colored)

remove annoying log_debug()

Revision 1.106 / (download) - annotate - [select for diffs], Mon May 16 21:05:52 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.105: +49 -47 lines
Diff to previous 1.105 (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.105 / (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.104: +29 -30 lines
Diff to previous 1.104 (colored)

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

discussed with and ok gilles@

Revision 1.104 / (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.103: +33 -36 lines
Diff to previous 1.103 (colored)

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

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

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

Revision 1.102 / (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.101: +6 -5 lines
Diff to previous 1.101 (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.101 / (download) - annotate - [select for diffs], Wed Apr 13 20:53:18 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.100: +31 -23 lines
Diff to previous 1.100 (colored)

following an idea from jacekm@, smtpd now uses a ram-queue instead of doing
a continuous walk on the disk-queue. the implementation differs from what
jacekm@ commited (and I backed out) a while ago in that it uses a queue and
a host tree required for upcoming features.

code will be improved in tree, it requires changes to be done in queue and
bounce API, I just wanted to commit a working version first ...

tested by todd@ and I

Revision 1.100 / (download) - annotate - [select for diffs], Sat Mar 26 17:43:01 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.99: +5 -2 lines
Diff to previous 1.99 (colored)

check that we actually have a stdio stream opened for the message before
trying to close it in a mta session. in case of DNS errors; this pointer
will remain NULL and cause a segv in MTA_DONE state.

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

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

diff by Jared Yanovich, thanks !

Revision 1.98 / (download) - annotate - [select for diffs], Mon Mar 21 13:02:52 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

- reset smtp_client pointer to NULL after client_close()
- datafd is closed in client_close()

Revision 1.97 / (download) - annotate - [select for diffs], Mon Nov 29 15:25:55 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.96: +10 -5 lines
Diff to previous 1.96 (colored)

replace the fork-based-non-blocking-resolver-hack by shiny async resolver
written by eric@. it is still experimental but still better than what we
had earlier so ... we'll improve in tree :)

diff by me with *lots* of help from eric@, tested by todd and I (and a
few people out there)

Revision 1.96 / (download) - annotate - [select for diffs], Sun Nov 28 14:35:58 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.95: +1 -6 lines
Diff to previous 1.95 (colored)

remove all unused headers

Revision 1.95 / (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.94: +3 -1 lines
Diff to previous 1.94 (colored)

a bit of .h cleanups, no functionnal change

Revision 1.94 / (download) - annotate - [select for diffs], Fri Oct 29 09:16:07 2010 UTC (13 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.93: +5 -2 lines
Diff to previous 1.93 (colored)

smtpd no longer knows a map called "secrets" which holds credentials for
authenticated relaying. one can create many maps holding credentials and
name them however he/she wants, just like any other map.

teach smtpd how to select a credentials map at the rule-level allowing a
setup to relay through the same MX with different credentials depending
on the source.

smtpd.conf.5 updated to reflect changes with help from jmc@

Revision 1.93 / (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.92: +189 -133 lines
Diff to previous 1.92 (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.92 / (download) - annotate - [select for diffs], Wed Jun 2 19:16:53 2010 UTC (14 years ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.91: +3 -2 lines
Diff to previous 1.91 (colored)

check event_dispatch() return value

ok jacekm@

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

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.89 / (download) - annotate - [select for diffs], Tue Jun 1 11:05:12 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored)

Better errors.

Revision 1.88 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.87: +135 -187 lines
Diff to previous 1.87 (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.87 / (download) - annotate - [select for diffs], Wed Apr 21 18:54:43 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.86: +8 -13 lines
Diff to previous 1.86 (colored)

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

OK gilles@

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

Remove unusable ifdef DEBUG code.

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

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

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

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

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

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

ok jacekm@

Revision 1.83 / (download) - annotate - [select for diffs], Wed Dec 23 17:16:03 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.82: +17 -15 lines
Diff to previous 1.82 (colored)

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

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

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

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

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

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

Tested by todd@ and oga@

"looks good" to gilles@

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

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

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

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

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

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

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

tested by gilles@, todd@

Revision 1.79 / (download) - annotate - [select for diffs], Thu Dec 10 15:02:30 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.78: +2 -2 lines
Diff to previous 1.78 (colored)

Fix a case when 2yz status would not override existing 4yz one.
Reported by jsing@

Revision 1.78 / (download) - annotate - [select for diffs], Mon Dec 7 15:33:42 2009 UTC (14 years, 6 months ago) by jsing
Branch: MAIN
Changes since 1.77: +5 -3 lines
Diff to previous 1.77 (colored)

Avoid dereferencing a null pointer when logging a DNS lookup failure.

ok gilles@

Revision 1.77 / (download) - annotate - [select for diffs], Mon Nov 16 09:40:43 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.76: +40 -41 lines
Diff to previous 1.76 (colored)

Minimize the delay between receiving response to "." and removing the queue
entry in order to avoid the risk of sending duplicate mail.

Revision 1.76 / (download) - annotate - [select for diffs], Fri Nov 13 11:27:52 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.75: +69 -29 lines
Diff to previous 1.75 (colored)

Log FQDN and IP of the server we handed mail to.  As a bonus, don't delay
logging of successful deliveries until all MXs were tried, plus add logging
of 5yz replies.

tested by todd@, "reads ok" gilles@

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

add missing headers needed by time()

ok jacekm@

Revision 1.74 / (download) - annotate - [select for diffs], Thu Nov 5 12:11:53 2009 UTC (14 years, 7 months ago) by jsing
Branch: MAIN
Changes since 1.73: +11 -2 lines
Diff to previous 1.73 (colored)

Consider DNS lookups that result in NXDOMAIN to be a permanent failure.

ok gilles@ jacekm@

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

Introduce a 6yz status code, used internally to report permanent errors.
The 1yz and 6yz status codes are now removed prior to reporting the status
message in bounce messages, which provides an easy way to distinguish
between local and remote status messages. Initial diff from jacekm@

ok gilles@ jacekm@

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

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

Revision 1.71 / (download) - annotate - [select for diffs], Tue Sep 8 09:50:51 2009 UTC (14 years, 9 months ago) by landry
Branch: MAIN
Changes since 1.70: +2 -1 lines
Diff to previous 1.70 (colored)

Cope with remote host sending '452 Insufficient system storage'.
Committing on behalf of gilles@ who doesn't have access to a safe box.

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

imsg_get sets errno so use fatal instead of fatalx.

Revision 1.69 / (download) - annotate - [select for diffs], Wed Aug 26 16:40:19 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.68: +2 -1 lines
Diff to previous 1.68 (colored)

fix previous

Revision 1.68 / (download) - annotate - [select for diffs], Wed Aug 26 09:12:41 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.67: +1 -6 lines
Diff to previous 1.67 (colored)

Do not add Delivered-To to outgoing mail.  It will result in premature
bounce as soon as it hits mx2 in mx1 -> mx2 -> mx3 relay chain.
hint by sthen@, ok gilles@

Revision 1.67 / (download) - annotate - [select for diffs], Sat Aug 8 23:02:43 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.66: +6 -3 lines
Diff to previous 1.66 (colored)

- simplify a bit queue_message_update()
- make sure queue_message_update() creates bounces using bounce_record()
- when mta sends update to queue and it sees that batch is flagged with
  F_BATCH_PERMFAIL, only update the envelope error message if it doesn't
  have F_MESSAGE_PERMFAIL set, otherwise we may lose the real reason why
  we failed for that recipient. There's cleanup to do around that old
  code, i'm sure we can get it simpler.

this commit fixes a bug pea@ spotted where a bounce message would not
display the reason of a failure when we generated it after failing to
deliver a relayed message.

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

in mta: ssl/ssl.h -> openssl/ssl.h, consistent with other files

Revision 1.65 / (download) - annotate - [select for diffs], Thu Aug 6 19:05:30 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.64: +3 -3 lines
Diff to previous 1.64 (colored)

fix a crash in mta when forwarding a bounce, caused by a null deref

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

replace X-OpenSMPTD-Loop with Delivered-To

idea by jacekm@ a few weeks ago, discussed with pyr

Revision 1.63 / (download) - annotate - [select for diffs], Thu Aug 6 14:12:48 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.62: +4 -3 lines
Diff to previous 1.62 (colored)

- introduce message_set_errormsg() to set the error description that will
  appear in a bounce message, and message_get_errormsg() to retrieve that
  message.
- when loop is detected, call message_set_errormsg()
- in mta, call message_set_errormsg() for each recipient failure
- in mta, call message_set_errormsg() to copy batch errors to recipients if
  we failed to deliver for a session related error
- when bouncing, add the recipient and error reason to the bounce message

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

This commit reworks the entire mailer daemon support to actually make it
work for real. As an added bonus, it simplifies it, makes it follow the
same code path as regular messages and kills quite some code from mta,
mda and store. There's still some work needed but the most painful part
is behind us now ;)

ok jacekm@

Revision 1.61 / (download) - annotate - [select for diffs], Sat Jun 20 07:46:13 2009 UTC (14 years, 11 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.60: +4 -1 lines
Diff to previous 1.60 (colored)

Allocate memory for env->sc_ssl like in smtp; ok gilles@

From: Josh Elsasser <josh@elsasser.org>

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

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

Currently the receiver fetches an imsg via imsg_get() and if he expects
an fd, he then calls imsg_get_fd() to fetch the next fd queued on the
imsgbuf from which the imsg came.

This changes hides the fd queueing mechanism to the API user.  When closing
an imsg with an fd, the message is flagged so that the receiving end knows
it must dequeue the fd in imsg_get() and return it with the imsg structure.
This way there is no (less) possible screw up from imsg_get_fd() not being
called directly after imsg_get() by the user. The retreived imsg is
self-contained.

ok pyr@, "I like that" henning@

Revision 1.59 / (download) - annotate - [select for diffs], Sat Jun 6 04:14:21 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.58: +24 -16 lines
Diff to previous 1.58 (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.58 / (download) - annotate - [select for diffs], Fri Jun 5 20:43:57 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.57: +5 -5 lines
Diff to previous 1.57 (colored)

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

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

simplify struct batch; ok gilles@

Revision 1.56 / (download) - annotate - [select for diffs], Tue Jun 2 22:23:35 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (colored)

make env->sc_listeners and env->sc_ssl pointers, one step further toward
configuration reloading without killing active sessions; ok jacekm@

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

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

Revision 1.54 / (download) - annotate - [select for diffs], Sun May 31 18:34:48 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.53: +4 -1 lines
Diff to previous 1.53 (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.53 / (download) - annotate - [select for diffs], Sat May 30 23:53:41 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.52: +38 -1 lines
Diff to previous 1.52 (colored)

It is now possible to specify a certificate to use when relaying to another
host which requests client certificates:

	accept [...] relay via [...] ssl certificate "mycert"

diff from Josh Elsasser <josh@elsasser.org>, tested and okayed by me with
no change but the addition of status 554 to the state machine to deal with
remote host telling us it doesn't like our certificate.

Revision 1.52 / (download) - annotate - [select for diffs], Sat May 30 16:32:59 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.51: +2 -1 lines
Diff to previous 1.51 (colored)

increment mta.sessions in when we allocate a new session in mta

Revision 1.51 / (download) - annotate - [select for diffs], Sat May 30 16:30:33 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.50: +3 -1 lines
Diff to previous 1.50 (colored)

- increment stats.mta.sessions_active when session is allocated in mta
- reorder alphabetically and add mta to the statistics

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

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

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

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

Manage process titles centrally in struct smtpd.

ok gilles@

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

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

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

use the nitems() macro where appropriate

ok gilles@, jacekm@

Revision 1.46 / (download) - annotate - [select for diffs], Wed May 13 21:29:16 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

do MX lookups in both "relay" and "relay via" case; ok gilles@

Revision 1.45 / (download) - annotate - [select for diffs], Sat May 9 17:04:55 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.44: +76 -41 lines
Diff to previous 1.44 (colored)

- New API to handle all DNS query types (A, MX, PTR) asynchronously.

- Improve RFC compliance: CNAMEs are resolved, equal preference MXs
are randomized, relaying via MX that has equal/lower preference
than local server is prevented, decision on when to treat domain
name as implicit MX is better.

ok gilles@

Revision 1.44 / (download) - annotate - [select for diffs], Tue Apr 28 21:56:36 2009 UTC (15 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.43: +25 -30 lines
Diff to previous 1.43 (colored)

in mta, change the batch status to S_BATCH_TEMPFAILURE by default so that
we need to explicitely set success and permanent failures, this way if we
hit any condition that we don't explicitely flag as permanent failure the
delivery will be rescheduled later.

while at it, made various checks more strict to prevent hiding bugs and a
bit of knr cleanups

discussed with and "reads good" jacekm@

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

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

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

correct some fatal(x) calls and error strings

ok gilles@ jacekm@

Revision 1.41 / (download) - annotate - [select for diffs], Wed Apr 15 20:02:12 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.40: +4 -2 lines
Diff to previous 1.40 (colored)

fix a bug where after all MX-es were found to be non-contactable,
smtpd would treat the delivery as successful; ok gilles@

Revision 1.40 / (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.39: +2 -2 lines
Diff to previous 1.39 (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.39 / (download) - annotate - [select for diffs], Sun Mar 29 14:18:20 2009 UTC (15 years, 2 months ago) by jacekm
Branch: MAIN
Changes since 1.38: +9 -9 lines
Diff to previous 1.38 (colored)

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

Revision 1.38 / (download) - annotate - [select for diffs], Thu Mar 19 00:12:32 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.37: +8 -5 lines
Diff to previous 1.37 (colored)

in the event of a timeout, mxhost is passed to TAILQ_REMOVE before it is
initialized.
spotted and diff by Matthew Haub <matthew.haub@alumni.adelaide.edu.au>

Revision 1.37 / (download) - annotate - [select for diffs], Wed Mar 18 23:51:34 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.36: +6 -3 lines
Diff to previous 1.36 (colored)

remove debug X-Cipher and turn it into a useful log_info()

Revision 1.36 / (download) - annotate - [select for diffs], Wed Mar 18 00:07:41 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.35: +6 -3 lines
Diff to previous 1.35 (colored)

in mta, when remote host advertises AUTH, do not attempt to authenticate
unless we do have F_AUTH set on the mxhost (which means we explicitely
mentionned authentication in config) and we did find credentials in the
secrets map. issue and initial diff from Rivo Nurges <rix@estpak.ee>

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

the mda process no longer uses struct batch as its central structure to
deal with deliveries, it now uses struct session just like mta and smtp
processes. we now keep the mbox and message descriptors in the session,
saving space in struct message which is now as small as we can make it.
While at it, plugged a memory leak and did some cosmethic changes

This was the last planned change to our struct message which means that
later changes will no longer require a queue flush before rebuild.

Revision 1.34 / (download) - annotate - [select for diffs], Thu Mar 12 11:08:26 2009 UTC (15 years, 3 months ago) by pea
Branch: MAIN
Changes since 1.33: +4 -2 lines
Diff to previous 1.33 (colored)

Add new function time_to_text to correctly display the date.
Use it to display the date in received from header and when we
store headers.

ok jacekm@

Revision 1.33 / (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.32: +10 -1 lines
Diff to previous 1.32 (colored)

implement basic logging, needs more work; ok gilles@

Revision 1.32 / (download) - annotate - [select for diffs], Mon Mar 9 01:43:19 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.31: +178 -144 lines
Diff to previous 1.31 (colored)

add basic support for outgoing authentication (AUTH PLAIN over ssl) which
can be turned on by adding "enable auth" to a "relay via" rule. this made
me rework the mx resolution so that it is done by the mta process and not
the runner process anymore.

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

add missing headers

ok gilles@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Feb 22 11:59:12 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.29: +4 -19 lines
Diff to previous 1.29 (colored)

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

Revision 1.29 / (download) - annotate - [select for diffs], Sun Feb 22 11:44:29 2009 UTC (15 years, 3 months ago) by form
Branch: MAIN
Changes since 1.28: +14 -9 lines
Diff to previous 1.28 (colored)

replace MAX* constants by sizeof where possible

ok jacekm@

Revision 1.28 / (download) - annotate - [select for diffs], Fri Feb 20 15:27:01 2009 UTC (15 years, 3 months ago) by pea
Branch: MAIN
Changes since 1.27: +19 -12 lines
Diff to previous 1.27 (colored)

Fix "Received: from" headers

ok gilles@

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

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

Revision 1.26 / (download) - annotate - [select for diffs], Thu Jan 29 15:40:34 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.25: +1 -4 lines
Diff to previous 1.25 (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.25 / (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.24: +17 -3 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Thu Jan 29 14:50:27 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.23: +5 -13 lines
Diff to previous 1.23 (colored)

fix a bug in mta's event masking

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

initial starttls support in mta, this allows:

	accept for domain "openbsd.org" relay via tls "mx.example.org"

to ensure the relaying of mail for whoever@openbsd.org will happen through
a secure tls (STARTTLS) session. failure to establish a tls session will be
considered as a permanent failure. As a side effect:

	accept for domain "openbsd.org" relay via ssl "mx.example.org"

can now work as well and ensure that the relaying happens through ssmtp OR
tls, but never through an unsafe channel. no need to specify a port, they
are automatically detected if not specified.

still a work in progress, don't expect that it will work flawlessly.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jan 29 13:00:12 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.21: +20 -23 lines
Diff to previous 1.21 (colored)

bring initial support for SSL in the mta part of smtpd, allowing for:

	accept for domain "openbsd.org" relay via ssmtp "mx1.example.org"

to ensure that deliveries for whatever@openbsd.org goes through an SSL session
to mx1.example.org

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jan 28 23:46:03 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.20: +12 -10 lines
Diff to previous 1.20 (colored)

fix missing prototype and format related warnings

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jan 28 23:38:49 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.19: +51 -44 lines
Diff to previous 1.19 (colored)

now that mta uses a struct session, it can also use session_respond() just
as smtp_session.c does, so move all of the evbuffer_add_printf() calls out
of the way and replace them with session_respond() call.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Jan 28 23:13:42 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.18: +15 -15 lines
Diff to previous 1.18 (colored)

mta session state belongs to struct session, not struct batch, remove the
state field from struct batch and propagate the change

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jan 28 22:54:10 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.17: +59 -58 lines
Diff to previous 1.17 (colored)

everything we need for the event handling dance is in struct session, the
write handler has been changed to set the bufferevent that's in there
rather than the one in struct batch. since struct batch is no longer doing
anything useful for events handling, we can remove many fields of it.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jan 28 22:27:56 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.16: +7 -2 lines
Diff to previous 1.16 (colored)

since we're expanding "relay via ssl foobar.org" into two mxhosts (one with
F_SSMTP on port 465 and one with F_STARTTLS on port 25) both mxhosts should
only retain the flag that they will use ("via ssl" means the mxhost before
expansion has both flags set). this will make mta_connect() simpler when we
bring ssl support in the way.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jan 28 21:44:15 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.15: +165 -19 lines
Diff to previous 1.15 (colored)

first steps towards better mta code. currently mta uses struct batch to
store a lot of its session related code, but this is just not right and
this commit starts making mta code aware of struct session. This will
ease the implementation of ssl sessions in mta.

while at it, make mta autodetect port to use if it isn't provided in a
rule but can be derived from a parameter (i.e: "relay via ssmtp ...").

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jan 28 13:29:40 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

bring loop detection support. we handle this with a qmail-like approach which
consists of checking headers for a custom header, but we also count how many
hops the mail went through and use a hard limit (currently set to 100 as was
recommanded by RFC) as a safe-guard.

idea discussed with jacekm@, qmail approach suggested by claudio@ a long time
ago

Revision 1.14 / (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.13: +5 -2 lines
Diff to previous 1.13 (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.13 / (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.12: +9 -1 lines
Diff to previous 1.12 (colored)

dot escaping, as required by rfc; ok gilles@

Revision 1.12 / (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.11: +1 -4 lines
Diff to previous 1.11 (colored)

remove unnecessary includes; ok gilles@

Revision 1.11 / (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.10: +2 -2 lines
Diff to previous 1.10 (colored)

IMSG_* namespace cleanup.

ok gilles@

Revision 1.10 / (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.9: +1 -3 lines
Diff to previous 1.9 (colored)

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

ok gilles

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

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

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

- last part of the new queue code: the runner process (unprivileged and
	chrooted) is now in charge of doing the scheduling of deliveries,
	and the dispatching of messages to MDA and MTA. queue process only
	does inserts/updates/removals from the queue and can no longer be
	so busy that it delays answers to imsg from smtp server.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Nov 25 20:26:40 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.6: +11 -11 lines
Diff to previous 1.6 (colored)

- recent change in parse.y caused htons() to be called twice on the port
	provided to "relay via" rules, once in parse.y once in lka.c, fix.
- rename struct address to struct relayhost, introduce struct mxhost which
	not only holds the sockaddr_storage, but also additionnal flags we
	want forwarded to the mta process.
- propagate the change

Revision 1.6 / (download) - annotate - [select for diffs], Mon Nov 24 22:30:19 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.5: +2 -4 lines
Diff to previous 1.5 (colored)

- not really a bug since we don't use other descriptor flags, but in
	smtp_setup_events() and mta_connect(), our fcntl() use clears
	flags. use session_socket_blockmode() instead, it makes more
	sense anyway. From Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.5 / (download) - annotate - [select for diffs], Tue Nov 11 02:14:58 2008 UTC (15 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.4: +4 -3 lines
Diff to previous 1.4 (colored)

some small improvements.  ok gilles

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

- define MAX_LINE_SIZE which is the maximum length of a line we allow from
	a client. it must be set to the highest value we have from all of
	the extensions which are/will be implemented.
- replace all occurences of STRLEN define with MAX_LINE_SIZE, kill STRLEN

Revision 1.3 / (download) - annotate - [select for diffs], Mon Nov 10 02:34:50 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.2: +6 -1 lines
Diff to previous 1.2 (colored)

- plug a descriptor leak when session is aborted by a server error instead
	of a client QUIT or client timeout

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.