OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.131 / (download) - annotate - [select for diffs], Sat Jan 20 09:01:03 2024 UTC (4 months, 2 weeks ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.130: +3 -2 lines
Diff to previous 1.130 (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.130 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months, 1 week ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.129: +2 -1 lines
Diff to previous 1.129 (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.129 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:15 2023 UTC (15 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.128: +1 -3 lines
Diff to previous 1.128 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

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

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

ok jung@

Revision 1.127 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.126: +3 -4 lines
Diff to previous 1.126 (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.126 / (download) - annotate - [select for diffs], Thu Dec 31 08:27:15 2020 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.125: +14 -14 lines
Diff to previous 1.125 (colored)

Rename the pony process to dispatcher and klondike to crypto.

From gilles@
OK millert@ giovanni@

Revision 1.125 / (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.124: +1 -7 lines
Diff to previous 1.124 (colored)

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

requested by deraadt@

Revision 1.124 / (download) - annotate - [select for diffs], Wed Sep 23 18:01:26 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
Changes since 1.123: +8 -2 lines
Diff to previous 1.123 (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.123 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.122: +3 -3 lines
Diff to previous 1.122 (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.122 / (download) - annotate - [select for diffs], Mon May 14 15:23:05 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.121: +1 -3 lines
Diff to previous 1.121 (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.121 / (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.120: +3 -1 lines
Diff to previous 1.120 (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.120 / (download) - annotate - [select for diffs], Mon Nov 27 08:35:59 2017 UTC (6 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (colored)

Show correct command execution status by checking against update
operation return value.

Issue reported by 'Zelest' (Jesper Wallin).
Suggestions and ok eric@ gilles@.

Revision 1.119 / (download) - annotate - [select for diffs], Thu Nov 23 07:23:36 2017 UTC (6 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.118: +27 -54 lines
Diff to previous 1.118 (colored)

simplify imsg handler.

ok sunil@ gilles@

Revision 1.118 / (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_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.117: +14 -15 lines
Diff to previous 1.117 (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.117 / (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.116: +10 -22 lines
Diff to previous 1.116 (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.116 / (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.115: +3 -4 lines
Diff to previous 1.115 (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.115 / (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.114: +2 -18 lines
Diff to previous 1.114 (colored)

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

ok gilles@

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

remove noop function

ok sunil@

Revision 1.113 / (download) - annotate - [select for diffs], Sat May 28 21:21:20 2016 UTC (8 years ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.112: +2 -13 lines
Diff to previous 1.112 (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.112 / (download) - annotate - [select for diffs], Fri Mar 25 15:06:58 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored)

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

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

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

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

No functional change.

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

ok gilles@

Revision 1.111 / (download) - annotate - [select for diffs], Tue Feb 9 10:38:02 2016 UTC (8 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.110: +11 -11 lines
Diff to previous 1.110 (colored)

rename variable sun to s_un to ease portability

diff from Freddy DISSAUX, ok gilles@, jung@, sunil@, millert@

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

Check imsg data size before use.

Ok eric@ millert@

Revision 1.109 / (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.108: +3 -3 lines
Diff to previous 1.108 (colored)

remove spaces after '!'

no binary change

ok millert

Revision 1.108 / (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.107: +3 -1 lines
Diff to previous 1.107 (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.107 / (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.106: +31 -1 lines
Diff to previous 1.106 (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.106 / (download) - annotate - [select for diffs], Tue Oct 13 10:59:04 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.105: +4 -1 lines
Diff to previous 1.105 (colored)

pledge() control process

ok deraadt@

Revision 1.101.4.2 / (download) - annotate - [select for diffs], Fri Oct 2 01:33:33 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_6
Changes since 1.101.4.1: +7 -3 lines
Diff to previous 1.101.4.1 (colored) to branchpoint 1.101 (colored) next main 1.102 (colored)

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

Revision 1.102.2.2 / (download) - annotate - [select for diffs], Fri Oct 2 01:28:43 2015 UTC (8 years, 8 months ago) by gilles
Branch: OPENBSD_5_7
Changes since 1.102.2.1: +7 -3 lines
Diff to previous 1.102.2.1 (colored) to branchpoint 1.102 (colored) next main 1.103 (colored)

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

Revision 1.104.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.104: +7 -3 lines
Diff to previous 1.104 (colored) next main 1.105 (colored)

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

Revision 1.105 / (download) - annotate - [select for diffs], Fri Oct 2 00:26:45 2015 UTC (8 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.104: +7 -3 lines
Diff to previous 1.104 (colored)

do not allow connid to wrap and collide with another active connection id.
this allows a local user to trigger a fatal() and exit the daemon.

reported by Qualys Security

Revision 1.104 / (download) - annotate - [select for diffs], Thu Jun 11 19:27:16 2015 UTC (9 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE
Branch point for: OPENBSD_5_8
Changes since 1.103: +35 -4 lines
Diff to previous 1.103 (colored)

local user can cause smtpd to fail by sending invalid imsg to control sock

Revision 1.102.2.1 / (download) - annotate - [select for diffs], Thu Jun 11 19:25:36 2015 UTC (9 years ago) by gilles
Branch: OPENBSD_5_7
Changes since 1.102: +35 -4 lines
Diff to previous 1.102 (colored)

errata 8

Revision 1.101.4.1 / (download) - annotate - [select for diffs], Thu Jun 11 19:24:38 2015 UTC (9 years ago) by gilles
Branch: OPENBSD_5_6
Changes since 1.101: +35 -4 lines
Diff to previous 1.101 (colored)

errata 25

Revision 1.103 / (download) - annotate - [select for diffs], Thu May 28 17:09:18 2015 UTC (9 years ago) by florian
Branch: MAIN
Changes since 1.102: +1 -2 lines
Diff to previous 1.102 (colored)

Do not try to unlink the control socket in an unprivileged child
process on shutdown.
Found while working on tame(2).
OK gilles@

Revision 1.102 / (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.101: +3 -2 lines
Diff to previous 1.101 (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.101 / (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.100: +36 -16 lines
Diff to previous 1.100 (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.100 / (download) - annotate - [select for diffs], Sat Apr 19 11:17:14 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.99: +2 -2 lines
Diff to previous 1.99 (colored)

it's ok for strlcpy to fail here though it can't, cast void

Revision 1.99 / (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.98: +0 -1 lines
Diff to previous 1.98 (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.98 / (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.97: +28 -36 lines
Diff to previous 1.97 (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.97 / (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.96: +9 -1 lines
Diff to previous 1.96 (colored)

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

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

bcopy -> memmove
bzero -> memset

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

fix smtpctl resume route

Revision 1.92 / (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.91: +4 -0 lines
Diff to previous 1.91 (colored)

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

Revision 1.91 / (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.90: +32 -24 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Fri Oct 25 18:58:10 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.89: +12 -18 lines
Diff to previous 1.89 (colored)

Improve reporting in smtpctl and a few fixes.

When sending a request to the scheduler, wait for the success/failure
report from the scheduler.  Simplify the code by introducing generic
functions for interruptible iteration over envelopes.  Report the total
number of affected envelopes for schedule, pause, resume and remove
envelope operations.

Revision 1.89 / (download) - annotate - [select for diffs], Fri Jul 19 21:14:52 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.88: +39 -0 lines
Diff to previous 1.88 (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.88 / (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.87: +17 -1 lines
Diff to previous 1.87 (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.87 / (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.86: +4 -3 lines
Diff to previous 1.86 (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.86 / (download) - annotate - [select for diffs], Fri Jul 19 07:49:08 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.85: +1 -2 lines
Diff to previous 1.85 (colored)

Remove useless sc_pid from struct smtpd.

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.84 / (download) - annotate - [select for diffs], Fri Apr 12 18:22:49 2013 UTC (11 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (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.83 / (download) - annotate - [select for diffs], Mon Mar 11 17:40:11 2013 UTC (11 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.82: +3 -2 lines
Diff to previous 1.82 (colored)

handle ECONNABORTED errors from accept().  In many code blocks they can be
ignored silently and without aborting, much like EINTR and EWOULDBLOCK are.
ok's from various maintainers of these directories...

Revision 1.82 / (download) - annotate - [select for diffs], Sat Jan 26 09:37:23 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.81: +325 -328 lines
Diff to previous 1.81 (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.81 / (download) - annotate - [select for diffs], Fri Nov 23 12:59:21 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.80: +3 -1 lines
Diff to previous 1.80 (colored)

send ack on update map.

ok gilles@

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

knf

ok gilles@

Revision 1.79 / (download) - annotate - [select for diffs], Tue Nov 20 09:47:45 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.78: +39 -1 lines
Diff to previous 1.78 (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.78 / (download) - annotate - [select for diffs], Mon Nov 12 14:58:53 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.77: +74 -13 lines
Diff to previous 1.77 (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.77 / (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.76: +7 -4 lines
Diff to previous 1.76 (colored)

implement and document "smtpctl stop"

ok gilles@

Revision 1.76 / (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.75: +16 -2 lines
Diff to previous 1.75 (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.75 / (download) - annotate - [select for diffs], Fri Sep 28 12:00:09 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.74: +32 -40 lines
Diff to previous 1.74 (colored)

smtpd.h/control.c cleanups:

- move session_socket_* prototypes under util.c
- move struct ctl_conn in control.c
- make static functions static
- remove unused functions
- call unlink() in control_shutdown()
- make control_close() take a ctl_conn * instead of a fd

ok chl@ gilles@

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

use xmalloc()/xcalloc() helpers

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

ok gilles@ eric@

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

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

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

ok gilles@

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

- add myself to the copyright in control.c, i've done quite a few changes
there in the last few years ;-)
- get rid of availdesc(): getdtablecount() is so much more reliable
- get rid of env->sc_maxconn, we can be much smarter with getdtablecount()
	and getdtablesize()
- disable accept when we hit the control process fd reserve
- disable accept when we fail
- enable accept when we're back below the limit

this is not the full fd exhaustion diff, i'll merge changes from relayd
tomorrow, this was only required to get rid of the env->sc_maxconn and
availdesc() mess

"reads alright" eric@

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

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

ok eric@, ok chl@

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

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

log pause/resume from the administrator to maillog.
suggested by Jan Stary.

ok gilles@ chl@

Revision 1.69 / (download) - annotate - [select for diffs], Mon Aug 20 18:18:16 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.68: +5 -4 lines
Diff to previous 1.68 (colored)

Do not send more bytes than necessary with IMSG_STAT_*.  The INCREMENT
and DECREMENT messages just contain the key with the ending zero.  For
IMSG_STAT_SET, the value is found at the beginning of the message, and
the rest is the key.

ok gilles@

Revision 1.68 / (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.67: +60 -10 lines
Diff to previous 1.67 (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.67 / (download) - annotate - [select for diffs], Fri Aug 10 09:16:02 2012 UTC (11 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.66: +24 -25 lines
Diff to previous 1.66 (colored)

code cleanup

ok gilles@

Revision 1.66 / (download) - annotate - [select for diffs], Wed Aug 8 17:33:55 2012 UTC (11 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.65: +2 -2 lines
Diff to previous 1.65 (colored)

remove useless defines

ok gilles@ chl@

Revision 1.65 / (download) - annotate - [select for diffs], Mon Jul 9 09:57:53 2012 UTC (11 years, 11 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.64: +6 -6 lines
Diff to previous 1.64 (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.64 / (download) - annotate - [select for diffs], Thu Jan 12 18:06:18 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.63: +1 -17 lines
Diff to previous 1.63 (colored)

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

ok gilles@

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

when receiving an unexpected imsg, print its name.

with help and ideas from eric@

ok eric@ gilles@

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

show messages sent between processes in debug mode

ok gilles@ chl@

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

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

ok gilles@ chl@

Revision 1.59 / (download) - annotate - [select for diffs], Thu Jul 21 23:29:24 2011 UTC (12 years, 10 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.58: +33 -1 lines
Diff to previous 1.58 (colored)

- update smtpctl.8 to reflect reality
- bring back 'smtpctl schedule' and 'smtpctl remove' to life

Things you should know:

The ramqueue data structure is not finished yet and lacks an envelope tree
for evpid lookups. I wanted to wait until I'm done but too many people are
affected by not being able to reschedule envelopes, this is a quick fix.

So right now there's an O(rrible) complexity as both commands will perform
a (possibly aborted) queue scan leading to O(n). I will make that O(log n)
soon.

Also, smtpctl remove no longer supports removing an entire message, I will
fix that very soon too.

Revision 1.58 / (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.57: +19 -22 lines
Diff to previous 1.57 (colored)

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

discussed with and ok gilles@

Revision 1.57 / (download) - annotate - [select for diffs], Wed Apr 13 20:53:18 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.56: +1 -89 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Sun Nov 28 13:56:43 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.55: +3 -1 lines
Diff to previous 1.55 (colored)

a bit of .h cleanups, no functionnal change

Revision 1.55 / (download) - annotate - [select for diffs], Wed Nov 24 23:27:04 2010 UTC (13 years, 6 months ago) by todd
Branch: MAIN
Changes since 1.54: +3 -1 lines
Diff to previous 1.54 (colored)

add *maxactive stats
"ok and no need to keep them for yourself" gilles@

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

check event_dispatch() return value

ok jacekm@

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

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.50 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.49: +25 -60 lines
Diff to previous 1.49 (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.49 / (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.48: +20 -21 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Wed Apr 21 08:29:01 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.47: +1 -7 lines
Diff to previous 1.47 (colored)

Remove unusable ifdef DEBUG code.

Revision 1.47 / (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.46: +70 -352 lines
Diff to previous 1.46 (colored)

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

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jan 10 16:42:35 2010 UTC (14 years, 5 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.45: +40 -1 lines
Diff to previous 1.45 (colored)

- teach runner how to remove a message from queue given a message id/uid
	and assuming message is not in processing/scheduled state
- teach smtpctl how to request message removal from runner

discussed with todd@, idea ok jacekm@

Revision 1.45 / (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.44: +17 -1 lines
Diff to previous 1.44 (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.44 / (download) - annotate - [select for diffs], Wed Dec 23 17:16:03 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.43: +1 -40 lines
Diff to previous 1.43 (colored)

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

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

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

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

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

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

Tested by todd@ and oga@

"looks good" to gilles@

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

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

Revision 1.42 / (download) - annotate - [select for diffs], Wed Dec 2 19:10:02 2009 UTC (14 years, 6 months ago) by mk
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

log_warn() consistency.

`OK' claudio

Revision 1.41 / (download) - annotate - [select for diffs], Thu Nov 26 22:21:20 2009 UTC (14 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

fix copy & paste error: IMSG_MTA_RESUME --> IMSG_MDA_RESUME

ok gilles

Revision 1.40 / (download) - annotate - [select for diffs], Mon Nov 23 12:03:46 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
Changes since 1.39: +5 -1 lines
Diff to previous 1.39 (colored)

In "smtpd; smtpd;" the second instance would fatal quickly, but it would
remove the smtpd.sock file, without which /usr/sbin/sendmail will fail
causing mails to be queued in offline.

Initially reported by ian@, may explain oga@'s e-mail burst after smtpd
restart.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Oct 25 19:46:31 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.38: +3 -1 lines
Diff to previous 1.38 (colored)

smtpctl reload is work in progress, do not expose it and make sure smtpd's
control process does not try to handle it.

spotted and reported by martijn@bunix.org

Revision 1.38 / (download) - annotate - [select for diffs], Fri Sep 18 00:04:26 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.37: +3 -6 lines
Diff to previous 1.37 (colored)

Remove useless Received line added at the /usr/sbin/sendmail stage, it
was not correctly formatted anyway.  Recording of sender uid has
been moved to the server process (getpeereid), which means it is not
subject to forgery.
Based on problem report by Michael Lechtermann <michael@lechtermann.net>

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

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

Revision 1.36 / (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.35: +7 -7 lines
Diff to previous 1.35 (colored)

imsg_get sets errno so use fatal instead of fatalx.

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

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

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

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

ok pyr@, "I like that" henning@

Revision 1.34 / (download) - annotate - [select for diffs], Sat Jun 6 04:14:21 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.33: +79 -66 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Fri Jun 5 20:43:57 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.32: +35 -35 lines
Diff to previous 1.32 (colored)

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

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

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

Revision 1.31 / (download) - annotate - [select for diffs], Mon May 25 11:17:32 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.30: +7 -1 lines
Diff to previous 1.30 (colored)

Disallow submission using /usr/sbin/sendmail while the server is
paused, configuring, or exiting; ok gilles@

Revision 1.30 / (download) - annotate - [select for diffs], Sun May 24 14:38:56 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sun May 24 14:22:23 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.28: +4 -78 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Wed May 20 16:07:26 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.27: +21 -5 lines
Diff to previous 1.27 (colored)

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

Revision 1.27 / (download) - annotate - [select for diffs], Wed May 20 14:29:44 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.26: +22 -1 lines
Diff to previous 1.26 (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.26 / (download) - annotate - [select for diffs], Tue May 19 11:24:24 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.25: +27 -17 lines
Diff to previous 1.25 (colored)

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

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

use the nitems() macro where appropriate

ok gilles@, jacekm@

Revision 1.24 / (download) - annotate - [select for diffs], Sat May 9 20:04:36 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.23: +6 -1 lines
Diff to previous 1.23 (colored)

fix rare memleak; ok gilles@

Revision 1.23 / (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.22: +7 -7 lines
Diff to previous 1.22 (colored)

correct some fatal(x) calls and error strings

ok gilles@ jacekm@

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

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

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

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

Additional testing by Nigel J. Taylor.

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

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

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

Revision 1.20 / (download) - annotate - [select for diffs], Wed Mar 18 14:48:27 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

previous commit removed "else" condition

Revision 1.19 / (download) - annotate - [select for diffs], Sun Mar 8 20:39:49 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.18: +39 -13 lines
Diff to previous 1.18 (colored)

when operating in enqueue mode, it was easy to make smtpctl fatal() by
writing a small app that sent out of order imsg's. prevent this by use
of a state machine and read event masking.

issue spotted by jacekm@, temporary fix by me. there are ideas around
this, but we want to experiment them a bit and they are low priority.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Mar 1 13:05:41 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.17: +7 -1 lines
Diff to previous 1.17 (colored)

deny regular users to run "smtpctl show stats" and "smtpctl schedule";
ok gilles@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Feb 25 09:30:58 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.16: +4 -2 lines
Diff to previous 1.16 (colored)

NULL pointer dereference
	spotted by Matthew Haub <matthew.haub@alumni.adelaide.edu.au>

Revision 1.16 / (download) - annotate - [select for diffs], Tue Feb 24 12:07:47 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.15: +32 -1 lines
Diff to previous 1.15 (colored)

teach smtpctl's parser how to deal with parameters that are not necessarily
a token so that it is possible to do: smtpctl schedule <message id/uid>

introduce F_MESSAGE_FORCESCHEDULE which lets the runner schedule a message
even if the retry delay has not been expired.

F_MESSAGE_ENQUEUED is a valid flag for a message and should not cause an\
errx() in smtpctl show queue

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

add missing headers

ok gilles@

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

replace MAX* constants by sizeof where possible

ok jacekm@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Feb 17 22:49:22 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

imsg_init depends on ibuf being calloc'd. fix few places where malloc
is used instead; ok gilles@

Problem made visible by malloc.conf = AFGJ, and pointed out by otto@

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

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

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

Implement "smtpctl show stats"; ok gilles@

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jan 27 23:39:41 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.9: +33 -2 lines
Diff to previous 1.9 (colored)

instead of relying on socket permissions to allow or disallow imsg's that
come from the external process (smtpctl/send-mail/etc...), make the socket
world-writeable and request credentials with getpeereid().

discussed with pyr@ who was happy to hand me over UNP opened at the
"passing credentials through a unix socket" page, but hopefully saved by
dlg@ who knew about getpeereid() :-)
cvs: ----------------------------------------------------------------------
cvs: eNTER lOG.  lINES BEGINNING WITH `cvs:' ARE REMOVED AUTOMATICALLY
cvs:
cvs: cOMMITTING IN .
cvs:
cvs: mODIFIED fILES:
cvs: 	CONTROL.C PARSE.Y SMTP.C SMTPD.C SMTPD.H STORE.C

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

first bricks of enqueue code which allows smtpctl to submit mail to queue
without "talking" smtp to listeners. currently, a big part of the server
side code is done (and requires a cleanup), next step is to get it usable
properly from a mail user agent.

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

the data member of ibuf was not set to the environment in control_accept()
which caused th ev_arg member of struct event to be reset after the first
call to control_dispatch_ext (causing a null deref at second call). this
has been driving me nuts for at least an hour ...

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jan 4 22:35:09 2009 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.6: +80 -11 lines
Diff to previous 1.6 (colored)

- smtp can now pause/resume the accepting of incoming messages
- smtpctl recognizes "pause incoming" and "resume incoming"
- setup imsg communication between control process and smtp process

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jan 4 19:37:41 2009 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.5: +46 -1 lines
Diff to previous 1.5 (colored)

- runner is now capable of pausing/resuming the scheduling of deliveries
for both mda and mta batches.
- smtpctl can be used to disable/enable deliveries at runtime using the
pause/resume commands.

ok jacekm@

Revision 1.5 / (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.4: +1 -2 lines
Diff to previous 1.4 (colored)

remove unnecessary includes; ok gilles@

Revision 1.4 / (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.3: +50 -2 lines
Diff to previous 1.3 (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.3 / (download) - annotate - [select for diffs], Mon Nov 17 21:27:03 2008 UTC (15 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

add missing header needed by signal().

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

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

written with excellent advice from jmc@

ok gilles@

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

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

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

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