OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.351 / (download) - annotate - [select for diffs], Tue May 7 12:10:06 2024 UTC (4 weeks, 6 days ago) by op
Branch: MAIN
CVS Tags: HEAD
Changes since 1.350: +5 -2 lines
Diff to previous 1.350 (colored)

change the smtpd table protocol

Using imsg for the "proc" table (external programs) has proven quite
painful in practice since a lot of smtpd internals (structs, enums,
etc..) have to be kept in sync with the various tables implementations.

Instead, a filter-like protocol for tables decouples the implementations
and allows to write and test tables easily.

The new text-based transport protocol is documented in the (added)
smtpd-tables(7) manpage.

The old imsg protocol is no longer supported and existing tables have to
be converted.  In particular, users of opensmtpd-extras tables will need
install the new opensmtpd-table-* packages.

With lots of suggestions and improvements from gilles and a tweak
from Philipp (philipp+openbsd [at] bureaucracy [dot] de), thanks!

ok gilles

Revision 1.350 / (download) - annotate - [select for diffs], Wed Apr 24 21:31:31 2024 UTC (6 weeks, 4 days ago) by op
Branch: MAIN
Changes since 1.349: +2 -2 lines
Diff to previous 1.349 (colored)

fix error return in fork_proc_backend(); ok gilles@

Revision 1.349 / (download) - annotate - [select for diffs], Sat Feb 3 15:50:00 2024 UTC (4 months ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.348: +4 -1 lines
Diff to previous 1.348 (colored)

leave the command for mbox delivery unset

The mbox delivery is handled apart from the other delivery methods.
Since the mda is already hardcoded in mda_mbox(), there's no need to
fill the command string in parse.y.  While here also assess that for
mbox deliveries the command is unset at delivery time too.

based on a diff by gilles

ok gilles@, millert@

Revision 1.348 / (download) - annotate - [select for diffs], Fri Feb 2 22:02:12 2024 UTC (4 months, 1 week ago) by gilles
Branch: MAIN
Changes since 1.347: +4 -11 lines
Diff to previous 1.347 (colored)

there's no good reason to allow smtpd to execute custom command set by root
in a .forward file so disallow custom commands and file reading, only allow
setting forward addresses and users.

as root is no longer allowed to run any MDA but mbox, we can be stricter on
the setup of the MDA process and refuse to exec anything that's not an mbox
dispatcher.

tested by op@ who edited a root envelope to simulate an exploit injecting a
custom command in a root envelope, smtpd refused to exec.

ok millert@ and op@

Revision 1.347 / (download) - annotate - [select for diffs], Sat Jan 20 09:01:03 2024 UTC (4 months, 2 weeks ago) by claudio
Branch: MAIN
Changes since 1.346: +8 -15 lines
Diff to previous 1.346 (colored)

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

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

Revision 1.346 / (download) - annotate - [select for diffs], Sun Jun 18 17:28:42 2023 UTC (11 months, 3 weeks ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.345: +8 -4 lines
Diff to previous 1.345 (colored)

sync imsg_to_str() with the list of imsg types in smtpd.h

ok millert@

Revision 1.345 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months, 1 week ago) by op
Branch: MAIN
Changes since 1.344: +2 -1 lines
Diff to previous 1.344 (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.344 / (download) - annotate - [select for diffs], Wed Feb 8 08:20:54 2023 UTC (16 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.343: +2 -2 lines
Diff to previous 1.343 (colored)

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

Revision 1.343 / (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_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.342: +3 -1 lines
Diff to previous 1.342 (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.342 / (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.341: +2 -4 lines
Diff to previous 1.341 (colored)

use new libtls signer api

ok tb@

Revision 1.341 / (download) - annotate - [select for diffs], Wed Jul 14 13:33:57 2021 UTC (2 years, 10 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.340: +1 -3 lines
Diff to previous 1.340 (colored)

Remove unneeded calls to tls_init(3)

As per the manual and lib/libtls/tls.c revision 1.79 from 2018
"Automatically handle library initialisation for libtls." initialisation
is handled automatically by other tls_*(3) functions.

Remove explicit tls_init() calls from base to not give the impression of
it being needed.

Feedback tb
OK Tests mestre

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

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

ok jung@

Revision 1.339 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.338: +37 -39 lines
Diff to previous 1.338 (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.338 / (download) - annotate - [select for diffs], Wed Apr 21 07:54:10 2021 UTC (3 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.337: +1 -5 lines
Diff to previous 1.337 (colored)

unplug unused certificate verification code, now that this is done by libtls.

ok tb@ millert@

Revision 1.337 / (download) - annotate - [select for diffs], Fri Mar 5 12:37:32 2021 UTC (3 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.336: +3 -2 lines
Diff to previous 1.336 (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.336 / (download) - annotate - [select for diffs], Thu Dec 31 08:27:15 2020 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
Changes since 1.335: +64 -64 lines
Diff to previous 1.335 (colored)

Rename the pony process to dispatcher and klondike to crypto.

From gilles@
OK millert@ giovanni@

Revision 1.335 / (download) - annotate - [select for diffs], Wed Sep 23 19:11:50 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.334: +0 -30 lines
Diff to previous 1.334 (colored)

Revert agentx support for now, we're too close to release.

requested by deraadt@

Revision 1.334 / (download) - annotate - [select for diffs], Wed Sep 23 18:01:27 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
Changes since 1.333: +31 -1 lines
Diff to previous 1.333 (colored)

Add support for agentx to smtpd.

This is based around NETWORK-SERVICES-MIB from RFC2788 and MTA-MIB from
RFC2789, but does not export the full spec. Hopefully this will expand in
the future.

People who want to use this against net-snmp (currently the only option
known to me at the time of writing) may want to add -I -mta_sendmail to the
flags, so net-snmp doesn't throw garbage into the mib-2.28 subtree.

Revision 1.333 / (download) - annotate - [select for diffs], Wed May 6 16:03:30 2020 UTC (4 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.332: +3 -1 lines
Diff to previous 1.332 (colored)

Only allow forkmda() to be called from a local action dispatcher.
From gilles@, OK deraadt@ jung@

Revision 1.318.2.1 / (download) - annotate - [select for diffs], Mon Feb 24 16:20:06 2020 UTC (4 years, 3 months ago) by millert
Branch: OPENBSD_6_5
Changes since 1.318: +25 -8 lines
Diff to previous 1.318 (colored) next main 1.319 (colored)

OpenBSD 6.5 errata 031, February 24, 2020:

An out of bounds read in smtpd allows an attacker to inject arbitrary
commands into the envelope file which are then executed as root.
Separately, missing privilege revocation in smtpctl allows arbitrary
commands to be run with the _smtpq group.

Revision 1.325.2.1 / (download) - annotate - [select for diffs], Mon Feb 24 16:19:32 2020 UTC (4 years, 3 months ago) by millert
Branch: OPENBSD_6_6
Changes since 1.325: +25 -8 lines
Diff to previous 1.325 (colored) next main 1.326 (colored)

OpenBSD 6.6 errata 021, February 24, 2020:

An out of bounds read in smtpd allows an attacker to inject arbitrary
commands into the envelope file which are then executed as root.
Separately, missing privilege revocation in smtpctl allows arbitrary
commands to be run with the _smtpq group.

Revision 1.332 / (download) - annotate - [select for diffs], Mon Feb 24 16:16:08 2020 UTC (4 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.331: +25 -8 lines
Diff to previous 1.331 (colored)

Fix two security vulnerabilities discovered by Qualys.
An out of bounds read in smtpd allows an attacker to inject arbitrary
commands into the envelope file which are then executed as root.
Separately, missing privilege revocation in smtpctl allows arbitrary
commands to be run with the _smtpq group.

Revision 1.331 / (download) - annotate - [select for diffs], Mon Feb 3 15:41:22 2020 UTC (4 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.330: +7 -2 lines
Diff to previous 1.330 (colored)

now that mail.local(8) relies on lockspool(1) for mailbox locking, have the
mailbox created by smtpd for mbox before privileges are dropped then we can
call mail.local(8) with the recipient privileges.

ok millert@

Revision 1.330 / (download) - annotate - [select for diffs], Sat Feb 1 12:54:38 2020 UTC (4 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.329: +4 -2 lines
Diff to previous 1.329 (colored)

condition to enter mda_mbox() is too strict, if user have commands in their
forward file they're not supposed to enter that code path.

Revision 1.329 / (download) - annotate - [select for diffs], Fri Jan 31 22:01:20 2020 UTC (4 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.328: +6 -3 lines
Diff to previous 1.328 (colored)

introduce mda_mbox() to handle mbox delivery in its own code path, and make
it use execle() since we know all parameters and don't need command line to
be parsed.

ok millert@ and jung@

Revision 1.328 / (download) - annotate - [select for diffs], Wed Dec 18 10:00:39 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.327: +12 -12 lines
Diff to previous 1.327 (colored)

give a better name to a couple functions and struct fields related to
filters, no functional change

Revision 1.327 / (download) - annotate - [select for diffs], Fri Dec 13 08:14:51 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.326: +4 -1 lines
Diff to previous 1.326 (colored)

add IMSG_REPORT_SMTP_LINK_GREETING, IMSG_REPORT_SMTP_LINK_IDENTIFY and
IMSG_REPORT_SMTP_LINK_AUTH to imsg_to_str()

Revision 1.326 / (download) - annotate - [select for diffs], Thu Dec 12 22:10:47 2019 UTC (4 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.325: +33 -8 lines
Diff to previous 1.325 (colored)

filter protocol has an initial handshake within which smtpd tells filters
about a few global configuration informations. this makes smtpd tell proc
filters for which subsystem they are registered allowing them to register
only events that are relevant.

Revision 1.325 / (download) - annotate - [select for diffs], Tue Sep 3 04:48:20 2019 UTC (4 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.324: +12 -2 lines
Diff to previous 1.324 (colored)

Exectute procs and filters from /usr/local/libexec/smtpd/ if no absolute
path is given.

OK gilles@

Revision 1.324 / (download) - annotate - [select for diffs], Fri Jul 26 07:08:34 2019 UTC (4 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.323: +2 -1 lines
Diff to previous 1.323 (colored)

add IMSG_REPORT_SMTP_TX_RESET to imsg_to_str

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

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

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

mkstemp() returns -1 on failure

Revision 1.321 / (download) - annotate - [select for diffs], Thu Jun 27 05:14:49 2019 UTC (4 years, 11 months ago) by martijn
Branch: MAIN
Changes since 1.320: +35 -3 lines
Diff to previous 1.320 (colored)

Allow filters to log information through stderr. This simplifies and
unifies the way filters need to get their logging to the right location.

Log-messages are read line by line and are logged at LOG_ERR level via
the lookup process.

OK gilles@

Revision 1.320 / (download) - annotate - [select for diffs], Thu Jun 13 11:45:35 2019 UTC (4 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.319: +2 -1 lines
Diff to previous 1.319 (colored)

extend the resolver interface to delegate res_query() calls to the lka.

ok gilles@ sunil@

Revision 1.319 / (download) - annotate - [select for diffs], Wed Jun 5 06:40:13 2019 UTC (5 years ago) by gilles
Branch: MAIN
Changes since 1.318: +4 -3 lines
Diff to previous 1.318 (colored)

a long long time ago, in a galaxy quite close actually, reyk@ introduced an
RSA privsep engine to isolate private keys in the ca process. ECDSA support
in smtpd is become a frequent request so here's an ECDSA privsep engine and
the code required for smtpd to load ECDSA certificates and use them.

Revision 1.318 / (download) - annotate - [select for diffs], Sun Mar 31 03:36:18 2019 UTC (5 years, 2 months ago) by yasuoka
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE
Branch point for: OPENBSD_6_5
Changes since 1.317: +6 -3 lines
Diff to previous 1.317 (colored)

Avoid calling dup2(oldd, newd) when oldd == newd.  In that case the
descriptor keeps CLOEXEC flag then it will be closed unexpectedly by
exec().

ok tedu florian

Revision 1.317 / (download) - annotate - [select for diffs], Wed Jan 30 21:31:48 2019 UTC (5 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.316: +3 -3 lines
Diff to previous 1.316 (colored)

revert previous commit, i wasn't happy with it and it probably came from a
misunderstanding.

Revision 1.316 / (download) - annotate - [select for diffs], Wed Jan 30 14:21:01 2019 UTC (5 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.315: +3 -3 lines
Diff to previous 1.315 (colored)

don't be too strict with .forward permissions, it's ok to process it if the
group has write access, it's not ok if the world has write access.

ok eric@

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

remove dead code

ok gilles@

Revision 1.314 / (download) - annotate - [select for diffs], Sun Dec 23 14:26:02 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.313: +2 -4 lines
Diff to previous 1.313 (colored)

revive filters tracing (-T filters) to make it easier understand what is
happening at filters level

Revision 1.313 / (download) - annotate - [select for diffs], Thu Dec 13 17:07:13 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.312: +2 -2 lines
Diff to previous 1.312 (colored)

do not use err() on fork_processor() exit

Revision 1.312 / (download) - annotate - [select for diffs], Thu Dec 13 14:06:01 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.311: +6 -4 lines
Diff to previous 1.311 (colored)

we don't want to parse a filter command line

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

do some imsg renaming to make them more clear

Revision 1.310 / (download) - annotate - [select for diffs], Tue Dec 11 13:35:23 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.309: +11 -13 lines
Diff to previous 1.309 (colored)

remove unused imsg names

Revision 1.309 / (download) - annotate - [select for diffs], Fri Dec 7 08:05:59 2018 UTC (5 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.308: +5 -1 lines
Diff to previous 1.308 (colored)

Refactor certificate initialization and verification.
Factorize code duplicated in smtp_session.c and mta_session.c
Implement a simple callback interface, with proper request management
and simplified imsg protocol.

Only add the necessary parts for now.
Exisiting code path will be adapted later.

input from gilles@ sunil@
ok gilles@

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

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

ok eric@

Revision 1.307 / (download) - annotate - [select for diffs], Sun Nov 25 14:37:53 2018 UTC (5 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.306: +2 -2 lines
Diff to previous 1.306 (colored)

flock was needed by delivery_filename which was moved to the standalone MDA
mail.mboxfile, remove pledge from parent process

diff from Edgar Pettijohn III <edgar@pettijohn-web.com>

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

add missing imsg names

Revision 1.305 / (download) - annotate - [select for diffs], Sat Nov 3 08:59:54 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.304: +1 -3 lines
Diff to previous 1.304 (colored)

remove log_debug

Revision 1.304 / (download) - annotate - [select for diffs], Thu Nov 1 10:13:25 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.303: +102 -1 lines
Diff to previous 1.303 (colored)

allow smtpd to fork processes at startup and maintain a socketpair with
them.

ok jung@, eric@

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

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

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

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

ok eric@

Revision 1.302 / (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.301: +4 -2 lines
Diff to previous 1.301 (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.301 / (download) - annotate - [select for diffs], Thu Jun 28 17:40:10 2018 UTC (5 years, 11 months ago) by tim
Branch: MAIN
Changes since 1.300: +3 -1 lines
Diff to previous 1.300 (colored)

Don't ignore -n; OK gilles@

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

simplify parse_config() further so it no longer has any side effect outside
of parse.y, there's still work to be done but it's now able to run twice if
we want (we don't) without failing due to some global side-effect.

ok millert@

Revision 1.299 / (download) - annotate - [select for diffs], Sun Jun 3 14:04:06 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.298: +3 -41 lines
Diff to previous 1.298 (colored)

split forkmda() in two:
- forkmda() creates the process that will be used for the delivery and does
  the switching of privileges then calls mda_unpriv()
- mda_unpriv() runs with privileges of the recipient, it expands variables,
  sets up environment and executes the mda

ok millert@ and eric@

Revision 1.298 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.297: +11 -11 lines
Diff to previous 1.297 (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.297 / (download) - annotate - [select for diffs], Tue May 29 22:10:29 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.296: +2 -2 lines
Diff to previous 1.296 (colored)

RECIPIENT should really be the dest address, post-expansion, not rcpt

suggested by eric@

Revision 1.296 / (download) - annotate - [select for diffs], Tue May 29 18:16:14 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.295: +24 -7 lines
Diff to previous 1.295 (colored)

provide mail user agents with the same environments as Postfix

ok millert@, eric@

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

switch smtpd to new grammar

ok eric@

Revision 1.294 / (download) - annotate - [select for diffs], Mon May 14 15:23:05 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.293: +1 -2 lines
Diff to previous 1.293 (colored)

kill corrupt / uncorrupt queue mechanism as it has never been usable and it
will be made irrelevant when the new config comes up soon

ok eric@

Revision 1.293 / (download) - annotate - [select for diffs], Thu Apr 26 20:57:59 2018 UTC (6 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.292: +2 -1 lines
Diff to previous 1.292 (colored)

sync log.h with other daemons

ok gilles@

Revision 1.292 / (download) - annotate - [select for diffs], Sat Jan 27 08:32:03 2018 UTC (6 years, 4 months ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.291: +4 -3 lines
Diff to previous 1.291 (colored)

Avoid passing NULL to vprintf() by assigning a name to client processes. While
here rework the switch proc_title(), both clang and gcc will now warn if all
possible values are not enumerated.

ok gilles@

Revision 1.291 / (download) - annotate - [select for diffs], Tue Nov 21 12:20:34 2017 UTC (6 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.290: +81 -91 lines
Diff to previous 1.290 (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.290 / (download) - annotate - [select for diffs], Fri Sep 8 16:51:22 2017 UTC (6 years, 9 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.289: +1 -3 lines
Diff to previous 1.289 (colored)

remove more filter-related cruft

ok gilles@

Revision 1.289 / (download) - annotate - [select for diffs], Fri May 12 20:15:52 2017 UTC (7 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.288: +3 -3 lines
Diff to previous 1.288 (colored)

queue is not owned by _smtpd but _smtpq so a bug in lookup process does not
allow read/write of envelopes and messages, unfortunately the purge_task()
function which is in charge of garbage collecting left-overs from aborted
transactions is still executed as _smtpd preventing it from working.

issue reported by Philippe Meunier, fix from Edgar Pettijohn

Revision 1.288 / (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.287: +24 -25 lines
Diff to previous 1.287 (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.287 / (download) - annotate - [select for diffs], Wed Oct 19 14:06:07 2016 UTC (7 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.286: +2 -2 lines
Diff to previous 1.286 (colored)

add -F to usage() too;

Revision 1.286 / (download) - annotate - [select for diffs], Thu Sep 8 12:06:43 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.285: +20 -24 lines
Diff to previous 1.285 (colored)

Streamline the daemon shutdown sequence.

Only the parent process handles SIGTERM and SIGINT.  Upon receiving one
of those, it closes all imsg sockets and waitpid() for the children. It
fatal()s if one of the sockets is closed unexpectedly.  Other processes
exit() "normally" when one of the imsg sockets is closed.

ok gilles@ sunil@

Revision 1.285 / (download) - annotate - [select for diffs], Tue Sep 6 16:34:29 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.284: +4 -3 lines
Diff to previous 1.284 (colored)

use closefrom() before reexec to make sure the new process only gets
the imsg socket.

ok gilles@ sunil@

Revision 1.284 / (download) - annotate - [select for diffs], Sun Sep 4 16:10:31 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.283: +3 -3 lines
Diff to previous 1.283 (colored)

The smtpd processes are not expected to ever leave their event loop.
So stop pretending that the *_shutdown() functions could ever be called
in this context, and just fatal() if event_dispatch() returns.

ok gilles@ sunil@ giovanni@

Revision 1.283 / (download) - annotate - [select for diffs], Sun Sep 4 09:33:49 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.282: +1 -6 lines
Diff to previous 1.282 (colored)

Remove the "smtpctl stop" command.
The daemon is stopped with kill(1).

ok gilles@

Revision 1.282 / (download) - annotate - [select for diffs], Thu Sep 1 10:54:25 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.281: +1 -2 lines
Diff to previous 1.281 (colored)

remove noop function

ok sunil@

Revision 1.281 / (download) - annotate - [select for diffs], Thu Sep 1 10:07:20 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.280: +1 -3 lines
Diff to previous 1.280 (colored)

get rid of the imsg buffer usage profiling code.

ok gilles@ jung@ sunil@

Revision 1.280 / (download) - annotate - [select for diffs], Fri Aug 19 15:35:08 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.279: +5 -5 lines
Diff to previous 1.279 (colored)

make smtpd less verbose at startup

ok gilles@ sunil@ jung@ millert@

Revision 1.279 / (download) - annotate - [select for diffs], Mon Jun 20 20:26:04 2016 UTC (7 years, 11 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.278: +4 -1 lines
Diff to previous 1.278 (colored)

with new fork+reexec, in case of failure in init of any child process
causing it to exit, we could end up with a NULL deref in parent.

free commit offered by eric@, ok gilles@

Revision 1.278 / (download) - annotate - [select for diffs], Tue Jun 7 06:52:49 2016 UTC (8 years ago) by gilles
Branch: MAIN
Changes since 1.277: +9 -3 lines
Diff to previous 1.277 (colored)

use io_set_nonblocking() instead of SOCK_NONBLOCKING to reduce delta with
-portable

Revision 1.277 / (download) - annotate - [select for diffs], Sat May 28 21:21:20 2016 UTC (8 years ago) by eric
Branch: MAIN
Changes since 1.276: +413 -95 lines
Diff to previous 1.276 (colored)

Implement the fork+exec pattern in smtpd.

The parent process forks child processes and re-exec each of them with
an additional "-x <proc>" argument.  During the early setup phase, the
parent process sends ipc socket pairs to interconnect the child
processes as needed, and it passes the queue encryption key to the
queue if necessary. When this is done, all processes have their
environment set as in the fork-only case, and they can start doing
their work as before.

ok gilles@ jung@

Revision 1.276 / (download) - annotate - [select for diffs], Thu Apr 21 14:27:41 2016 UTC (8 years, 1 month ago) by jsing
Branch: MAIN
Changes since 1.275: +1 -5 lines
Diff to previous 1.275 (colored)

Use automatic DH parameters, instead of fixed ones. Also disable DHE by
default since it is computationally expensive and a potential DoS vector.

ok gilles@

Revision 1.275 / (download) - annotate - [select for diffs], Thu Mar 17 19:40:43 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.274: +2 -2 lines
Diff to previous 1.274 (colored)

Last parameter to execl[e]() functions *must* be cast to a pointer.
Just NULL is not good practise as NULL is theoretically allowed to
be an integer rather than a pointer.

Use (char *)NULL consistently instead of scattering a few (char *)0
and (void *)NULL into the mix.

Prompted by and probably ok deraadt@ millert@ kettenis@

Definitely ok mestre@ ratchov@

Revision 1.274 / (download) - annotate - [select for diffs], Fri Feb 5 19:15:15 2016 UTC (8 years, 4 months ago) by jung
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.273: +2 -2 lines
Diff to previous 1.273 (colored)

use SMTPD_NAME define

ok gilles

Revision 1.273 / (download) - annotate - [select for diffs], Tue Feb 2 17:51:11 2016 UTC (8 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.272: +1 -3 lines
Diff to previous 1.272 (colored)

Remove setproctitle() for the parent process. Because rc.d(8) uses process
titles (including flags) to distinguish between daemons, this makes it
possible to manage multiple copies of a daemon using the normal infrastructure
by symlinking rc.d scripts to a new name. ok jung@ ajacoutot@, smtpd ok gilles@

Revision 1.272 / (download) - annotate - [select for diffs], Wed Jan 27 12:46:03 2016 UTC (8 years, 4 months ago) by sunil
Branch: MAIN
Changes since 1.271: +2 -1 lines
Diff to previous 1.271 (colored)

Check imsg data length before use.

Ok jung@ gilles@ eric@

Revision 1.271 / (download) - annotate - [select for diffs], Mon Jan 18 11:29:34 2016 UTC (8 years, 4 months ago) by sunil
Branch: MAIN
Changes since 1.270: +2 -5 lines
Diff to previous 1.270 (colored)

Load pki keys before daemon(3). Keys with passphrase require access
to stdin.

Ok millert@ jung@ gilles@

Revision 1.270 / (download) - annotate - [select for diffs], Mon Jan 4 13:30:20 2016 UTC (8 years, 5 months ago) by jung
Branch: MAIN
Changes since 1.269: +2 -2 lines
Diff to previous 1.269 (colored)

switch to /usr/local/libexec when looking for -extras and drop loop iterating
paths

this effectively reverts table.c r1.21 which was mainly introduced for a smooth
transition in -current

ok gilles

Revision 1.269 / (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.268: +11 -11 lines
Diff to previous 1.268 (colored)

remove spaces after '!'

no binary change

ok millert

Revision 1.268 / (download) - annotate - [select for diffs], Sun Dec 20 14:06:24 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.267: +1 -2 lines
Diff to previous 1.267 (colored)

remove redundant log

Revision 1.267 / (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.266: +2 -2 lines
Diff to previous 1.266 (colored)

remove trailing whitespace

ok sunil gilles

Revision 1.266 / (download) - annotate - [select for diffs], Sat Dec 12 20:02:31 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.265: +3 -8 lines
Diff to previous 1.265 (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.265 / (download) - annotate - [select for diffs], Sat Dec 12 11:31:29 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.264: +2 -1 lines
Diff to previous 1.264 (colored)

Implement senders map.

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

Ok gilles@

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

prepare load_pki_tree() for pki/ca split

Revision 1.263 / (download) - annotate - [select for diffs], Sat Dec 12 10:26:57 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.262: +7 -1 lines
Diff to previous 1.262 (colored)

In the configuration test mode (smtpd -n) setup queue crypto iff a
valid queue key is specified.

Ok gilles@ jung@

Revision 1.262 / (download) - annotate - [select for diffs], Fri Dec 11 07:44:59 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.261: +9 -3 lines
Diff to previous 1.261 (colored)

New '-F' option to let smtpd run in foreground while logging to
syslog.

Ok gilles@ jung@

Revision 1.261 / (download) - annotate - [select for diffs], Thu Dec 10 14:07:04 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.260: +5 -4 lines
Diff to previous 1.260 (colored)

free sc_queue_key only when it points to something other than "stdin"
string literal.

Ok gilles@

Revision 1.260 / (download) - annotate - [select for diffs], Thu Dec 10 09:33:50 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.259: +5 -3 lines
Diff to previous 1.259 (colored)

Do not fatal when a log_warn suffices.

Ok jung@ gilles@

Revision 1.259 / (download) - annotate - [select for diffs], Tue Dec 8 17:28:03 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.258: +6 -3 lines
Diff to previous 1.258 (colored)

Let smtpd shutdown gracefully with a zero exit code when the priv
process receives a SIGINT/SIGTERM.

Initial diff by nfnty <git@nfnty.se>

Ok gilles@ jung@ millert@

Revision 1.258 / (download) - annotate - [select for diffs], Sat Dec 5 21:27:42 2015 UTC (8 years, 6 months ago) by mmcc
Branch: MAIN
Changes since 1.257: +2 -3 lines
Diff to previous 1.257 (colored)

Remove a few NULL-checks before free().

Revision 1.257 / (download) - annotate - [select for diffs], Tue Dec 1 20:04:38 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.256: +2 -2 lines
Diff to previous 1.256 (colored)

whitespace

Revision 1.256 / (download) - annotate - [select for diffs], Mon Nov 30 14:13:03 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.255: +2 -2 lines
Diff to previous 1.255 (colored)

when looking up tables, start in /usr/local/libexec before /usr/libexec, so
ports/packages can be installed in the proper place

ok jung@

Revision 1.255 / (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.254: +9 -9 lines
Diff to previous 1.254 (colored)

mechanical rename of some IMSG constants

ok sunil@, ok jung@

Revision 1.254 / (download) - annotate - [select for diffs], Thu Nov 5 09:14:31 2015 UTC (8 years, 7 months ago) by sunil
Branch: MAIN
Changes since 1.253: +2 -1 lines
Diff to previous 1.253 (colored)

Implement smtpctl uncorrupt <msgid>

"uncorrupt" moves envelopes from corrupt bucket back to the queue
for further discovery by the daemon.

After correcting the corrupt envelopes, admin could now...

# smtpctl uncorrupt msgid
# smtpctl discover msgid

to schedule the messages.

Ok gilles@

Revision 1.253 / (download) - annotate - [select for diffs], Thu Oct 29 10:25:36 2015 UTC (8 years, 7 months ago) by sunil
Branch: MAIN
Changes since 1.252: +5 -1 lines
Diff to previous 1.252 (colored)

Implement smtpctl discover <evpid|msgid>.

discover subcommand schedules envelopes manually moved to the queue.
It triggers a queue walk searching for envelopes with the given id,
schedules them and informs the user number of envelopes scheduled.
Admins no longer would need to restart the daemon to discover
manually moved messages.

Ok gilles@

Revision 1.252 / (download) - annotate - [select for diffs], Mon Oct 26 09:56:01 2015 UTC (8 years, 7 months ago) by jung
Branch: MAIN
Changes since 1.251: +1 -5 lines
Diff to previous 1.251 (colored)

remove unneeded pidfile() from smtpd

ok gilles

Revision 1.251 / (download) - annotate - [select for diffs], Thu Oct 22 08:46:31 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.250: +2 -2 lines
Diff to previous 1.250 (colored)

delivery to maildir needs pledge fattr

from Gregor Best <gbe@unobtanium.de>

Revision 1.250 / (download) - annotate - [select for diffs], Sat Oct 17 16:03:20 2015 UTC (8 years, 7 months ago) by sunil
Branch: MAIN
Changes since 1.249: +3 -3 lines
Diff to previous 1.249 (colored)

LMTP delivery requires "inet unix".

Ok millert@ gilles@

Revision 1.249 / (download) - annotate - [select for diffs], Sat Oct 17 04:36:10 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.248: +3 -2 lines
Diff to previous 1.248 (colored)

smtpd starts rather robustly with a gigantic pledge request group (keep
in mind that a gigantic group is already < ~50% of POSIX).  It then
grinds these down bit by bit as it sets up privsep for the various
processes.  At startup, smtpd will need the new "id" request as well.
ok gilles tedu

Revision 1.248 / (download) - annotate - [select for diffs], Fri Oct 16 20:54:55 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.247: +2 -2 lines
Diff to previous 1.247 (colored)

add flock to pledge request, needed by delivery_filename

ok millert@

Revision 1.247 / (download) - annotate - [select for diffs], Wed Oct 14 19:56:58 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.246: +4 -1 lines
Diff to previous 1.246 (colored)

pledge() privileged process

ok deraadt@

Revision 1.246 / (download) - annotate - [select for diffs], Wed Oct 14 09:14:11 2015 UTC (8 years, 7 months ago) by sunil
Branch: MAIN
Changes since 1.245: +17 -23 lines
Diff to previous 1.245 (colored)

Convert fgetln to getline.

Ok millert@ eric@ gilles@

Revision 1.245 / (download) - annotate - [select for diffs], Tue Oct 13 07:18:53 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.244: +1 -6 lines
Diff to previous 1.244 (colored)

offline queue is no longer user-writable, do not attempt resetting fchflags
it serves no purpose.

ok millert@, ok jung@, ok eric@

Revision 1.244 / (download) - annotate - [select for diffs], Mon Oct 12 07:58:19 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.243: +1 -4 lines
Diff to previous 1.243 (colored)

do not umask() [with the wrong umask] around mkstemp() calls, no matter
how broken other systems are.
ok guenther gilles

Revision 1.243 / (download) - annotate - [select for diffs], Fri Oct 9 17:44:25 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.242: +34 -12 lines
Diff to previous 1.242 (colored)

upon smtpd restart, when scanning the offline queue, unlink 0-sized offline
messages as they are left-overs from an errored enqueue.

ok millert@, ok eric@

Revision 1.242 / (download) - annotate - [select for diffs], Tue Oct 6 08:51:35 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.241: +9 -6 lines
Diff to previous 1.241 (colored)

we don't need this temporary buffer since we're going to strdup() it right
away anyways

ok eric@

Revision 1.241 / (download) - annotate - [select for diffs], Tue Oct 6 06:04:46 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.240: +2 -2 lines
Diff to previous 1.240 (colored)

fix values passed to umask(), they should be octal.
the permissions are even more restrictive than they should.

misc bug reported by qualys

Revision 1.234.4.1 / (download) - annotate - [select for diffs], Fri Oct 2 01:33:33 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_6
Changes since 1.234: +32 -14 lines
Diff to previous 1.234 (colored) next main 1.235 (colored)

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

Revision 1.238.2.1 / (download) - annotate - [select for diffs], Fri Oct 2 01:28:43 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_7
Changes since 1.238: +32 -14 lines
Diff to previous 1.238 (colored) next main 1.239 (colored)

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

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

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

Revision 1.240 / (download) - annotate - [select for diffs], Fri Oct 2 00:37:53 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.239: +32 -14 lines
Diff to previous 1.239 (colored)

prevent users from playing hardlink/symlink/mkfifo games with their offline
messages and ~/.forward files. this allowed a local user to hang smtpd or
even reset chflags and read first line of any arbitrary file.

while at it, do not fatal() on unexpected cause of SIGCHLD as this allows a
specially crafted mda to cause smtpd to exit.

reporte by Qualys Security

Revision 1.239 / (download) - annotate - [select for diffs], Wed Jun 3 02:24:36 2015 UTC (9 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE
Branch point for: OPENBSD_5_8
Changes since 1.238: +16 -6 lines
Diff to previous 1.238 (colored)

Do not assume that asprintf() clears the pointer on failure, which
is non-portable.  Also add missing asprintf() return value checks.
OK deraadt@ guenther@ doug@

Revision 1.238 / (download) - annotate - [select for diffs], Tue Jan 20 17:37:54 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.237: +10 -10 lines
Diff to previous 1.237 (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.237 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:21 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.236: +2 -1 lines
Diff to previous 1.236 (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.236 / (download) - annotate - [select for diffs], Thu Jan 15 09:05:37 2015 UTC (9 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.235: +2 -1 lines
Diff to previous 1.235 (colored)

when enqueueing offline mails from within the daemon session, we should not
rely on getlogin() otherwise mail will end up enqueued as coming from user
who started smtpd.

bug spotted by deraadt@, diff ok todd@

Revision 1.235 / (download) - annotate - [select for diffs], Mon Aug 25 07:50:26 2014 UTC (9 years, 9 months ago) by doug
Branch: MAIN
Changes since 1.234: +2 -2 lines
Diff to previous 1.234 (colored)

Delete secret or secret-derived data with explicit_bzero.

concept ok deraadt@
diff looks ok tedu@

Revision 1.234 / (download) - annotate - [select for diffs], Thu Jul 10 15:54:55 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE
Branch point for: OPENBSD_5_6
Changes since 1.233: +3 -76 lines
Diff to previous 1.233 (colored)

make the control process broadcast verbose/profile admin requests directly,
rather than going through the parent process. simplify code in the meantime.

Revision 1.233 / (download) - annotate - [select for diffs], Thu Jul 10 14:45:02 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.232: +2 -1 lines
Diff to previous 1.232 (colored)

Improve the scheduler, better and simpler.

- Get rid of the scheduler_batch structure. The scheduler can now return
  envelopes of different types in a single run, interlacing them to avoid
  batch effects.

- Ask for an acknowledgement from the queue when removing or expiring
  an envelope to benefit from the inflight envelope limitation mechanism.
  This ensures that the scheduler always keeps sending envelopes at a rate
  that the queue can sustain in all cases.

- Limit the number of envelopes in a holdq.  When a holdq is full,
  new envelopes are put back in the pending queue instead, with a
  shorter retry time.

- Plumbing for proc-ified schedulers.

imsg version bump. smtpctl stop before updating.

ok gilles@

Revision 1.232 / (download) - annotate - [select for diffs], Wed Jul 9 09:53:37 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.231: +39 -1 lines
Diff to previous 1.231 (colored)

config parser improvements:

- fail if the same option is specified multiple times on a listener
- prompt for queue encryption key after config parsing, not during.
- add ip addresses to localnames table
- prepare for filters

Revision 1.231 / (download) - annotate - [select for diffs], Tue Jul 8 21:55:53 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.230: +2 -2 lines
Diff to previous 1.230 (colored)

send correct imsg when enabling profiling at runtime

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

partially revert bogus commit

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

get rid of mfa leftovers

Revision 1.228 / (download) - annotate - [select for diffs], Tue Jul 8 13:49:09 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.227: +56 -1 lines
Diff to previous 1.227 (colored)

Update the table API: lookup functions can take an optional parameters
dictionnary (currently not set). While there, add a helper for forking
external backends, and remove unused table functions.

ok gilles@

Revision 1.227 / (download) - annotate - [select for diffs], Mon Jul 7 09:11:24 2014 UTC (9 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.226: +4 -4 lines
Diff to previous 1.226 (colored)

Allow to enable profiling at runtime and fix timings output.

ok gilles@

Revision 1.226 / (download) - annotate - [select for diffs], Thu May 1 15:50:20 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.225: +30 -3 lines
Diff to previous 1.225 (colored)

Move RSA keys from "lka" to a new dedicated "ca" process because lka
is handling some async requests and shouldn't be busy with sync RSA.

ok gilles@

Revision 1.225 / (download) - annotate - [select for diffs], Wed Apr 30 08:23:42 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.224: +2 -3 lines
Diff to previous 1.224 (colored)

The RSA engine (used by pony) has to wait for a response from the
privileged process (lka) and receive the imsgs in a while loop
synchronously.  But the lka also sends other imsgs (DNS etc.) that can
still be queued up in the buffer when waiting for the RSA response.
This only happens under load with many concurrent connections.  For
now, we just call the pony imsg handler for non-RSA imsgs that are
already in the buffer.

ok gilles@ eric@ blambert@

Revision 1.224 / (download) - annotate - [select for diffs], Tue Apr 29 21:04:17 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.223: +24 -3 lines
Diff to previous 1.223 (colored)

For RSA private key privsep, only ever load the keys after forking the
separated process.  This improves the previous because we don't trust
the PEM and BIO routines to cleanup the keys correctly.

ok gilles@

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

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

ok gilles@

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

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

ok gilles@

Revision 1.221 / (download) - annotate - [select for diffs], Sat Apr 19 14:00:45 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.220: +10 -10 lines
Diff to previous 1.220 (colored)

(void) cast snprintf calls that cannot truncate

Revision 1.220 / (download) - annotate - [select for diffs], Wed Apr 9 19:12:45 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.219: +6 -4 lines
Diff to previous 1.219 (colored)

display correct imsg when profiling is on and if the type was changed

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

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

ok gilles@

Revision 1.218 / (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.217: +161 -188 lines
Diff to previous 1.217 (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.217 / (download) - annotate - [select for diffs], Fri Apr 4 13:13:58 2014 UTC (10 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.216: +3 -2 lines
Diff to previous 1.216 (colored)

start the purge task after events are set, or we can miss SIGCHLD

ok gilles@

Revision 1.216 / (download) - annotate - [select for diffs], Tue Apr 1 09:00:46 2014 UTC (10 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.215: +17 -29 lines
Diff to previous 1.215 (colored)

cleanup forkmda() and get rid of a useless seteuid()-based dance

prompted by deraadt@, ok eric@

Revision 1.215 / (download) - annotate - [select for diffs], Mon Mar 24 14:55:12 2014 UTC (10 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.214: +36 -48 lines
Diff to previous 1.214 (colored)

do not call purge_task every 10 secs, it is only needed once at startup and
will cause the parent process to wake up unnecessarily at runtime

ok eric@

Revision 1.214 / (download) - annotate - [select for diffs], Sat Mar 22 09:41:28 2014 UTC (10 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.213: +3 -1 lines
Diff to previous 1.213 (colored)

disable the imsg buffers profiling code unless requested, this will prevent
all processes from waking up every second

Revision 1.213 / (download) - annotate - [select for diffs], Mon Feb 17 13:33:56 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.212: +2 -1 lines
Diff to previous 1.212 (colored)

new "smtpctl show status" command to show if mta/mda/smtp are currently running or paused.

Revision 1.212 / (download) - annotate - [select for diffs], Mon Feb 10 09:28:05 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.211: +7 -3 lines
Diff to previous 1.211 (colored)

tweak usage() and bump version.

Revision 1.211 / (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.210: +3 -0 lines
Diff to previous 1.210 (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.210 / (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.209: +25 -144 lines
Diff to previous 1.209 (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.209 / (download) - annotate - [select for diffs], Tue Feb 4 09:05:06 2014 UTC (10 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.208: +1 -16 lines
Diff to previous 1.208 (colored)

get rid of fdlimit()

Revision 1.208 / (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.207: +3 -3 lines
Diff to previous 1.207 (colored)

bcopy -> memmove
bzero -> memset

Revision 1.207 / (download) - annotate - [select for diffs], Thu Nov 28 12:50:40 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.206: +10 -11 lines
Diff to previous 1.206 (colored)

fix loading of passphrase-protected keys.

Revision 1.206 / (download) - annotate - [select for diffs], Wed Nov 13 13:02:44 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.205: +5 -5 lines
Diff to previous 1.205 (colored)

exit with 0 on admin shutdown

Revision 1.205 / (download) - annotate - [select for diffs], Wed Nov 13 08:57:24 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.204: +14 -2 lines
Diff to previous 1.204 (colored)

disable .forward lookup if sticky bit is set on homedir

Revision 1.204 / (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.203: +34 -41 lines
Diff to previous 1.203 (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.203 / (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.202: +4 -1 lines
Diff to previous 1.202 (colored)

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

Revision 1.202 / (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.201: +3 -1 lines
Diff to previous 1.201 (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.201 / (download) - annotate - [select for diffs], Sun Oct 27 11:01:47 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.200: +1 -2 lines
Diff to previous 1.200 (colored)

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

Revision 1.200 / (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.199: +19 -4 lines
Diff to previous 1.199 (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.199 / (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.198: +3 -3 lines
Diff to previous 1.198 (colored)

%i -> %d in format strings

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

Temporarily allow alternate names for traces, until this get cleaned up.

Revision 1.197 / (download) - annotate - [select for diffs], Fri Jul 19 21:14:52 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.196: +6 -4 lines
Diff to previous 1.196 (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.196 / (download) - annotate - [select for diffs], Fri Jul 19 20:37:07 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.195: +5 -2 lines
Diff to previous 1.195 (colored)

Assorted queue improvements:
- cleanup the internal queue backend API and get rid of the QOP_* thing.
- implement a queue_proc backend
- rename queue_fsqueue.c to queue_fs
- enable support for queue encryption
- add an envelope cache
- better logging and error reporting

Revision 1.195 / (download) - annotate - [select for diffs], Fri Jul 19 15:53:35 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.194: +33 -21 lines
Diff to previous 1.194 (colored)

assorted fixes:
- fix client certificates
- unlink control socket on exit
- write a pidfile
- minor code updates

Revision 1.194 / (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.193: +4 -1 lines
Diff to previous 1.193 (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.193 / (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.192: +6 -31 lines
Diff to previous 1.192 (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.192 / (download) - annotate - [select for diffs], Thu Jul 4 07:04:07 2013 UTC (10 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.191: +3 -2 lines
Diff to previous 1.191 (colored)

somehow a return; was removed

spotted by David Hill and Maxime Villard

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.190 / (download) - annotate - [select for diffs], Wed Apr 17 15:02:38 2013 UTC (11 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.189: +3 -3 lines
Diff to previous 1.189 (colored)

large time_t problems
ok gilles

Revision 1.189 / (download) - annotate - [select for diffs], Fri Apr 12 18:22:49 2013 UTC (11 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.188: +2 -2 lines
Diff to previous 1.188 (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.188 / (download) - annotate - [select for diffs], Thu Feb 14 13:11:40 2013 UTC (11 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.187: +3 -1 lines
Diff to previous 1.187 (colored)

- log smtpd version at startup

ok eric@

Revision 1.187 / (download) - annotate - [select for diffs], Thu Feb 14 12:30:49 2013 UTC (11 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.186: +6 -4 lines
Diff to previous 1.186 (colored)

- smtpctl trace expand, enables tracing of aliases expansion
- replace "users" keyword with "userbase" when providing alternate userbase
- disambiguise expansion nodes when expanding across domains and userbases
- allow use of '=' instead of '=>' when declaring a mapping

ok eric@

Revision 1.186 / (download) - annotate - [select for diffs], Thu Jan 31 18:34:43 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.185: +12 -5 lines
Diff to previous 1.185 (colored)

assorted fixes spotted by Coverity.
some log message updates.

ok gilles@

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

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

trace by me, logging by eric

Revision 1.184 / (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.183: +588 -401 lines
Diff to previous 1.183 (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.183 / (download) - annotate - [select for diffs], Fri Nov 23 15:10:07 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.182: +65 -48 lines
Diff to previous 1.182 (colored)

knf

Revision 1.182 / (download) - annotate - [select for diffs], Tue Nov 20 09:47:46 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.181: +3 -1 lines
Diff to previous 1.181 (colored)

Allow "smtpctl show queue" to run in "online" mode if the smtpd server
is running.  The scheduler sends the runtime state of each envelope to
the queue process which loads the envelope, fills the runtime bits and
sends the envelope back to the client. Iteration over the envelope set
happens in small chunks to make the request interruptible and to allow
the server to keep doing its job in the meantime.

Adpat "smtpctl schedule-all" to schedule the messages one by one using
the same iteration mechanism.

Document "smtpctl monitor" and "smtpctl show queue".

ok gilles@

Revision 1.181 / (download) - annotate - [select for diffs], Mon Nov 12 14:58:53 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.180: +32 -31 lines
Diff to previous 1.180 (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.180 / (download) - annotate - [select for diffs], Fri Nov 2 16:02:33 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.179: +41 -3 lines
Diff to previous 1.179 (colored)

Consistency and robustness improvements in mda:

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

ok gilles@

Revision 1.179 / (download) - annotate - [select for diffs], Wed Oct 17 16:39:49 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (colored)

Document the -P option.  While there, remove reference to -T, it's incomplete,
subject to changes and internal.

feedback from jmc@

ok gilles@

Revision 1.178 / (download) - annotate - [select for diffs], Mon Oct 15 18:32:25 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.177: +5 -1 lines
Diff to previous 1.177 (colored)

implement and document "smtpctl stop"

ok gilles@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Oct 15 17:54:28 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.176: +6 -6 lines
Diff to previous 1.176 (colored)

use shorter names for process titles.

ok gilles@ chl@

Revision 1.176 / (download) - annotate - [select for diffs], Sun Oct 14 11:58:23 2012 UTC (11 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.175: +2 -1 lines
Diff to previous 1.175 (colored)

introduce map_file.c which will deprecate map_stdio.c

The idea is to have a file-backed map but to have smtpd(8) cache the maps
so that it cannot be partially read if edited while mail is received. The
file is read and converted to a static map (map_static.c), changes aren't
visible to smtpd until an explicit: smtpctl update map  which reads file,
builds a new static map and invalidates the former.

partial-read issue discussed with beck@ and halex@
idea to convert internally to a static map by eric@

diff ok eric@ and chl@

Revision 1.175 / (download) - annotate - [select for diffs], Thu Oct 11 21:55:16 2012 UTC (11 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.174: +4 -1 lines
Diff to previous 1.174 (colored)

- if argc / argv not empty after getopt() loop, display usage

Revision 1.174 / (download) - annotate - [select for diffs], Thu Oct 4 18:25:39 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.173: +4 -5 lines
Diff to previous 1.173 (colored)

delay the call to log_debug() for displaying the backends used until
the "real" debug mode is set.

ok gilles@ chl@

Revision 1.173 / (download) - annotate - [select for diffs], Wed Oct 3 17:58:03 2012 UTC (11 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.172: +8 -1 lines
Diff to previous 1.172 (colored)

disallow root deliveries for "deliver to filename" and "deliver to mda"
rules, we only allow them for mbox and maildir though users should really
create a root alias ...

discussed with eric@ and chl@, ok both

Revision 1.172 / (download) - annotate - [select for diffs], Fri Sep 28 17:28:30 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.171: +37 -60 lines
Diff to previous 1.171 (colored)

some smtpd.{c,h} cleanups:

- move struct child to smtpd.c
- make it use a tree keyed on the pid
- change child_add to take the title directly as a const char *
- remove useless child_lookup() and child_del()
- remove CHILD_INVALID

ok chl@ gilles@

Revision 1.171 / (download) - annotate - [select for diffs], Sun Sep 16 16:54:55 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.170: +3 -2 lines
Diff to previous 1.170 (colored)

now that log_imsg() is only used in smtpd.c, set it as static.

ok gilles@

Revision 1.170 / (download) - annotate - [select for diffs], Sun Sep 16 16:43:29 2012 UTC (11 years, 8 months ago) by chl
Branch: MAIN
Changes since 1.169: +7 -5 lines
Diff to previous 1.169 (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.169 / (download) - annotate - [select for diffs], Tue Sep 11 12:47:36 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.168: +25 -23 lines
Diff to previous 1.168 (colored)

log the process name and place when calling fatal().

ok gilles@

Revision 1.168 / (download) - annotate - [select for diffs], Sat Sep 1 16:09:14 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.167: +1 -19 lines
Diff to previous 1.167 (colored)

- remove crypto_backend
- remove support for encrypted queue, it will be reintroduced later after
  pouring more thinking into it

if you had it enabled, flush your queue before updating

Revision 1.167 / (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.166: +21 -2 lines
Diff to previous 1.166 (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.166 / (download) - annotate - [select for diffs], Sun Aug 26 16:35:17 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.165: +3 -3 lines
Diff to previous 1.165 (colored)

correctly check compress_backend_lookup() to avoid a NULL deref

Revision 1.165 / (download) - annotate - [select for diffs], Sun Aug 26 11:52:48 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.164: +3 -1 lines
Diff to previous 1.164 (colored)

- define ZLIB_BUFFER_SIZE instead of hardcoding 8192
- check gzdopen() failure
- call gzclose() whenever a failure occurs after gzdopen()
- simplify slightly some checks in compress/uncompress
- create PATH_TEMPORARY in /var/spool/smtpd, chmod 700, owned by _smtpd
- compress_zlib should use PATH_TEMPORARY instread of /tmp as we're
	chrooted and this will otherwise lead to a fatal()

ok chl@

Revision 1.164 / (download) - annotate - [select for diffs], Sat Aug 25 23:35:09 2012 UTC (11 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.163: +9 -1 lines
Diff to previous 1.163 (colored)

Add compress_backend, allowing compression of messages and envelopes in the queue.
To use it, just add "queue compress" in smtpd.conf. For now, only zlib is used.

lots of feedback from eric@ and gilles@

ok eric@ gilles@

Revision 1.163 / (download) - annotate - [select for diffs], Sat Aug 25 15:39:11 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.162: +9 -11 lines
Diff to previous 1.162 (colored)

- offline enqueue does not need to use the user_backend API, it relies on
	system users ... use getpwuid() instead of ub->getbyuid()
- since that was the only caller, get rid of user_backend->getbyuid()

this is the first step towards removing the user_backend API and making
user lookups available through the maps API (yes, virtual user support ;)

ok eric@, ok chl@

Revision 1.162 / (download) - annotate - [select for diffs], Sat Aug 25 11:38:18 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.161: +44 -1 lines
Diff to previous 1.161 (colored)

- introduce TRACE_PROFILING
- when smtpd starts with -T profiling it will log_trace() some prof. info
- when smtpd starts with -T profstat, it will push them to stats API with
	type STAT_TIMESPEC under key profiling.imsg.*

with this diff we can get live profiling of events with a very minimal
overhead :-)

ok chl@, ok eric@

Revision 1.161 / (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.160: +2 -1 lines
Diff to previous 1.160 (colored)

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

ok gilles@

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

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

ok eric@

Revision 1.159 / (download) - annotate - [select for diffs], Sun Aug 19 08:47:41 2012 UTC (11 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.158: +8 -2 lines
Diff to previous 1.158 (colored)

add missing IMSG_* in imsg_to_str()

ok eric@

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

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

ok eric@, ok chl@

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

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

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

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

ok gilles@

Revision 1.156 / (download) - annotate - [select for diffs], Wed Aug 8 17:28:36 2012 UTC (11 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.155: +14 -6 lines
Diff to previous 1.155 (colored)

log received fd in log_imsg() if any

ok gilles@ chl@

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

- introduce log_trace(TRACE_SCHEDULER, ...)
- simplify a tiny tiny bit the scheduler loop
- no functional change (yet)

Revision 1.154 / (download) - annotate - [select for diffs], Mon Jul 9 09:57:53 2012 UTC (11 years, 11 months ago) by gilles
Branch: MAIN
Changes since 1.153: +7 -7 lines
Diff to previous 1.153 (colored)

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

ok eric@, ok chl@

Revision 1.153 / (download) - annotate - [select for diffs], Sun Jul 8 18:13:08 2012 UTC (11 years, 11 months ago) by chl
Branch: MAIN
Changes since 1.152: +6 -1 lines
Diff to previous 1.152 (colored)

remove enum queue_kind from queue_fsqueue.c.
incoming messages are now always stored in /incoming, whatever the queue_backend is.
remove QOP_FD_RW and fsqueue_message_fd_rw().
while there check return value of generated paths before calling rmtree()

with advice from gilles@ and eric@

ok gilles@ eric@

Revision 1.152 / (download) - annotate - [select for diffs], Mon Jul 2 17:00:05 2012 UTC (11 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.151: +18 -4 lines
Diff to previous 1.151 (colored)

Lookup queue and scheduler backends by name, rather than enum.
Add a command-line option to specify the backend to use at runtime.

ok gilles@

Revision 1.151 / (download) - annotate - [select for diffs], Fri Jun 1 14:55:09 2012 UTC (12 years ago) by eric
Branch: MAIN
Changes since 1.150: +14 -3 lines
Diff to previous 1.150 (colored)

allow to pause some subsystems at startup.

ok gilles@ chl@

Revision 1.150 / (download) - annotate - [select for diffs], Sat Jan 28 16:52:24 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.149: +1 -2 lines
Diff to previous 1.149 (colored)

smtpd no longer needs to tell us that it forks a purge process ever few
seconds, we've seen it works and it has become irritating :p

Revision 1.149 / (download) - annotate - [select for diffs], Tue Jan 24 12:20:18 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.148: +2 -2 lines
Diff to previous 1.148 (colored)

Add a parameter to the queue backend init() call to specify wether the
call is issued by smtpd or smtpctl.  In the latter case, only perform
sanity checks and do not touch directories.  A running server no
longer lose its "incoming/" directory each time smtpctl is called...

ok gilles@

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

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

ok gilles@ eric@

Revision 1.147 / (download) - annotate - [select for diffs], Fri Jan 13 14:01:58 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.146: +5 -2 lines
Diff to previous 1.146 (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.146 / (download) - annotate - [select for diffs], Thu Jan 12 18:06:18 2012 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.145: +2 -2 lines
Diff to previous 1.145 (colored)

Remove dead code for config reloading for now. It is not functionnal
and confusing.

ok gilles@

Revision 1.145 / (download) - annotate - [select for diffs], Thu Jan 12 12:52:11 2012 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

use absolute path as fts may chdir() during traversal.

ok gilles@

Revision 1.144 / (download) - annotate - [select for diffs], Wed Jan 11 17:46:36 2012 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.143: +72 -5 lines
Diff to previous 1.143 (colored)

Simplify runner/queue by getting rid of Q_PURGE.  Instead, let smtpd
periodically clear the purge/ directory.  At init time, the fsqueue
backend simply moves the existing incoming/ dir in purge/ to discard
aborted sessions.

ok gilles@ chl@

Revision 1.143 / (download) - annotate - [select for diffs], Tue Dec 13 23:55:00 2011 UTC (12 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.142: +5 -5 lines
Diff to previous 1.142 (colored)

*finally* make use of certificate authority file if available !

bits from relayd, ok chl@, ok eric@

Revision 1.142 / (download) - annotate - [select for diffs], Tue Dec 13 22:04:35 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.141: +4 -4 lines
Diff to previous 1.141 (colored)

split user_backend.c into user.c and user_pwd.c to be consistent with the
backend scheme. Also rename USER_GETPWNAM to USER_PWD.

ok chl@ gilles@

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

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

ok eric@

Revision 1.140 / (download) - annotate - [select for diffs], Mon Dec 12 17:20:36 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.139: +11 -1 lines
Diff to previous 1.139 (colored)

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

ok chl@ gilles@

Revision 1.139 / (download) - annotate - [select for diffs], Thu Dec 8 17:00:28 2011 UTC (12 years, 6 months ago) by todd
Branch: MAIN
Changes since 1.138: +4 -4 lines
Diff to previous 1.138 (colored)

rename struct user to struct mta_user to avoid namespace conflict elsewhere
ok chl@ & gilles@

Revision 1.138 / (download) - annotate - [select for diffs], Wed Nov 16 11:18:54 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.137: +54 -68 lines
Diff to previous 1.137 (colored)

Do not unlink an offline message until it has been correctly enqueued.
While there, simplify the offline_enqueue() function by doing all the
sanity checks in the forked process,  and remove all fatal(): on error,
the offline message is left untouched in the directory.  Also, get rid
of the path_starts_with() check since all paths to offline messages are
now constructed internally.

ok gilles@ chl@

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

when receiving an unexpected imsg, print its name.

with help and ideas from eric@

ok eric@ gilles@

Revision 1.136 / (download) - annotate - [select for diffs], Mon Nov 14 11:53:10 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.135: +7 -2 lines
Diff to previous 1.135 (colored)

The spool and offline directories are backend-independent, so they
must be created early by smtpd, rather than in fsqueue.

ok gilles@ chl@

Revision 1.135 / (download) - annotate - [select for diffs], Mon Nov 7 11:14:10 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.134: +85 -58 lines
Diff to previous 1.134 (colored)

Let the smtpd process handle the enqueueing of offline messages at
startup, rather than playing tricks with the runner. This will allow
further simplifications and improvements in the runner/queue.

ok gilles@

Revision 1.134 / (download) - annotate - [select for diffs], Wed Oct 26 20:47:31 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.133: +5 -5 lines
Diff to previous 1.133 (colored)

- fix smtpctl pause/resume so the ramqueue scheduling is done correctly
- rename IMSG and smtpctl pause/resume parameters
- update man page

tested by me, ok chl@, eric@

Revision 1.133 / (download) - annotate - [select for diffs], Sat Oct 22 06:42:44 2011 UTC (12 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.132: +2 -2 lines
Diff to previous 1.132 (colored)

tweak previous;

Revision 1.132 / (download) - annotate - [select for diffs], Sat Oct 22 00:16:33 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.131: +18 -10 lines
Diff to previous 1.131 (colored)

Add a log_trace() call to toggle logging of specific debugging info in
verbose mode, and an associated -T command line option.  Use it for
the imsg traces.

Requested by gilles@ who doesn't like verbose to be too verbose.

ok gilles@ chl@

Revision 1.131 / (download) - annotate - [select for diffs], Sun Oct 9 18:39:54 2011 UTC (12 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.130: +113 -1 lines
Diff to previous 1.130 (colored)

show messages sent between processes in debug mode

ok gilles@ chl@

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

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

ok gilles@ chl@

Revision 1.129 / (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.128: +3 -2 lines
Diff to previous 1.128 (colored)

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

ok gilles@

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

initial support for a session-time filtering API

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

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

Revision 1.127 / (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.126: +2 -1 lines
Diff to previous 1.126 (colored)

add missing header needed by time()

ok gilles@

Revision 1.126 / (download) - annotate - [select for diffs], Tue May 17 18:54:32 2011 UTC (13 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.125: +27 -20 lines
Diff to previous 1.125 (colored)

introduce new user_backend API for smtpd to lookup the users it wants to
deliver mail to. the only backend supported for now is USER_GETPWNAM and
it is not yet possible to switch to an alternate backend.

yes this means that we're very close from smtpd being able to handle fully
virtual accounts for both incoming and outgoing messages.

Revision 1.125 / (download) - annotate - [select for diffs], Tue May 17 16:42:06 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.124: +4 -2 lines
Diff to previous 1.124 (colored)

smtpd now uses an auth_backend API to authenticate users that are allowed
to send mail so they do not necessarily need a local system account.

two backends are provided by default, bsd_auth(3) and getpwnam(3), however
smtpd will only select bsd_auth(3) for the moment and not provide a way to
chose any other backend (that's on purpose ;p).

bye bye authenticate() !

Revision 1.124 / (download) - annotate - [select for diffs], Mon May 16 21:05:52 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.123: +2 -2 lines
Diff to previous 1.123 (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.123 / (download) - annotate - [select for diffs], Wed May 4 20:45:30 2011 UTC (13 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.122: +53 -2 lines
Diff to previous 1.122 (colored)

When enqueueing offline mail, use a wait list to keep the number of
forked processes below a reasonnable limit.  This prevents smtpd from
fork-bombing on startup when there are lots of mails in the offline
queue.

ok todd@ gilles@

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

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

discussed with and ok gilles@

Revision 1.121 / (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.120: +31 -34 lines
Diff to previous 1.120 (colored)

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

Revision 1.120 / (download) - annotate - [select for diffs], Thu Apr 14 22:46:38 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.119: +2 -3 lines
Diff to previous 1.119 (colored)

no functionnal change

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

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

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

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

Revision 1.118 / (download) - annotate - [select for diffs], Thu Apr 14 17:06:43 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.117: +5 -1 lines
Diff to previous 1.117 (colored)

smtpd makes too many assumptions about the structure and layout of its
disk-based queue, it makes it near impossible to make changes to it without
editing twenty files... how am i going to implement mongodb support ? :-)

bring a new queue_backend API which hides the details of the disk-based
queue to smtpd. it is not "plugged in" yet and I'm filling the holes.

Revision 1.117 / (download) - annotate - [select for diffs], Wed Apr 13 20:53:18 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.116: +2 -3 lines
Diff to previous 1.116 (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.116 / (download) - annotate - [select for diffs], Tue Mar 15 19:24:55 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.115: +7 -3 lines
Diff to previous 1.115 (colored)

let smtpd use user-provided Diffie-Hellman parameters for ephemeral key
exchange. if no DH parameters are found, fallback to builtin parameters
as was done until now.

since we now accept user-provided DH parameters, make smtpd more strict
and fatal() if the parameters are bogus.

bump the key size of the DH parameters from 512bits to 1024bits, it might
be bumped further after some more research.

thanks to mikeb@ for his suggestions

diff ok mikeb@ , man ok jmc@

Revision 1.115 / (download) - annotate - [select for diffs], Sun Nov 28 14:35:58 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.114: +2 -6 lines
Diff to previous 1.114 (colored)

remove all unused headers

Revision 1.114 / (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.113: +3 -1 lines
Diff to previous 1.113 (colored)

a bit of .h cleanups, no functionnal change

Revision 1.113 / (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.112: +276 -129 lines
Diff to previous 1.112 (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.112 / (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.111: +3 -2 lines
Diff to previous 1.111 (colored)

check event_dispatch() return value

ok jacekm@

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

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.109 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.108: +128 -276 lines
Diff to previous 1.108 (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.108 / (download) - annotate - [select for diffs], Mon May 31 22:25:26 2010 UTC (14 years ago) by chl
Branch: MAIN
Changes since 1.107: +5 -7 lines
Diff to previous 1.107 (colored)

imsg_compose_event() return value was never checked. Make it fatal() if needed.

ok jacekm@ gilles@

Revision 1.107 / (download) - annotate - [select for diffs], Thu May 27 15:36:04 2010 UTC (14 years ago) by gilles
Branch: MAIN
Changes since 1.106: +1 -6 lines
Diff to previous 1.106 (colored)

when a rule has two conditions (ie: accept for { domain foo, domain bar } )
expand to two rules each having its own condition rather than one rule
with a tail queue of conditions. this simplifies code a bit and removes a
couple hacks.

basic testing by oga and me

Revision 1.106 / (download) - annotate - [select for diffs], Sun May 23 18:44:14 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.105: +11 -11 lines
Diff to previous 1.105 (colored)

When executing external mda, call dup2, closefrom, and chdir before
setresuid because after dropping superuser privileges the process
cannot be trusted to call these.

Thanks to oga@, kettenis@, and nicm@ for confirming my paranoia.

Revision 1.105 / (download) - annotate - [select for diffs], Fri May 21 08:45:02 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.104: +2 -2 lines
Diff to previous 1.104 (colored)

Use _exit(2) in mda helper child process.

Revision 1.104 / (download) - annotate - [select for diffs], Thu May 20 18:35:33 2010 UTC (14 years ago) by gilles
Branch: MAIN
Changes since 1.103: +2 -2 lines
Diff to previous 1.103 (colored)

S_ISREG() should be called on st.st_mode not st.st_flags

Revision 1.103 / (download) - annotate - [select for diffs], Sun May 9 15:24:49 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.102: +2 -1 lines
Diff to previous 1.102 (colored)

in recent change, an assignation was removed which would cause a bogus
pointer deref if we actually went through this code path (reload, does
not work yet so it is disabled)

Revision 1.102 / (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.101: +4 -7 lines
Diff to previous 1.101 (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.101 / (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.100: +157 -469 lines
Diff to previous 1.100 (colored)

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

Revision 1.100 / (download) - annotate - [select for diffs], Tue Apr 20 01:01:43 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.99: +3 -1 lines
Diff to previous 1.99 (colored)

setproctitle(3) the parent process to "[priv]" to match other OpenBSD
daemons.

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

Make smtpd -d produce verbose output, ie. restore behaviour from before
rev. 1.94.

Revision 1.98 / (download) - annotate - [select for diffs], Mon Apr 19 20:09:58 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.97: +4 -4 lines
Diff to previous 1.97 (colored)

- use perror(3)
- call _exit(2) instead of exit(3) in forked processes

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

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

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

With input and tests from nicm@.

OK nicm@ gilles@

Revision 1.96 / (download) - annotate - [select for diffs], Mon Mar 1 13:04:03 2010 UTC (14 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

typo in warning log

spotted by Seth Wright <seth@crosse.org>

Revision 1.95 / (download) - annotate - [select for diffs], Sun Jan 10 08:59:19 2010 UTC (14 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.94: +4 -1 lines
Diff to previous 1.94 (colored)

have smtpd errx() at startup if no hostname could be detected either from
a gethostname() call or from a hostname directive in smtpd.conf

discussed with jacekm@, i initially intended to only warn but errx seems to
be a better solution for now

Revision 1.94 / (download) - annotate - [select for diffs], Sun Jan 3 14:37:37 2010 UTC (14 years, 5 months ago) by chl
Branch: MAIN
Changes since 1.93: +77 -2 lines
Diff to previous 1.93 (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.93 / (download) - annotate - [select for diffs], Thu Dec 24 14:19:46 2009 UTC (14 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.92: +2 -3 lines
Diff to previous 1.92 (colored)

kill PATH_RUNQUEUEHIGH and PATH_RUNQUEUELOW, i had great plans for them but
they're still unused months later and there's many ways to achieve having a
set of priorities on envelopes without needing additionnal queues.

Revision 1.92 / (download) - annotate - [select for diffs], Mon Dec 14 19:56:55 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.91: +13 -7 lines
Diff to previous 1.91 (colored)

Tweak the logic behind setting the fd limits so that smtpd is less likely
to get upset by custom soft/hard ulimit settings.

Suggested by todd@

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

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

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

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

Revision 1.89 / (download) - annotate - [select for diffs], Sat Nov 14 18:48:05 2009 UTC (14 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.88: +1 -2 lines
Diff to previous 1.88 (colored)

remove duplicate header include

ok gilles@

Revision 1.88 / (download) - annotate - [select for diffs], Tue Nov 3 11:10:43 2009 UTC (14 years, 7 months ago) by jacekm
Branch: MAIN
Changes since 1.87: +30 -12 lines
Diff to previous 1.87 (colored)

Improve error logging.

Revision 1.87 / (download) - annotate - [select for diffs], Mon Oct 19 20:00:46 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.86: +14 -4 lines
Diff to previous 1.86 (colored)

users within virtual domains do not necessarily map to a real user account,
teach smtpd how to deliver using specific user permissions:

	accept for virtual map "foo" deliver to maildir "/m/%d/%u" user foo

will deliver mail under /m/domain/user as user foo

idea and initial diff discussed with jacekm@

Revision 1.86 / (download) - annotate - [select for diffs], Wed Oct 7 18:19:39 2009 UTC (14 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.85: +1 -2 lines
Diff to previous 1.85 (colored)

now that mfa no longer does ruleset matching, parent no longer needs to
send it the ruleset configuration, and mfa no longer needs to interpret
it and load it in memory. kill kill kill. as an added bonus: removes 88
lines of code :-)

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

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

Revision 1.84 / (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.83: +8 -8 lines
Diff to previous 1.83 (colored)

imsg_get sets errno so use fatal instead of fatalx.

Revision 1.83 / (download) - annotate - [select for diffs], Thu Aug 27 09:21:28 2009 UTC (14 years, 9 months ago) by jacekm
Branch: MAIN
Changes since 1.82: +20 -31 lines
Diff to previous 1.82 (colored)

getpwnam failure that results in setting errno could confuse the
check for non-existent ~/.forward, so make the check more robust;
fix a fd leak under rare circumstances; use secure_file for
testing .forward file security.

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

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

Revision 1.81 / (download) - annotate - [select for diffs], Fri Aug 7 19:02:55 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.80: +2 -4 lines
Diff to previous 1.80 (colored)

wrap auth_userokay in a new function authenticate_user() and make sure
that only authenticate.c knows about bsd_auth, no functionnal change.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Aug 6 16:46:57 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.79: +3 -3 lines
Diff to previous 1.79 (colored)

- change all occurences of T_DAEMON_BATCH,MESSAGE to T_BOUNCE_BATCH/MESSAGE
- make sure T_BOUNCE_MESSAGE is no longer OR-ed to T_MDA/MTA_MESSAGE
- define F_MESSAGE_BOUNCE flag and make sure bounce sessions set it
- teach smtpctl show queue how to recognize a bounce message

Revision 1.79 / (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.78: +2 -2 lines
Diff to previous 1.78 (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.78 / (download) - annotate - [select for diffs], Tue Jul 28 22:03:55 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.77: +2 -2 lines
Diff to previous 1.77 (colored)

introduce daemon_record_message() and needed glue in queue_shared.c to
atomically create a mailer daemon out of a message. it is unreferenced
for now, this commit makes no functional change.

Revision 1.77 / (download) - annotate - [select for diffs], Tue Jul 28 21:12:26 2009 UTC (14 years, 10 months ago) by jsg
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Use strcmp() for string comparison not ==
ok jacekm@

Revision 1.76 / (download) - annotate - [select for diffs], Tue Jul 28 13:54:35 2009 UTC (14 years, 10 months ago) by gilles
Branch: MAIN
Changes since 1.75: +3 -2 lines
Diff to previous 1.75 (colored)

indent

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

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

Revision 1.73 / (download) - annotate - [select for diffs], Wed Jun 3 18:16:29 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

rename sc_config to sc_conffile since that's what this field is about, it
will prevent a confusion with sc_config which will be a pointer to the
actual configuration.

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

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

Revision 1.71 / (download) - annotate - [select for diffs], Mon Jun 1 18:24:01 2009 UTC (15 years ago) by deraadt
Branch: MAIN
Changes since 1.70: +5 -6 lines
Diff to previous 1.70 (colored)

No need for save_getpwuid and such functions which call endpwent.
endpwent is not needed unless setpwent (with stayopen = 1) or getpwent
was used.  getpwuid/getpwnam do not use getpwent; i think people must
be assuming this.  we are going to improve the man pages for this.
ok gilles

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

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

Revision 1.69 / (download) - annotate - [select for diffs], Sat May 30 23:53:41 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.68: +84 -1 lines
Diff to previous 1.68 (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.68 / (download) - annotate - [select for diffs], Sat May 30 23:28:52 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.67: +3 -2 lines
Diff to previous 1.67 (colored)

fatal on setsockopt() failures

Revision 1.67 / (download) - annotate - [select for diffs], Mon May 25 14:00:36 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.66: +9 -2 lines
Diff to previous 1.66 (colored)

merge smtp_listener_setup into its only caller; ok gilles@

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

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

Revision 1.65 / (download) - annotate - [select for diffs], Sun May 24 14:38:56 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.64: +174 -196 lines
Diff to previous 1.64 (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.64 / (download) - annotate - [select for diffs], Sun May 24 14:22:24 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.63: +10 -14 lines
Diff to previous 1.63 (colored)

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

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

ok gilles@

Revision 1.63 / (download) - annotate - [select for diffs], Wed May 20 16:07:26 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.62: +41 -14 lines
Diff to previous 1.62 (colored)

previous commit to add reload support was missing some code, this diffs
contains the missing parts + a memleak plug

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

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

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

Revision 1.61 / (download) - annotate - [select for diffs], Tue May 19 22:54:46 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.60: +1 -39 lines
Diff to previous 1.60 (colored)

ever since we switched from delivering to mboxes ourselves to using the
mail.local(8) utility, parent_mailbox_init() has become useless, do not
call it from parent_mailbox_open() anymore, and kill it.

this fixes a bug which we were many to spot and which would cause smtpd
to create a file /var/mail/%u upon first delivery to a mbox, then leave
it there forever untouched.

Revision 1.60 / (download) - annotate - [select for diffs], Tue May 19 11:37:44 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

Do not ever run /usr/sbin/sendmail, it could link to sendmail
interface for a different MTA. Use the binary in /usr/libexec
directly instead.

Based on remark claudio@ made in passing.

ok gilles@

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

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

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

use the nitems() macro where appropriate

ok gilles@, jacekm@

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

assert copyright; ok gilles@

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

small corrections to log_warns and fatals

Revision 1.55 / (download) - annotate - [select for diffs], Tue Apr 21 18:12:05 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.54: +254 -24 lines
Diff to previous 1.54 (colored)

Make /usr/sbin/sendmail not fail due to smtpd being down.

The approach is to save cmdline + stdin in a file under a newly
added directory /var/spool/smtpd/offline (uid 0 gid 0 mode 1777).
Next time daemon starts, it uses information in that directory
to replay sendmail on user's behalf.

ok gilles@

Revision 1.54 / (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.53: +6 -6 lines
Diff to previous 1.53 (colored)

correct some fatal(x) calls and error strings

ok gilles@ jacekm@

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

don't call setproctitle for parent, at least one process should
display cmdline arguments the daemon was started with; ok gilles@

Revision 1.52 / (download) - annotate - [select for diffs], Fri Apr 3 05:20:17 2009 UTC (15 years, 2 months ago) by oga
Branch: MAIN
Changes since 1.51: +28 -10 lines
Diff to previous 1.51 (colored)

The smtp auth PLAIN specification is weird. It's valid (apparently for
imap, mostly) to provide "username1\0real_username\0password" as your
base64 encoded string for authentication. We currently don't handle
that, instead expecting the first byte to be a NUL.  So fix that up by
scanning for the first string, and ignoring it if it's there. The string
is also stupid in that the last bit (password) may not be NUL
terminated, so pay attention to that in our decoding and make sure that
it's always terminated correctly.

It's been discussed, and this decoding really should happen in the
unauthenticated process, not in the privileged one, but that is another
diff.

Problem found by todd@, who kindly helped me debug this and confirmed
that it now works with kmail, mutt and thunderbird.

"if it makes more stuff work, please commit" jacekm@.

-0- - not a smtpd hacker and I resent your implication.

Revision 1.51 / (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.50: +14 -15 lines
Diff to previous 1.50 (colored)

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

Revision 1.50 / (download) - annotate - [select for diffs], Sun Mar 22 22:53:47 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.49: +12 -11 lines
Diff to previous 1.49 (colored)

fix a bug in the resolution of forward files which would cause usernames
not to be taken into account if they had no ~/.forward file AND were the
result of an alias expansion that expanded to more than one username.

while at it, I spotted another bug where I would check T_MDA_MESSAGE on
the flags field instead of the type field. the bug could cause two MDA
message to end up in the same batch which is no longer valid.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Mar 10 21:14:21 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.48: +9 -1 lines
Diff to previous 1.48 (colored)

when calling external mda, use restricted environment; ok gilles@

Revision 1.48 / (download) - annotate - [select for diffs], Tue Mar 10 19:13:28 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.47: +4 -1 lines
Diff to previous 1.47 (colored)

run external mda with cwd set to $HOME or /; ok gilles@

Revision 1.47 / (download) - annotate - [select for diffs], Tue Mar 10 19:09:29 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.46: +3 -11 lines
Diff to previous 1.46 (colored)

kill few lines, saving one seteuid(2) call; ok gilles@

Revision 1.46 / (download) - annotate - [select for diffs], Tue Mar 10 18:44:28 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.45: +10 -2 lines
Diff to previous 1.45 (colored)

- Use setsid(2) to create new process group for external mda.
- Unignore SIGPIPE, otherwise it remains ignored in forked mda.
- Use closefrom(2) to close all descriptors apart from stdin/stdout/stderr.

ok gilles@

Revision 1.45 / (download) - annotate - [select for diffs], Tue Mar 10 13:05:05 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.44: +10 -11 lines
Diff to previous 1.44 (colored)

it's simpler to use pipe(2) than socketpair(2) to communicate with
external mda; ok gilles@

Revision 1.44 / (download) - annotate - [select for diffs], Tue Mar 10 10:01:39 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.43: +9 -4 lines
Diff to previous 1.43 (colored)

fork(2) or socketpair(2) failures are temporary, delivery attempt should be
retried later; ok gilles@

Revision 1.43 / (download) - annotate - [select for diffs], Mon Mar 9 23:35:04 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.42: +9 -2 lines
Diff to previous 1.42 (colored)

run external mda directly, not via sh -c; this steals addargs() API
from OpenSSH; ok gilles@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Mar 8 17:54:20 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.41: +1 -2 lines
Diff to previous 1.41 (colored)

~/.forward files handling was fixed recently so that it is the privileged
process that does the opening, this commit does some cleanup, and fixes a
bug I experienced today which was caused by a use-after-free.

I did some testing to make sure a user cannot cause smtpd to deadlock, or
loop, with broken setups (self-referencing forwards/aliases, empty files,
broken files...), but if you are playing with aliases/forwards PLEASE let
me know of any bug you run into.

Revision 1.41 / (download) - annotate - [select for diffs], Wed Mar 4 00:00:40 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

plug a memory leak, remove lka session from the the lka session tree when
we are done expanding aliases/forwards, and cleanup a bit the expansion
code so that I can soon remove some of the duplication.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Mar 3 23:23:52 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.39: +61 -1 lines
Diff to previous 1.39 (colored)

Fix a long standing issue where ~/.forward files were opened by user _smtpd
causing them not to be handled when a user's homedir is set to mode 0700. I
still need to do some cleanup and make sure it works as it should, but this
diff provides better behavior than what we had.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Mar 3 15:47:27 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.38: +51 -34 lines
Diff to previous 1.38 (colored)

fix mbox locking by having it done by mail.local(8) which in turns uses
lockspool(1). this means our mbox delivery follows a code path that has
become almost identical to external mda deliveries. this is the first
of a serie of diffs actually...

lockspool(1) suggestion by deraadt@, mail.local(8) idea by jacekm@, and
fix and testing by me

Revision 1.38 / (download) - annotate - [select for diffs], Sun Mar 1 21:58:53 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.37: +12 -7 lines
Diff to previous 1.37 (colored)

- Refuse delivery to mbox that is a symlink, pipe, chardev, etc. etc.
- Introduce secure_file, based on secure_filename from OpenSSH, it
checks that mbox has right perms, and that path components are
trustworthy, too.

ok gilles@

Revision 1.37 / (download) - annotate - [select for diffs], Sun Mar 1 21:36:50 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.36: +2 -8 lines
Diff to previous 1.36 (colored)

open mbox with O_EXLOCK (better than open+flock), and without O_SYNC,
since fsync is done in final safe_fclose; ok gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Sun Mar 1 15:06:23 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.35: +11 -3 lines
Diff to previous 1.35 (colored)

fix possible NULL dereference when getpwnam fails; ok gilles@

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

make the condition under which delivery is made by SMTPD_USER more
explicit; ok gilles@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Mar 1 13:07:52 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.33: +26 -35 lines
Diff to previous 1.33 (colored)

simplify *_open functions by passing them char * instead of struct
path *; ok gilles@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Feb 25 09:08:34 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.32: +1 -4 lines
Diff to previous 1.32 (colored)

remove chown's called when running with user privs, ie. basically noops;
ok gilles@

Revision 1.32 / (download) - annotate - [select for diffs], Mon Feb 23 00:51:32 2009 UTC (15 years, 3 months ago) by chl
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)

add missing headers needed by time()

ok jacekm@ gilles@

Revision 1.31 / (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.30: +14 -11 lines
Diff to previous 1.30 (colored)

replace MAX* constants by sizeof where possible

ok jacekm@

Revision 1.30 / (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.29: +12 -1 lines
Diff to previous 1.29 (colored)

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

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

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

idea discussed with jacekm@, code mostly ripped from relayd

Revision 1.28 / (download) - annotate - [select for diffs], Fri Jan 30 10:03:29 2009 UTC (15 years, 4 months ago) by form
Branch: MAIN
Changes since 1.27: +2 -3 lines
Diff to previous 1.27 (colored)

fix debug message

ok gilles@

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

Implement "smtpctl show stats"; ok gilles@

Revision 1.26 / (download) - annotate - [select for diffs], Wed Jan 28 19:38:46 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.25: +5 -1 lines
Diff to previous 1.25 (colored)

when pausing listeners, do not simply disable their events as new
clients would still be able to connect. instead, at pause time we
close and remove the listeners, and at resume time we request the
parent to reconfigure all listeners.

discussed with pyr@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jan 27 11:42:30 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.24: +129 -96 lines
Diff to previous 1.24 (colored)

temporarily drop privileges to the final user before each delivery attempt,
wether it is maildir, mbox or external mda. rearrange a bit of code to also
simplify most delivery methods by moving their common code to common place.

while at it change some mode_t to int where it was wrongly used and unlink
temporary maildir file if we fail to deliver for some reason.

discussed with and ok jacek@

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jan 21 00:00:30 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.23: +9 -3 lines
Diff to previous 1.23 (colored)

temporary quick fix to an issue that needs more thinking; ok gilles@

Revision 1.23 / (download) - annotate - [select for diffs], Sat Jan 10 23:54:15 2009 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.22: +6 -8 lines
Diff to previous 1.22 (colored)

- remove a comment that was no longer relevant
- when authenticating user, instead of doing a getpwnam() and checking the
	passwd field, issue a call to auth_userokay(), this will allow the
	use of login scripts to implement custom authentications without
	bloating smtpd.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jan 8 19:17:31 2009 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.21: +6 -6 lines
Diff to previous 1.21 (colored)

ensure getpwnam is always followed by endpwent; ok gilles@ henning@

Revision 1.21 / (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.20: +1 -2 lines
Diff to previous 1.20 (colored)

remove unnecessary includes; ok gilles@

Revision 1.20 / (download) - annotate - [select for diffs], Sat Dec 27 17:03:29 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.19: +2 -3 lines
Diff to previous 1.19 (colored)

Merge hash() and queue_message_hash() into one func, queue_hash(). Fix callers
to use this interface consistently; ok chl@ gilles@

Revision 1.19 / (download) - annotate - [select for diffs], Mon Dec 22 12:56:21 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.18: +3 -1 lines
Diff to previous 1.18 (colored)

Remove entry from mdaproctree after reaping mda child; ok gilles@
From: Nicholas Marriott <nicholas.marriott@gmail.com>

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

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

Revision 1.17 / (download) - annotate - [select for diffs], Fri Dec 19 00:44:40 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.16: +11 -11 lines
Diff to previous 1.16 (colored)

- fatal() if flock() has failed for any reason that's not EWOULDBLOCK, this
	is not supposed to happen but better safe than sorry.
	suggested by jacekm@
- while at it, remove the locking of delivery file we create when doing a
	Maildir delivery. the purpose of Maildir is to prevent the need
	for locking in the first place ... I must have been tired that day.

Revision 1.16 / (download) - annotate - [select for diffs], Fri Dec 19 00:39:05 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.15: +23 -14 lines
Diff to previous 1.15 (colored)

- smtpd handled mbox locking failures as "regular" temporary failures which
	is not good at all. As a result, under heavy load messages would be
	kept in queue, and delayed for hours just because we failed locking
	a few times. This commit makes smtpd distinguish between lock fails
	and "regular" temporary fails.
- delivery scheduler will reschedule immediately a message that couldn't be
	delivered because of a lock fail. If we fail to lock too many times
	we fallback to previous "delay increase" logic.

	"looks sane" jacekm@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Dec 17 18:47:37 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Introduce /purge, where all msgs scheduled for deletion are put by
queue, and removed from disk by runner.

On startup, clean /incoming by moving msgs within it to /purge.

ok gilles@

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

- snprintf -> bsnprintf

Revision 1.13 / (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.12: +6 -2 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Wed Dec 3 17:58:00 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.11: +12 -5 lines
Diff to previous 1.11 (colored)

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

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

- do not set nochdir in daemon() call, we want parent and lka to have their
	wd reset to / rather than current working directory.
	From Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.10 / (download) - annotate - [select for diffs], Mon Nov 17 20:37:48 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.9: +17 -13 lines
Diff to previous 1.9 (colored)

- replace uses of O_EXLOCK and O_EXLOCK|O_NONBLOCK with the corresponding
	open()/flock() constructs as chl@ says it prevents him from doing
	a portable build.

discussed with chl@, diff is common work from him and myself

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

- exit() -> _exit()
- err()  -> fatal()

Both by Jacek Masiulaniec <jacekm@dobremiasto.net>

Revision 1.8 / (download) - annotate - [select for diffs], Tue Nov 11 21:02:20 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.7: +11 -10 lines
Diff to previous 1.7 (colored)

- temporarily comment chl@'s O_EXLOCK -> fcntl() change until we understand
	what causes the mailbox lock bug i'm observing under heavy load.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Nov 11 01:01:39 2008 UTC (15 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.6: +22 -4 lines
Diff to previous 1.6 (colored)

remove the use of O_EXLOCK, when open()ing a file, and use flock() instead.

ok gilles@

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

spaces fixed while reading code

Revision 1.5 / (download) - annotate - [select for diffs], Mon Nov 10 03:41:53 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.4: +12 -15 lines
Diff to previous 1.4 (colored)

- simplify the passing of ssl cert/key during ssl configuration,
	from Jacek Masiulaniec <jacekm@dobremiasto.net>

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

- snprintf() can return -1, make sure every call is checked properly

Revision 1.3 / (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.2: +2 -0 lines
Diff to previous 1.2 (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.2 / (download) - annotate - [select for diffs], Sun Nov 2 08:19:13 2008 UTC (15 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

various minor tweaks, including spelling fixes from Brian Keefer
and Jim Razmus;

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.