OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.196 / (download) - annotate - [select for diffs], Sat Jan 20 09:01:03 2024 UTC (4 months, 1 week ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.195: +2 -2 lines
Diff to previous 1.195 (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.195 / (download) - annotate - [select for diffs], Wed May 31 16:51:46 2023 UTC (12 months ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.194: +2 -1 lines
Diff to previous 1.194 (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.194 / (download) - annotate - [select for diffs], Mon Aug 2 12:33:34 2021 UTC (2 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.193: +2 -2 lines
Diff to previous 1.193 (colored)

Fix incorrect status code for expired mails resulting in a misleading
bounce report.

From Erik Brens

Revision 1.193 / (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.192: +1 -12 lines
Diff to previous 1.192 (colored)

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

ok jung@

Revision 1.192 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.191: +3 -4 lines
Diff to previous 1.191 (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.191 / (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.190: +18 -18 lines
Diff to previous 1.190 (colored)

Rename the pony process to dispatcher and klondike to crypto.

From gilles@
OK millert@ giovanni@

Revision 1.190 / (download) - annotate - [select for diffs], Wed Apr 22 11:35:34 2020 UTC (4 years, 1 month ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.189: +1 -10 lines
Diff to previous 1.189 (colored)

Check for the dispatcher name in the envelope validation function.
Fixes a possible crash and caching issue when manually moving an
envelope to the queue with smtpctl discover.

ok millert@

Revision 1.189 / (download) - annotate - [select for diffs], Sun Dec 30 23:09:58 2018 UTC (5 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.188: +1 -2 lines
Diff to previous 1.188 (colored)

Delete unnecessary <libgen.h> #includes

ok deraadt@

Revision 1.188 / (download) - annotate - [select for diffs], Sat Dec 8 08:01:15 2018 UTC (5 years, 5 months ago) by sunil
Branch: MAIN
Changes since 1.187: +5 -5 lines
Diff to previous 1.187 (colored)

Use correct RFC 3464 specified values for Action field in a DSN.
error -> failed
success -> delivered

This fixes DSN parsing for Mailman. Issue reported by Cristiano
Costa on misc@opensmtpd.org.

While here, rename enums to reflect the intent and properly handle
envelope ascii load/dump to understand change in the values.

Suggestions and ok gilles@

Revision 1.187 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.186: +2 -2 lines
Diff to previous 1.186 (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.186 / (download) - annotate - [select for diffs], Thu May 24 11:38:24 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.185: +12 -3 lines
Diff to previous 1.185 (colored)

switch smtpd to new grammar

ok eric@

Revision 1.185 / (download) - annotate - [select for diffs], Mon May 14 15:23:05 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.184: +1 -10 lines
Diff to previous 1.184 (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.184 / (download) - annotate - [select for diffs], Tue Nov 21 12:20:34 2017 UTC (6 years, 6 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.183: +433 -452 lines
Diff to previous 1.183 (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.183 / (download) - annotate - [select for diffs], Mon Jan 9 09:53:23 2017 UTC (7 years, 4 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.182: +2 -2 lines
Diff to previous 1.182 (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.182 / (download) - annotate - [select for diffs], Thu Sep 8 12:06:43 2016 UTC (7 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.181: +7 -22 lines
Diff to previous 1.181 (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.181 / (download) - annotate - [select for diffs], Sun Sep 4 16:10:31 2016 UTC (7 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.180: +3 -4 lines
Diff to previous 1.180 (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.180 / (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.179: +1 -2 lines
Diff to previous 1.179 (colored)

remove noop function

ok sunil@

Revision 1.179 / (download) - annotate - [select for diffs], Wed Aug 31 21:49:01 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.178: +1 -56 lines
Diff to previous 1.178 (colored)

Remove dead code. queue_flow_control() has never been used and is
probably a bad idea.

ok gilles@

Revision 1.178 / (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.177: +2 -13 lines
Diff to previous 1.177 (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.177 / (download) - annotate - [select for diffs], Fri Apr 29 08:55:08 2016 UTC (8 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.176: +8 -12 lines
Diff to previous 1.176 (colored)

fix "smtpctl show queue" reporting "invalid" envelope state.
runtime state is not serialized with the envelope, so add it to the imsg.

ok gilles@

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

Check imsg data length before use.

Ok jung@ gilles@ eric@

Revision 1.175 / (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.174: +2 -2 lines
Diff to previous 1.174 (colored)

remove spaces after '!'

no binary change

ok millert

Revision 1.174 / (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.173: +3 -3 lines
Diff to previous 1.173 (colored)

remove trailing whitespace

ok sunil gilles

Revision 1.173 / (download) - annotate - [select for diffs], Thu Dec 10 07:49:58 2015 UTC (8 years, 5 months ago) by sunil
Branch: MAIN
Changes since 1.172: +9 -3 lines
Diff to previous 1.172 (colored)

While listing envelopes using mailq(or smtpctl show queue), pass
the data between processes by dumping to and loading from a buffer
which is shorter compared to transferring a structure.  Also fixes
mailq on platforms where PATH_MAX is way larger than on OpenBSD
thus exceeding max imsg.

Ok jung@ millert@

Revision 1.172 / (download) - annotate - [select for diffs], Mon Nov 23 06:54:21 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.171: +2 -2 lines
Diff to previous 1.171 (colored)

Restructure bounce content as a multi-part MIME message.
Content-Type header diff from Philipp Takacs <philipp<at>bureaucracy.de>

Ok gilles@ jung@

Revision 1.171 / (download) - annotate - [select for diffs], Thu Nov 5 09:14:31 2015 UTC (8 years, 6 months ago) by sunil
Branch: MAIN
Changes since 1.170: +10 -1 lines
Diff to previous 1.170 (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.170 / (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.169: +84 -1 lines
Diff to previous 1.169 (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.169 / (download) - annotate - [select for diffs], Fri Oct 16 13:37:44 2015 UTC (8 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.168: +2 -2 lines
Diff to previous 1.168 (colored)

Implement real "flock" request and add it to userland programs that
use pledge and file locking.  OK deraadt@

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

whitespaces

Revision 1.167 / (download) - annotate - [select for diffs], Tue Oct 13 11:03:30 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.166: +4 -1 lines
Diff to previous 1.166 (colored)

pledge() queue process

ok deraadt@

Revision 1.166 / (download) - annotate - [select for diffs], Tue Jan 20 17:37:54 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.165: +3 -2 lines
Diff to previous 1.165 (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.165 / (download) - annotate - [select for diffs], Thu Jul 10 15:54:55 2014 UTC (9 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.164: +0 -5 lines
Diff to previous 1.164 (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.164 / (download) - annotate - [select for diffs], Thu Jul 10 14:45:02 2014 UTC (9 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.163: +9 -0 lines
Diff to previous 1.163 (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.163 / (download) - annotate - [select for diffs], Tue Jul 8 15:45:32 2014 UTC (9 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.162: +2 -1 lines
Diff to previous 1.162 (colored)

various queue improvements:

- add a "close" hook to the backend API.
- improve the sync() pattern in queue_fs: only sync at commit
  time and not for every envelope creation
- various fixes to the experimental external queue API.

Revision 1.162 / (download) - annotate - [select for diffs], Sat Apr 19 13:40:24 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.161: +3 -3 lines
Diff to previous 1.161 (colored)

(void) cast strlcpy() and snprintf() that cannot truncate

Revision 1.161 / (download) - annotate - [select for diffs], Tue Apr 8 15:25:43 2014 UTC (10 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.160: +2 -2 lines
Diff to previous 1.160 (colored)

use correct imsg

ok gilles@

Revision 1.160 / (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.159: +82 -111 lines
Diff to previous 1.159 (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.159 / (download) - annotate - [select for diffs], Tue Feb 4 15:44:05 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.158: +38 -10 lines
Diff to previous 1.158 (colored)

Add support for DSN and Enhanced Status Code

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

internal improvements and cleanups

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

Revision 1.157 / (download) - annotate - [select for diffs], Tue Feb 4 09:05:06 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.156: +1 -3 lines
Diff to previous 1.156 (colored)

get rid of fdlimit()

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

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

Revision 1.155 / (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.154: +3 -1 lines
Diff to previous 1.154 (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.154 / (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.153: +2 -1 lines
Diff to previous 1.153 (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.153 / (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.152: +3 -18 lines
Diff to previous 1.152 (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.152 / (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.151: +30 -18 lines
Diff to previous 1.151 (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.151 / (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.150: +16 -6 lines
Diff to previous 1.150 (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.150 / (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.149: +5 -6 lines
Diff to previous 1.149 (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.149 / (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.148: +1 -2 lines
Diff to previous 1.148 (colored)

Remove useless sc_pid from struct smtpd.

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.147 / (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.146: +2 -2 lines
Diff to previous 1.146 (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.146 / (download) - annotate - [select for diffs], Thu Jan 31 18:24:47 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.145: +1 -31 lines
Diff to previous 1.145 (colored)

do not need to tweak the socket sndbuf, now that the envelopes are passed
in compressed form. reduce the default size for envelope messages.

ok gilles@

Revision 1.145 / (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.144: +469 -203 lines
Diff to previous 1.144 (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.144 / (download) - annotate - [select for diffs], Fri Nov 23 09:25:44 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.143: +20 -38 lines
Diff to previous 1.143 (colored)

Replace the qwalk API (to retreive on disk envelopes at runtime) with
a simple QOP_WALK queue operation. Some knf and formating fixes while
there.

ok gilles@

Revision 1.143 / (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.142: +33 -1 lines
Diff to previous 1.142 (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.142 / (download) - annotate - [select for diffs], Tue Nov 13 13:23:23 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.141: +11 -10 lines
Diff to previous 1.141 (colored)

do not miss the last envelope

ok gilles@

Revision 1.141 / (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.140: +29 -19 lines
Diff to previous 1.140 (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.140 / (download) - annotate - [select for diffs], Thu Oct 25 09:51:08 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.139: +2 -21 lines
Diff to previous 1.139 (colored)

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

This makes the server handle envelope bursts more efficiently.

ok gilles@

Revision 1.139 / (download) - annotate - [select for diffs], Sun Oct 14 18:45:34 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.138: +20 -2 lines
Diff to previous 1.138 (colored)

When pushing too many envelopes to the mda at once, we can hit a filedesc
exhaustion situation that kills the server.  For now, put a safe limit on
the number of envelopes sent by the queue process to the mda.

ok gilles@ chl@

Revision 1.138 / (download) - annotate - [select for diffs], Sun Oct 14 13:31:46 2012 UTC (11 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.137: +2 -2 lines
Diff to previous 1.137 (colored)

substitute wrong comas into semicolons

ok gilles@ eric@

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

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

ok gilles@

Revision 1.136 / (download) - annotate - [select for diffs], Wed Sep 19 18:20:36 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.135: +1 -3 lines
Diff to previous 1.135 (colored)

Remove DF_ENQUEUE flag. It is mostly unused and logically broken.
Ignore it in existing envelopes until it gets completely dropped.
Change "smtpctl show queue" to display the address family of the
envelope source instead of the ENQUEUE flag.

ok gilles@

Revision 1.135 / (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.134: +1 -3 lines
Diff to previous 1.134 (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.134 / (download) - annotate - [select for diffs], Mon Sep 10 14:22:11 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.133: +2 -2 lines
Diff to previous 1.133 (colored)

nasty typo.

ok gilles@

Revision 1.133 / (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.132: +1 -8 lines
Diff to previous 1.132 (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.132 / (download) - annotate - [select for diffs], Sat Aug 25 10:23:12 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.131: +2 -2 lines
Diff to previous 1.131 (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.131 / (download) - annotate - [select for diffs], Fri Aug 24 21:24:25 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.130: +17 -4 lines
Diff to previous 1.130 (colored)

log forced removal and expiration of envelopes to maillog.
suggested by Jan Stary.

move queue loading notification to log_debug() while there.

ok gilles@

Revision 1.130 / (download) - annotate - [select for diffs], Fri Aug 24 18:46:46 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.129: +6 -2 lines
Diff to previous 1.129 (colored)

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

ok gilles@

Revision 1.129 / (download) - annotate - [select for diffs], Fri Aug 24 18:26:01 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.128: +7 -4 lines
Diff to previous 1.128 (colored)

Error out if queue_envelope_load() failed, rather than sending crap to
the mta/mda.

ok gilles@

Revision 1.128 / (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.127: +10 -1 lines
Diff to previous 1.127 (colored)

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

ok gilles@

Revision 1.127 / (download) - annotate - [select for diffs], Sat Aug 18 20:52:36 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.126: +10 -15 lines
Diff to previous 1.126 (colored)

zap struct mta_batch. Only pass ids where needed.

ok gilles@

Revision 1.126 / (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.125: +2 -2 lines
Diff to previous 1.125 (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.125 / (download) - annotate - [select for diffs], Sat Aug 11 19:18:36 2012 UTC (11 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.124: +3 -1 lines
Diff to previous 1.124 (colored)

Add missing header needed by PRI format string
Add missing header needed by time()

ok eric@

Revision 1.124 / (download) - annotate - [select for diffs], Thu Aug 9 16:00:31 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.123: +3 -5 lines
Diff to previous 1.123 (colored)

Allow failure reports for different recipients of the same message
to be grouped into a single bounce message.

The bounce structure keeps a list of envelopes.  For now, the list
is constructed by delaying the re-enqueuing of a bounce envelope a
bit, to wait for other bounces from the same message to be part of
the same report.

Revision 1.123 / (download) - annotate - [select for diffs], Thu Aug 9 09:48:02 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.122: +147 -70 lines
Diff to previous 1.122 (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.122 / (download) - annotate - [select for diffs], Wed Aug 8 08:50:42 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.121: +56 -2 lines
Diff to previous 1.121 (colored)

Improve the scheduler backend API.

New envelopes are pushed into the scheduler through the insert()
commit() rollback() transactional interface functions.

Worklists are pulled from the scheduler through a single batch()
interface function, which returns a list of envelope ids and the
type of processing. Envelopes returned in this batch are said to
be "in-flight", as opposed to "pending". They are supposed to be
processed in some way, and either updated() or deleted() at some
point.

The schedule()/remove() functions are used to alter the internal
state of "pending" envelopes to make them schedulable.  The enve-
lopes will be part of a worklist on the next call to batch().

Rewrite the scheduler_ramqueue backend.

The initial queue loading in now done by the queue.

ok gilles@

Revision 1.121 / (download) - annotate - [select for diffs], Mon Jul 9 09:57:53 2012 UTC (11 years, 10 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.120: +20 -20 lines
Diff to previous 1.120 (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.120 / (download) - annotate - [select for diffs], Sun Jul 8 18:13:08 2012 UTC (11 years, 10 months ago) by chl
Branch: MAIN
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (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.119 / (download) - annotate - [select for diffs], Wed Jun 20 20:45:23 2012 UTC (11 years, 11 months ago) by eric
Branch: MAIN
Changes since 1.118: +7 -7 lines
Diff to previous 1.118 (colored)

Finally get rid of the queue_kind enum in the queue API. Keep that
internally in fsqueue backend for now, and let the fsqueue_message()
and fsqueue_envelope() dispatchers do the right thing.

Based on a diff by chl@

ok chl@ gilles@

Revision 1.118 / (download) - annotate - [select for diffs], Mon Jun 18 10:21:16 2012 UTC (11 years, 11 months ago) by chl
Branch: MAIN
Changes since 1.117: +2 -1 lines
Diff to previous 1.117 (colored)

fix potential use of uninitialized variable.

found with valgrind on -portable.

ok gilles@

Revision 1.117 / (download) - annotate - [select for diffs], Sat Jan 28 11:33:07 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.116: +5 -5 lines
Diff to previous 1.116 (colored)

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

it is now possible to write custom schedulers !

ok eric@, ok chl@

Revision 1.116 / (download) - annotate - [select for diffs], Fri Jan 13 21:58:35 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

queue_message_purge() and queue_message_delete() are actually the same
thing. Remove queue_message_purge() in favor of queue_message_delete
and simplify fsqueue_message_delete() implementation to move the
message dir to purge/

ok gilles@

Revision 1.115 / (download) - annotate - [select for diffs], Fri Jan 13 14:01:57 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.114: +7 -3 lines
Diff to previous 1.114 (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.114 / (download) - annotate - [select for diffs], Wed Jan 11 17:46:36 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
Changes since 1.113: +1 -19 lines
Diff to previous 1.113 (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.113 / (download) - annotate - [select for diffs], Mon Nov 21 18:57:54 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.112: +11 -32 lines
Diff to previous 1.112 (colored)

get rid of the "enqueue/" queue; use "incoming/" instead.

ok gilles@ chl@

Revision 1.112 / (download) - annotate - [select for diffs], Tue Nov 15 23:06:39 2011 UTC (12 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.111: +10 -16 lines
Diff to previous 1.111 (colored)

Qwalk, our API to linearly walk over the persistent queue, did not take the
queue_backend into account and assumed a filesystem with a specific layout.

This commit does plenty of things:

- make qwalk an abstraction in the queue_backend API, and impose queue
  drivers to implement qwalk_open(), qwalk() and qwalk_close();

- move previous qwalk_open(), qwalk() and qwalk_close() to the fsqueue
  driver since they were fsqueue specific ...

- make qwalk API work with msgid/evpid instead of pathnames since we're
  going to use the queue_backend API to load envelopes by evpid anyway;

- makes smtpd use *solely* the queue_backend API when manipulating the
  queue. pathnames were removed from smtpd.h and moved into the fsqueue
  which means we can now store a queue anywhere ... as long as we write
  the ten functions or so required for a queue driver ;-)

ok eric@, ok chl@

Revision 1.111 / (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.110: +3 -2 lines
Diff to previous 1.110 (colored)

when receiving an unexpected imsg, print its name.

with help and ideas from eric@

ok eric@ gilles@

Revision 1.110 / (download) - annotate - [select for diffs], Mon Nov 7 11:14:10 2011 UTC (12 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.109: +1 -5 lines
Diff to previous 1.109 (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.109 / (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.108: +5 -5 lines
Diff to previous 1.108 (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.108 / (download) - annotate - [select for diffs], Sun Oct 23 09:30:07 2011 UTC (12 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.107: +12 -12 lines
Diff to previous 1.107 (colored)

fsqueue no longer stores envelopes by dumping the structure, instead use a
couple of load/dump functions to convert to and from a human readable fmt.
while at it kill struct delivery and merge back its fields to the envelope.

this basically means we shouldn't require users to flush their queues every
time we make a change to struct envelope.

work is not done, but we're at a better state than the binary fsqueue so
we'll improve it in-tree.

has been running on my own box for the last 12 hours or so
ok eric@, chl@

Revision 1.107 / (download) - annotate - [select for diffs], Sun Oct 9 18:39:53 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.106: +3 -1 lines
Diff to previous 1.106 (colored)

show messages sent between processes in debug mode

ok gilles@ chl@

Revision 1.106 / (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.105: +3 -3 lines
Diff to previous 1.105 (colored)

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

ok gilles@ chl@

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

add missing header needed by signal()

ok gilles@

Revision 1.104 / (download) - annotate - [select for diffs], Mon May 16 21:05:52 2011 UTC (13 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.103: +26 -32 lines
Diff to previous 1.103 (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.103 / (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.102: +36 -36 lines
Diff to previous 1.102 (colored)

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

discussed with and ok gilles@

Revision 1.102 / (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.101: +11 -12 lines
Diff to previous 1.101 (colored)

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

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

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

Revision 1.100 / (download) - annotate - [select for diffs], Sun Apr 17 11:16:57 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.99: +1 -3 lines
Diff to previous 1.99 (colored)

no functionnal change, getting rid of deprecated prototypes

Revision 1.99 / (download) - annotate - [select for diffs], Fri Apr 15 17:01:05 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.98: +23 -13 lines
Diff to previous 1.98 (colored)

kill message_id and message_uid

smtpd now has an evpid associated to each delivery message, the evpid is an
u_int64_t where the upper 32 bits are the msgid, and the 32 bits are the
envelope unique identifier for that message. this results in lots of space
saved in both disk-based and ram-based queues, but also simplifies a lot of
code.

change has been stressed on my desktop, and has ran on my MX for the entire
afternoon without a regression.

Revision 1.98 / (download) - annotate - [select for diffs], Thu Apr 14 23:26:16 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.97: +10 -17 lines
Diff to previous 1.97 (colored)

- implement missing operations for fsqueue:
	fsqueue_envelope_create(), fsqueue_message_purge()
- kill deprecated functions in queue_shared.c

At this point fsqueue backend is almost complete, all that is left to do is
to move the qwalk() API inside the queue_backend API, then make sure smtpd
is no longer calling anything queue related directly.

Revision 1.97 / (download) - annotate - [select for diffs], Thu Apr 14 22:36:09 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.96: +5 -5 lines
Diff to previous 1.96 (colored)

- implement fsqueue_message_create() and fsqueue_message_commit()
- change a few prototypes to allow bounce messages to use the
	queue_backend API until it gets merged in
- kill functions of the queue API that have been deprecated

Revision 1.96 / (download) - annotate - [select for diffs], Thu Apr 14 21:53:45 2011 UTC (13 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.95: +4 -4 lines
Diff to previous 1.95 (colored)

fsqueue now provides fsqueue_message_fd_r() and fsqueue_message_fd_rw() to
obtain a read{-only,/write} descriptor to the message file.

make sure smtpd uses the new API everywhere it needs a fd, and kill the
many functions that were used until now.

Revision 1.95 / (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.94: +9 -15 lines
Diff to previous 1.94 (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.94 / (download) - annotate - [select for diffs], Sun Nov 28 15:32:00 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.93: +1 -15 lines
Diff to previous 1.93 (colored)

remove unused functions

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

remove all unused headers

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

a bit of .h cleanups, no functionnal change

Revision 1.91 / (download) - annotate - [select for diffs], Sat Oct 9 22:05:35 2010 UTC (13 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.90: +171 -1325 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Mon Sep 20 09:01:09 2010 UTC (13 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.89: +2 -2 lines
Diff to previous 1.89 (colored)

- fix a regression caused by latest commit (long story made short: do not
  attempt to expand the local delivery buffer when relaying mail, it was
  kind of ok before but no longer is)
- use the same buffer for local deliveries to files and commands

tested by jmc@ and I

Revision 1.89 / (download) - annotate - [select for diffs], Fri Jul 23 22:23:24 2010 UTC (13 years, 10 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.88: +2 -4 lines
Diff to previous 1.88 (colored)

smtpd should NOT fatal when it permanently fails a bounce delivery as this
can be a normal situation and will allow a local/authenticated user to
trigger the fatal on purpose ...

ignore permanently failed bounce deliveries since there's not much smtpd
can do anyway, that's what the previous queue code did.

experienced and reported by pirofti@

Revision 1.88 / (download) - annotate - [select for diffs], Thu Jun 10 19:34:51 2010 UTC (13 years, 11 months ago) by chl
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

allow configure queue expiry

with help from jacekm@

ok gilles@ jacekm@

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

check event_dispatch() return value

ok jacekm@

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

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.84 / (download) - annotate - [select for diffs], Tue Jun 1 14:21:52 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.83: +2 -3 lines
Diff to previous 1.83 (colored)

Schedule newly arrived mail immediately, ie. place it at the beginning
of the list of next items to try, or near the beginning if the schedule
contains expired mail, which is of highest priority.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Jun 1 11:27:07 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

It's lasttry + 1 because I initially thought passing identical birth
and lasttry args to queue_retry would make it return birth leading
looped scheduling, but that's not true so drop the "+ 1".

Revision 1.82 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.81: +1232 -172 lines
Diff to previous 1.81 (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.81 / (download) - annotate - [select for diffs], Thu Apr 22 12:13:33 2010 UTC (14 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.80: +1 -3 lines
Diff to previous 1.80 (colored)

- kill the runner_imsg_compose wrapper to reduce indirection
- kill noisy log_debug

Revision 1.80 / (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.79: +48 -10 lines
Diff to previous 1.79 (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.79 / (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.78: +1 -7 lines
Diff to previous 1.78 (colored)

Remove unusable ifdef DEBUG code.

Revision 1.78 / (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.77: +114 -466 lines
Diff to previous 1.77 (colored)

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

Revision 1.77 / (download) - annotate - [select for diffs], Sun Jan 3 14:37:37 2010 UTC (14 years, 5 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.76: +56 -1 lines
Diff to previous 1.76 (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.76 / (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.75: +4 -4 lines
Diff to previous 1.75 (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.75 / (download) - annotate - [select for diffs], Mon Dec 14 16:44:14 2009 UTC (14 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.74: +3 -1 lines
Diff to previous 1.74 (colored)

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

Revision 1.74 / (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.73: +8 -1 lines
Diff to previous 1.73 (colored)

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

Revision 1.73 / (download) - annotate - [select for diffs], Sun Nov 8 21:40:05 2009 UTC (14 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

- make aliases expansion use a rb tree instead of a tail queue, the code
  doesn't take advantage of the new structure yet, but this was a needed
  change for upcoming improvements.
- introduce aliasestree_{lookup,insert,remove} to the aliases api
- rename queue_generate_id() to generate_uid() and move it to utils.c as
  it is used all over the place and not only in queue

tree idea discussed with jacekm@, if you update rebuild aliases db, make
clean and flush queue

Revision 1.72 / (download) - annotate - [select for diffs], Sun Nov 1 22:15:27 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

fix a couple log_info()s,
from Tim van der Molen <tbvdm@xs4all.nl>

Revision 1.71 / (download) - annotate - [select for diffs], Mon Oct 12 22:34:37 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.70: +22 -3 lines
Diff to previous 1.70 (colored)

- fix a null deref which could happen after a couple iterations of the
  aliases/virtual domains resolution code.

- fix a logic bug which caused virtual domains not to be correctly
  handled after one iteration of the aliases resolution code.

- introduce a few helper functions to help clean up and simplify the
  lka code.

- simplify the IS_EXT/IS_MAILBOX/IS_RELAY macros so they manipulate a
  struct path * instead of the mess of dereferences we were passing them.

Revision 1.70 / (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.69: +1 -39 lines
Diff to previous 1.69 (colored)

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

Revision 1.69 / (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.68: +7 -7 lines
Diff to previous 1.68 (colored)

imsg_get sets errno so use fatal instead of fatalx.

Revision 1.68 / (download) - annotate - [select for diffs], Sat Jun 6 04:14:21 2009 UTC (14 years, 11 months ago) by pyr
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.67: +39 -27 lines
Diff to previous 1.67 (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.67 / (download) - annotate - [select for diffs], Fri Jun 5 20:43:57 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.66: +9 -9 lines
Diff to previous 1.66 (colored)

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

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

Fix EV_READ/EV_WRITE testing inside IMSG handlers. Based on similar change
to the routing daemons by claudio@; 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: +2 -2 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:23 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.63: +3 -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], Tue May 19 11:24:24 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.62: +26 -17 lines
Diff to previous 1.62 (colored)

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

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

use the nitems() macro where appropriate

ok gilles@, jacekm@

Revision 1.61 / (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.60: +7 -7 lines
Diff to previous 1.60 (colored)

correct some fatal(x) calls and error strings

ok gilles@ jacekm@

Revision 1.60 / (download) - annotate - [select for diffs], Sat Apr 18 21:01:20 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.59: +6 -65 lines
Diff to previous 1.59 (colored)

remove dead code; made possible by previous commit.

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

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

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

In "smtpctl show stats", break queue.inserts into queue.inserts.remote
and queue.inserts.local; ok gilles@

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

add missing headers

ok gilles@

Revision 1.55 / (download) - annotate - [select for diffs], Fri Feb 20 18:47:53 2009 UTC (15 years, 3 months ago) by jacekm
Branch: MAIN
Changes since 1.54: +8 -6 lines
Diff to previous 1.54 (colored)

purge /enqueue at startup; ok gilles@

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

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

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

Implement "smtpctl show stats"; ok gilles@

Revision 1.52 / (download) - annotate - [select for diffs], Thu Jan 29 12:43:25 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.51: +8 -16 lines
Diff to previous 1.51 (colored)

Common queue walking code for smtpd and smtpctl. Kills majority of showqueue.c,
the remaining code was moved to queue_shared.c; ok gilles@

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

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

ok gilles@

Revision 1.50 / (download) - annotate - [select for diffs], Wed Jan 28 12:58:17 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.49: +2 -220 lines
Diff to previous 1.49 (colored)

move some functions from queue.c to queue_shared.c as they are not only
used by queue process but also by runner, while at it change the prototype
of queue_open_message_file() so it takes the message id and not a batch,
runner process requires the decriptor before it even starts building a
batch.

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

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

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

original idea by jacekm@ a while ago

Revision 1.48 / (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.47: +76 -49 lines
Diff to previous 1.47 (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.47 / (download) - annotate - [select for diffs], Mon Jan 26 22:20:31 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.46: +1 -180 lines
Diff to previous 1.46 (colored)

move some queue related functions that are needed outside of smtpd to the
sharedqueue.c file, smtpctl cannot link queue.o without creating a mess
otherwise. while at it, move some prototypes to smtpd.h as they will be
needed by enqueue code

Revision 1.46 / (download) - annotate - [select for diffs], Mon Jan 26 21:26:07 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.45: +64 -19 lines
Diff to previous 1.45 (colored)

we had a set of functions to deal specifically with incoming messages and
we need the same functions for the enqueue code i'm currently working on.
instead of duplicating the code, add a set of functions which take the
queue we're working on as a parameter and turn the old ones into wrappers.
no functionnal change ... yet

discussed with jacekm@

Revision 1.45 / (download) - annotate - [select for diffs], Mon Jan 12 19:54:37 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.44: +40 -42 lines
Diff to previous 1.44 (colored)

more checks in queue_record_incoming_envelope; ok gilles@

Revision 1.44 / (download) - annotate - [select for diffs], Tue Jan 6 20:17:23 2009 UTC (15 years, 4 months ago) by jacekm
Branch: MAIN
Changes since 1.43: +32 -10 lines
Diff to previous 1.43 (colored)

make file update in queue_update_envelope atomic; ok gilles@

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

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

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

Revision 1.42 / (download) - annotate - [select for diffs], Fri Jan 2 22:08:02 2009 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

fix T_DAEMON_MESSAGE notices delivery; ok gilles@

Revision 1.41 / (download) - annotate - [select for diffs], Fri Jan 2 19:52:53 2009 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.40: +13 -11 lines
Diff to previous 1.40 (colored)

cleanup queue_load_envelope; ok gilles@

Revision 1.40 / (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.39: +1 -8 lines
Diff to previous 1.39 (colored)

remove unnecessary includes; ok gilles@

Revision 1.39 / (download) - annotate - [select for diffs], Wed Dec 31 09:55:24 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.38: +16 -15 lines
Diff to previous 1.38 (colored)

if mkdir/mkdtemp fails, fatal if errno != ENOSPC; ok gilles@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Dec 31 09:50:40 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.37: +10 -10 lines
Diff to previous 1.37 (colored)

rename may fail due to ENOSPC, make smtpd survive this condition; ok gilles@

Revision 1.37 / (download) - annotate - [select for diffs], Wed Dec 31 09:47:11 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.36: +6 -79 lines
Diff to previous 1.36 (colored)

kill unnecessary function; ok gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Mon Dec 29 09:03:25 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.35: +11 -21 lines
Diff to previous 1.35 (colored)

Handle ENOSPC in queue_update_envelope; cleanup the code a bit; ok gilles@

Revision 1.35 / (download) - annotate - [select for diffs], Sat Dec 27 18:18:33 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.34: +1 -30 lines
Diff to previous 1.34 (colored)

kill unused function; ok gilles@

Revision 1.34 / (download) - annotate - [select for diffs], Sat Dec 27 17:36:37 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.33: +9 -23 lines
Diff to previous 1.33 (colored)

cleanup; ok gilles@

Revision 1.33 / (download) - annotate - [select for diffs], Sat Dec 27 17:12:39 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.32: +39 -67 lines
Diff to previous 1.32 (colored)

Put common handler code in a function; ok chl@ gilles@

Revision 1.32 / (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.31: +13 -22 lines
Diff to previous 1.31 (colored)

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

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

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

ok gilles@

Revision 1.30 / (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.29: +33 -49 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sun Dec 14 19:27:47 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.28: +2 -8 lines
Diff to previous 1.28 (colored)

Files under /incoming don't need flock(2)ing anymore.

ok gilles@

Revision 1.28 / (download) - annotate - [select for diffs], Sun Dec 14 19:24:42 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

O_TRUNC is redundant if O_EXCL is specified.

ok gilles@

Revision 1.27 / (download) - annotate - [select for diffs], Sun Dec 14 19:20:59 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

O_TRUNC is redundant if O_EXCL is specified.

ok gilles@

Revision 1.26 / (download) - annotate - [select for diffs], Sun Dec 14 19:16:06 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

queue_create_incoming_layout must return 0 on failure, not -1.

ok gilles@

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

IMSG_* namespace cleanup.

ok gilles@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Dec 11 23:19:00 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

- last snprintf -> bsnprintf

Revision 1.23 / (download) - annotate - [select for diffs], Thu Dec 11 23:17:25 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.22: +53 -90 lines
Diff to previous 1.22 (colored)

- snprintf -> bsnprintf

Revision 1.22 / (download) - annotate - [select for diffs], Sun Dec 7 16:00:07 2008 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.21: +3 -8 lines
Diff to previous 1.21 (colored)

Simplify queue_record_incoming_envelope.

ok gilles@

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

Make queue_delete_incoming_message not fatal on ENOENT condition.
Also, fix function name in fatals.

ok gilles@

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

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

ok gilles@

Revision 1.19 / (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.18: +50 -554 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Wed Dec 3 20:08:08 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.17: +1 -2 lines
Diff to previous 1.17 (colored)

- remove log_debug() that's no longer needed

Revision 1.17 / (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.16: +860 -507 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Tue Nov 25 20:26:40 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.15: +4 -4 lines
Diff to previous 1.15 (colored)

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

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

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

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

- remove some unused prototypes

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

- queue_record_daemon() no longer used, remove definition

Revision 1.12 / (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.11: +13 -8 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Tue Nov 11 21:17:49 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

- mistakenly removed this lock

Revision 1.10 / (download) - annotate - [select for diffs], Tue Nov 11 21:13:14 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.9: +63 -15 lines
Diff to previous 1.9 (colored)

- introduce queue_init_submissions() which will sanitize the disk-based
	queue at startup: catches left overs from interrupted sessions,
	reset F_MESSAGE_INPROCESS so that messages which were in MTA or
	MDA gets scheduled again.
- temporarily comment chl@'s O_EXLOCK -> fcntl change until we figure
	why it locks my mailbox under load

Revision 1.9 / (download) - annotate - [select for diffs], Tue Nov 11 01:08:08 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.8: +66 -1 lines
Diff to previous 1.8 (colored)

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

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

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

ok gilles@

Revision 1.7 / (download) - annotate - [select for diffs], Mon Nov 10 21:29:18 2008 UTC (15 years, 6 months ago) by chl
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

rename h_errno field into getaddrinfo_error, to avoid confusion with errno.

h_errno has been obsoleted since the gethostbyname() --> getaddrinfo() replacement.

ok gilles@

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

spaces fixed while reading code

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

- in queue, do not use the atomic api when dealing with real files
	change based on a comment from deraadt@

- in queue_register_submission(), if an envelope cannot be fully written
	because of some error (ie: disk full), not only return error but
	also remove the partial envelope from file system. this prevents
	the queue process from trying (failing) to reload it over and
	over.

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

- in queue_load_submissions(), if queue_message_from_id() fails for some
	reason just warn instead of aborting the whole smtpd.

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

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

Revision 1.2 / (download) - annotate - [select for diffs], Wed Nov 5 12:14:45 2008 UTC (15 years, 6 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.