OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.40 / (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.39: +2 -2 lines
Diff to previous 1.39 (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.39 / (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_4_BASE, OPENBSD_7_4, 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.38: +1 -15 lines
Diff to previous 1.38 (colored)

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

ok jung@

Revision 1.38 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.37: +2 -3 lines
Diff to previous 1.37 (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.37 / (download) - annotate - [select for diffs], Sun Dec 20 14:06:12 2020 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.36: +3 -2 lines
Diff to previous 1.36 (colored)

Onlly call event_del if there are events enabled, since not all libevents
are created equal.

From gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Tue Mar 17 09:01:53 2020 UTC (4 years, 2 months ago) by tobhe
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.35: +3 -1 lines
Diff to previous 1.35 (colored)

Exit when m_get_string() returns NULL to prevent nullptr dereference in
strlen().

ok millert@

Revision 1.35 / (download) - annotate - [select for diffs], Thu Oct 3 05:50:28 2019 UTC (4 years, 8 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.34: +3 -2 lines
Diff to previous 1.34 (colored)

check imsg_flush() return value and fatal() if == -1

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

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

Revision 1.33 / (download) - annotate - [select for diffs], Fri May 24 14:31:30 2019 UTC (5 years ago) by gilles
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

fix typo in fatal message to -> too

Revision 1.32 / (download) - annotate - [select for diffs], Mon Dec 17 08:56:31 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.31: +6 -1 lines
Diff to previous 1.31 (colored)

set the return pointer to NULL when receiving a 0-sized data.

ok gilles

Revision 1.31 / (download) - annotate - [select for diffs], Thu Dec 13 17:08:10 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.30: +14 -1 lines
Diff to previous 1.30 (colored)

in event reports, use a struct timeval instead of time_t since we want more
than second precision

discussed with eric@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Nov 11 14:00:51 2018 UTC (5 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.29: +16 -2 lines
Diff to previous 1.29 (colored)

accept NULL as a valid string in the proc message formating api.

ok gilles@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Mar 17 20:57:57 2017 UTC (7 years, 2 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.28: +3 -14 lines
Diff to previous 1.28 (colored)

switch to recallocarray() and remove useless pre-allocation.

prodded by deraadt@ ok gilles@

Revision 1.28 / (download) - annotate - [select for diffs], Wed Sep 14 08:59:56 2016 UTC (7 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.27: +1 -5 lines
Diff to previous 1.27 (colored)

remove useless #ifndef

ok sunil@

Revision 1.27 / (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.26: +7 -9 lines
Diff to previous 1.26 (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.26 / (download) - annotate - [select for diffs], Sat Sep 3 16:06:26 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.25: +43 -93 lines
Diff to previous 1.25 (colored)

get rid of the type-checking system on internal messages.
bump all imsg protocol versions since message format changed.

ok gilles@ sunil@

Revision 1.25 / (download) - annotate - [select for diffs], Fri Sep 2 13:41:10 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.24: +6 -9 lines
Diff to previous 1.24 (colored)

use imsg_read_nofd() implementation from bgpd.
let the caller handle EAGAIN.

ok gilles@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Sep 1 15:12:45 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.23: +1 -9 lines
Diff to previous 1.23 (colored)

zap dead code

ok gilles@ sunil@

Revision 1.23 / (download) - annotate - [select for diffs], Thu Sep 1 14:19:33 2016 UTC (7 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.22: +2 -71 lines
Diff to previous 1.22 (colored)

Get rid of the custom msgbuf_write2() function adapted from libutil.
It is not necessary now that the profiling code is gone.

ok gilles@ sunil@

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

get rid of the imsg buffer usage profiling code.

ok gilles@ jung@ sunil@

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

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

ok gilles@

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jun 6 20:48:15 2016 UTC (8 years ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

do not return on EAGAIN otherwise the event is never reloaded.

ok gilles@

Revision 1.19 / (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.18: +3 -3 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Wed Feb 10 15:03:37 2016 UTC (8 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.17: +10 -6 lines
Diff to previous 1.17 (colored)

Change imsg_read() return value checking from an if..else block to
a switch statement for improved readability.  OK jung@ sunil@ gilles@

Revision 1.17 / (download) - annotate - [select for diffs], Tue Feb 9 11:50:49 2016 UTC (8 years, 4 months ago) by sunil
Branch: MAIN
Changes since 1.16: +6 -7 lines
Diff to previous 1.16 (colored)

r1.16 accidentally masked retries on EAGAIN introduced in r1.15.
Fix and simplify imsg_read() return value checking into a single
if..else block.

Ok gilles@ jung@

Revision 1.16 / (download) - annotate - [select for diffs], Sat Dec 5 13:14:21 2015 UTC (8 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.15: +4 -4 lines
Diff to previous 1.15 (colored)

EAGAIN handling for imsg_read. OK henning@ benno@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Oct 14 21:27:29 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.14: +3 -1 lines
Diff to previous 1.14 (colored)

imsg_read() may return EAGAIN, handle it in mproc_dispatch()

Revision 1.14 / (download) - annotate - [select for diffs], Wed Oct 14 21:18:19 2015 UTC (8 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.13: +12 -6 lines
Diff to previous 1.13 (colored)

whitespace + only log TRACE_MPROC if not IMSG_STAT_{IN,DE}CREMENT

Revision 1.10.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.10.4.1: +31 -2 lines
Diff to previous 1.10.4.1 (colored) to branchpoint 1.10 (colored) next main 1.11 (colored)

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

Revision 1.11.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.11.2.1: +31 -2 lines
Diff to previous 1.11.2.1 (colored) to branchpoint 1.11 (colored) next main 1.12 (colored)

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

Revision 1.12.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.12: +31 -2 lines
Diff to previous 1.12 (colored) next main 1.13 (colored)

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

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

introduce imsg_read_nofd() to allow reading imsg while discarding fd's when
reading from a context where we don't expect/want to receive one.

this prevents a local user from exhausting resources and causing smtpd to
hang by crafting valid imsg that don't expect a descriptor but passing one
anyways.

reported by Qualys Security

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

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

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

errata 8

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

errata 25

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:20 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.10: +2 -1 lines
Diff to previous 1.10 (colored)

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

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jul 8 13:49:09 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.9: +54 -5 lines
Diff to previous 1.9 (colored)

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

ok gilles@

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

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

ok gilles@

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

(void) cast snprintf() call used to craft fatalx() message from within
	smtpd, buffer is large enough and truncation harmless, we want to
	avoid memory allocation in that case and use a best-effort

Revision 1.7 / (download) - annotate - [select for diffs], Thu Dec 26 17:25:32 2013 UTC (10 years, 5 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

bcopy -> memmove
bzero -> memset

Revision 1.6 / (download) - annotate - [select for diffs], Thu Nov 21 08:35:54 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.5: +5 -4 lines
Diff to previous 1.5 (colored)

correctly handle EAGAIN and closed pipe in msgbuf_write()

Revision 1.5 / (download) - annotate - [select for diffs], Thu Oct 24 19:20:46 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.4: +9 -2 lines
Diff to previous 1.4 (colored)

Do not fatal() immediatly on write error, but report to the upper layer.
Fix a bug where the server would stop if smtpctl exits early.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jul 19 15:18:42 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

typo

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jan 31 18:34:43 2013 UTC (11 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.1: +15 -6 lines
Diff to previous 1.1 (colored)

assorted fixes spotted by Coverity.
some log message updates.

ok gilles@

Revision 1.1 / (download) - annotate - [select for diffs], Sat Jan 26 09:37:23 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN

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@

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.