OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.49 / (download) - annotate - [select for diffs], Wed Feb 8 08:20:54 2023 UTC (15 months, 3 weeks ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (colored)

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

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

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

ok jung@

Revision 1.47 / (download) - annotate - [select for diffs], Wed May 26 18:08:55 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.46: +17 -17 lines
Diff to previous 1.46 (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.46 / (download) - annotate - [select for diffs], Thu May 20 07:33:32 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.45: +23 -91 lines
Diff to previous 1.45 (colored)

Call tls_accept_socket() and tls_connect_socket() immediatly instead of
going through a deferred event. It makes the code simplier and eliminates
the need to keep the listener tls context in the io structure.

ok tb@

Revision 1.45 / (download) - annotate - [select for diffs], Mon Apr 5 15:50:11 2021 UTC (3 years, 1 month ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.44: +7 -5 lines
Diff to previous 1.44 (colored)

Until tls_accept_socket() succeeds, the tls context bound to a session
belongs to the listener, and should not be freed with that session if
an error occurs before.  Unlink it from the session early in the accept
callback to avoid this.

tweaks and ok millert@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Mar 5 12:37:32 2021 UTC (3 years, 2 months ago) by eric
Branch: MAIN
Changes since 1.43: +91 -102 lines
Diff to previous 1.43 (colored)

Start porting smtpd to libtls.

Note that it changes the way SNI works: The certificate to use is now
selected by looking at the names found in the certificates themselves,
rather than the names of the pki entries in the configuration file.
The set of certificates for a tls listener must be defined explicitly by
using the pki listener option multiple times.

ok tb@

Revision 1.43 / (download) - annotate - [select for diffs], Sat Jan 23 16:11:11 2021 UTC (3 years, 4 months ago) by rob
Branch: MAIN
Changes since 1.42: +5 -5 lines
Diff to previous 1.42 (colored)

Remove unused variables found by clang. Additional unused var spotted by eric@.

OK mvs@, eric@

Revision 1.42 / (download) - annotate - [select for diffs], Wed Jun 12 17:42:53 2019 UTC (4 years, 11 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.41: +84 -84 lines
Diff to previous 1.41 (colored)

change "ssl" to "tls" in various identifiers.
no functional change.

ok gilles@

Revision 1.41 / (download) - annotate - [select for diffs], Wed May 17 14:00:06 2017 UTC (7 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.40: +3 -5 lines
Diff to previous 1.40 (colored)

Introduce more use of freezero().  Also, remove ptr conditionals before
many functions which are free(NULL)-compat
ok gilles

Revision 1.40 / (download) - annotate - [select for diffs], Sat Dec 3 15:46:33 2016 UTC (7 years, 5 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.39: +23 -37 lines
Diff to previous 1.39 (colored)

embed the struct iobuf instead of using a pointer.

ok gilles@ sunil@

Revision 1.39 / (download) - annotate - [select for diffs], Wed Nov 30 17:43:32 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.38: +9 -1 lines
Diff to previous 1.38 (colored)

hide internal io flags and rename IO_PAUSE_{IN,OUT} to IO_{IN,OUT}

ok gilles@ sunil@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Nov 30 11:52:48 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.37: +41 -6 lines
Diff to previous 1.37 (colored)

make struct io opaque:

- move struct io definition to ioev.c
- replace io_init/io_clear with io_new/io_free
- allocate an iobuf for each new io internally
- use struct io pointer in the rest of the code
- remove remaining uses of iobuf_*

ok gilles@ sunil@

Revision 1.37 / (download) - annotate - [select for diffs], Fri Nov 25 16:17:41 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.36: +3 -1 lines
Diff to previous 1.36 (colored)

normalize iobuf before reading into it.

fix regression introduced in recent cleanup

ok gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Thu Nov 24 21:25:21 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.35: +7 -1 lines
Diff to previous 1.35 (colored)

add an io_paused() function.

ok gilles@

Revision 1.35 / (download) - annotate - [select for diffs], Thu Nov 24 20:52:13 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.34: +7 -1 lines
Diff to previous 1.34 (colored)

add an io_fileno() accessor

ok gilles@

Revision 1.34 / (download) - annotate - [select for diffs], Thu Nov 24 20:44:04 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.33: +7 -1 lines
Diff to previous 1.33 (colored)

add an io_ssl() accessor

ok gilles@

Revision 1.33 / (download) - annotate - [select for diffs], Thu Nov 24 12:58:27 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.32: +7 -1 lines
Diff to previous 1.32 (colored)

add an io_error() accessor to avoid dereferencing the io struct directly.

ok gilles@

Revision 1.32 / (download) - annotate - [select for diffs], Thu Nov 24 07:57:48 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.31: +15 -3 lines
Diff to previous 1.31 (colored)

reset the io event when data is queued.
remove all calls to io_reload() which are now unnecessary.

ok gilles@ sunil@

Revision 1.31 / (download) - annotate - [select for diffs], Tue Nov 22 07:28:42 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.30: +4 -1 lines
Diff to previous 1.30 (colored)

Normalize the io input buffer internally when reinstalling the io event, so
the caller doesn't have to bother with this.

ok gilles@ sunil@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Nov 20 08:43:36 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.29: +18 -9 lines
Diff to previous 1.29 (colored)

add dedicated functions to set fd and callback on a struct io.
simplify io_init() prototype.

ok sunil@ gilles@

Revision 1.29 / (download) - annotate - [select for diffs], Thu Nov 17 17:34:55 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.28: +87 -7 lines
Diff to previous 1.28 (colored)

Add io api functions for dealing with buffered data, as wrapper around
their iobuf counterparts.

ok gilles@ sunil@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Nov 17 07:33:06 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.27: +1 -2 lines
Diff to previous 1.27 (colored)

remove IO_TLSVERIFIED which is not a io event, and inline necessary code
where the callback functions are called for this event.

ok gilles@

Revision 1.27 / (download) - annotate - [select for diffs], Wed Nov 16 21:30:37 2016 UTC (7 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

pass the user pointer as parameter to the io callback instead of having
the user dereference the io structure.

ok millert@ gilles@

Revision 1.26 / (download) - annotate - [select for diffs], Mon May 16 21:43:16 2016 UTC (8 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

No need to store the return value of fcntl(fd, F_SETFL, flags).
OK jung@

Revision 1.25 / (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.24: +7 -12 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Mon Dec 28 22:08:30 2015 UTC (8 years, 5 months ago) by jung
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

remove spaces after '!'

no binary change

ok millert

Revision 1.23 / (download) - annotate - [select for diffs], Tue Dec 22 07:54:57 2015 UTC (8 years, 5 months ago) by sunil
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored)

Wrap long lines.

Ok gilles@ jung@

Revision 1.22 / (download) - annotate - [select for diffs], Fri Oct 16 21:13:33 2015 UTC (8 years, 7 months ago) by sthen
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Use SSL_get_version() not SSL_get_cipher_version(); the former gives the TLS
version used for the connection, the latter gives "the SSL/TLS protocol version
that first defined the cipher". Fixes "TLS version=TLSv1/SSLv3" in received/log
lines.

ok millert@ "I was going to commit this today, so yes definitely" ok gilles@

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

whitespaces

Revision 1.20 / (download) - annotate - [select for diffs], Wed Dec 24 13:51:31 2014 UTC (9 years, 5 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Correctly fallback to PLAIN if opportunistics TLS fails during TLS handshake.

fix by Stefan Sieg

ok gilles

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jul 8 07:59:31 2014 UTC (9 years, 10 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

fix typos.

ok jmc@

Revision 1.18 / (download) - annotate - [select for diffs], Sat Apr 19 17:36:54 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.17: +5 -5 lines
Diff to previous 1.17 (colored)

(void) cast snprintf() calls that cannot truncate (and would be harmless
	otherwise)

Revision 1.17 / (download) - annotate - [select for diffs], Sat Apr 19 12:48:54 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.16: +19 -19 lines
Diff to previous 1.16 (colored)

(void) cast strlcat(), they can't truncate

Revision 1.16 / (download) - annotate - [select for diffs], Tue Feb 4 09:59:21 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.15: +4 -2 lines
Diff to previous 1.15 (colored)

do not call event_del() on non-initialized events

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

bcopy -> memmove
bzero -> memset

Revision 1.14 / (download) - annotate - [select for diffs], Sat Oct 26 12:27:59 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.13: +8 -8 lines
Diff to previous 1.13 (colored)

%i -> %d in format strings

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jun 3 15:57:40 2013 UTC (11 years ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.12: +4 -1 lines
Diff to previous 1.12 (colored)

call SSL_read() again if there is data pending in the SSL buffer.
fixes possible timeout on ssl sessions.

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.11 / (download) - annotate - [select for diffs], Tue Feb 5 11:45:18 2013 UTC (11 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.10: +1 -3 lines
Diff to previous 1.10 (colored)

- handle getaddrinfo() error as LKA_TEMPFAIL
- handle getsockname() error in smtp_connected()
- accept '/' as part of user-part, expand to ':' as done by qmail
- fix wrong check in mda leading to bogus Return-Path header
- fix aliases parsing when there's a white space between key and separator
- some cosmethic cleanup

Revision 1.10 / (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.9: +55 -13 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Fri Nov 23 10:55:25 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.8: +6 -6 lines
Diff to previous 1.8 (colored)

knf

ok gilles@

Revision 1.8 / (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.7: +3 -3 lines
Diff to previous 1.7 (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.7 / (download) - annotate - [select for diffs], Thu Oct 25 18:14:24 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.6: +5 -2 lines
Diff to previous 1.6 (colored)

Handle the case where writev() fails with EAGAIN.  In theory it cannot
happen, but it seems that kqueue triggers the event sometimes, even if
the socket is not immediatly writeable.  Temporary workaround it while
the real issue is being investigated.

ok gilles@ chl@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Oct 10 19:38:04 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.5: +5 -2 lines
Diff to previous 1.5 (colored)

io_connect() can take an optional address to bind() before connecting.

ok gilles@

Revision 1.5 / (download) - annotate - [select for diffs], Fri Sep 14 19:20:52 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.4: +22 -4 lines
Diff to previous 1.4 (colored)

When printing ioev, do not segfault if there is no associated iobuf.
Also give info about the cipher if there is an ssl context.

ok chl@ gilles@

Revision 1.4 / (download) - annotate - [select for diffs], Sun Aug 19 10:28:28 2012 UTC (11 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.3: +10 -2 lines
Diff to previous 1.3 (colored)

Add warnings on io errors to help diagnosis.

ok gilles@ chl@

Revision 1.3 / (download) - annotate - [select for diffs], Fri May 25 13:52:33 2012 UTC (12 years ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.2: +1 -4 lines
Diff to previous 1.2 (colored)

remove unused variable

ok gilles@

Revision 1.2 / (download) - annotate - [select for diffs], Mon Jan 30 10:02:55 2012 UTC (12 years, 4 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

Add missing header needed by PRI format string

ok eric@ gilles@

Revision 1.1 / (download) - annotate - [select for diffs], Sun Jan 29 00:32:51 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN

Import generic network IO code.  The plan is to hide the boring
details of IO operations such as buffering or SSL, and provide a
slightly nicer interface to the protocol writer.

Not plugged to the rest of the code yet.

ok gilles@

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.