OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.53 / (download) - annotate - [select for diffs], Tue May 28 07:10:30 2024 UTC (11 days, 14 hours ago) by op
Branch: MAIN
CVS Tags: HEAD
Changes since 1.52: +3 -2 lines
Diff to previous 1.52 (colored)

actually honour the services supported by the proc tables

ok gilles@

Revision 1.52 / (download) - annotate - [select for diffs], Tue May 7 12:10:06 2024 UTC (4 weeks, 4 days ago) by op
Branch: MAIN
Changes since 1.51: +47 -16 lines
Diff to previous 1.51 (colored)

change the smtpd table protocol

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

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

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

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

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

ok gilles

Revision 1.51 / (download) - annotate - [select for diffs], Thu Jan 4 09:34:03 2024 UTC (5 months ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.50: +15 -16 lines
Diff to previous 1.50 (colored)

fix IPv6 addresses table lookups

Rework parse_sockaddr() to not reach inet_pton() with a brace-wrapped
IPv6 address.

Issue reported by Kirill Miazine.
ok millert@

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jun 14 17:58:16 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.49: +3 -13 lines
Diff to previous 1.49 (colored)

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

ok jung@

Revision 1.49 / (download) - annotate - [select for diffs], Wed Dec 23 08:12:14 2020 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.48: +7 -2 lines
Diff to previous 1.48 (colored)

Use regfree after we're done with preg.

From gilles@

Revision 1.48 / (download) - annotate - [select for diffs], Thu Jan 10 07:40:52 2019 UTC (5 years, 4 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, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.47: +29 -27 lines
Diff to previous 1.47 (colored)

report errno in debug logs and other minor cleanups.

ok gilles@

Revision 1.47 / (download) - annotate - [select for diffs], Fri Dec 28 15:09:28 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.46: +39 -25 lines
Diff to previous 1.46 (colored)

introduce table_dump() and tweak format

ok gilles@

Revision 1.46 / (download) - annotate - [select for diffs], Fri Dec 28 13:47:54 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.45: +2 -9 lines
Diff to previous 1.45 (colored)

simplify code

ok gilles@

Revision 1.45 / (download) - annotate - [select for diffs], Fri Dec 28 11:40:29 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.44: +5 -24 lines
Diff to previous 1.44 (colored)

remove the tag workaround for table_create() and table_find(),
now that static tables handle their updates internally.

ok gilles@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Dec 28 11:13:58 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.43: +1 -7 lines
Diff to previous 1.43 (colored)

remove unused members in struct table

Revision 1.43 / (download) - annotate - [select for diffs], Thu Dec 27 15:04:59 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.42: +5 -8 lines
Diff to previous 1.42 (colored)

table_fetch() always expect a valid dst pointer.

ok gilles@

Revision 1.42 / (download) - annotate - [select for diffs], Thu Dec 27 14:23:41 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.41: +8 -25 lines
Diff to previous 1.41 (colored)

introduce dump() and add() table methods, only implemented for static tables.

ok gilles@

Revision 1.41 / (download) - annotate - [select for diffs], Thu Dec 27 09:30:29 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored)

pass the table pointer to the lookup()/fecth() methods

ok gilles@

Revision 1.40 / (download) - annotate - [select for diffs], Thu Dec 27 08:57:03 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

change the close() method to take the table pointer

ok gilles

Revision 1.39 / (download) - annotate - [select for diffs], Thu Dec 27 08:08:06 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.38: +2 -6 lines
Diff to previous 1.38 (colored)

Make the backend open method return an int to report success.
The implementation is responsible for setting the handle pointer
as needed.

ok gilles@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Dec 26 20:13:43 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.37: +4 -4 lines
Diff to previous 1.37 (colored)

reorder parameters for consistency

Revision 1.37 / (download) - annotate - [select for diffs], Wed Dec 26 15:55:09 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.36: +7 -1 lines
Diff to previous 1.36 (colored)

introduce a table_match() function to check for a key in a table

ok gilles@

Revision 1.36 / (download) - annotate - [select for diffs], Wed Dec 26 14:15:13 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.35: +5 -5 lines
Diff to previous 1.35 (colored)

get rid of the unused dict argument in table lookup and fetch api.

ok gilles@

Revision 1.35 / (download) - annotate - [select for diffs], Wed Dec 26 11:53:02 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.34: +22 -113 lines
Diff to previous 1.34 (colored)

move the table backend name in the backend struct.
remove unused function.

ok gilles@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Dec 23 15:53:24 2018 UTC (5 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.33: +22 -9 lines
Diff to previous 1.33 (colored)

Simplify the table backend interface: lookup results are returned
as strings, and parsing is handled by the upper layer.

ok gilles@

Revision 1.33 / (download) - annotate - [select for diffs], Fri Dec 21 21:35:29 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.32: +8 -2 lines
Diff to previous 1.32 (colored)

since we already support regex lookups in tables for builtin filters, let's
also support regex lookups in match rule criterias performing table lookups

ok millert@

Revision 1.32 / (download) - annotate - [select for diffs], Fri Nov 2 13:45:59 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

add REG_NOSUB to flags in regcompile

suggested by jung@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Nov 1 10:47:46 2018 UTC (5 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.30: +16 -1 lines
Diff to previous 1.30 (colored)

introduce K_REGEX table type and table_regex_match(), unused for now

ok eric@

Revision 1.30 / (download) - annotate - [select for diffs], Sat Jun 16 19:41:26 2018 UTC (5 years, 11 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.29: +15 -15 lines
Diff to previous 1.29 (colored)

rework the table API so that it takes a struct smtpd * context in parameter
of functions creating, looking up or destroying tables.

this is a first step in cleaning up parse.y so it doesn't have side effects
outside of parse_config(), bringing nothing but making code cleaner.

ok millert@

Revision 1.29 / (download) - annotate - [select for diffs], Thu May 31 21:06:12 2018 UTC (6 years ago) by gilles
Branch: MAIN
Changes since 1.28: +3 -3 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Tue May 29 20:58:16 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored)

missing case

ok gilles@

Revision 1.27 / (download) - annotate - [select for diffs], Tue May 29 20:43:07 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.26: +4 -6 lines
Diff to previous 1.26 (colored)

no need to parse and dump the relayhost in the lookup process.

ok gilles@

Revision 1.26 / (download) - annotate - [select for diffs], Mon May 28 17:11:58 2018 UTC (6 years ago) by eric
Branch: MAIN
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored)

zero memory before calling text_to_relayhost()

fix issue reported by semarie@

ok gilles@

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

switch smtpd to new grammar

ok eric@

Revision 1.24 / (download) - annotate - [select for diffs], Mon May 1 09:29:07 2017 UTC (7 years, 1 month ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.23: +2 -1 lines
Diff to previous 1.23 (colored)

in function used for tracing, display unknown lookup types as "???"

diff from Wolf480pl

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jan 4 13:30:20 2016 UTC (8 years, 5 months ago) by jung
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.22: +15 -22 lines
Diff to previous 1.22 (colored)

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

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

ok gilles

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

remove spaces after '!'

no binary change

ok millert

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

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

ok jung@

Revision 1.20 / (download) - annotate - [select for diffs], Mon Nov 23 21:50:12 2015 UTC (8 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.19: +14 -18 lines
Diff to previous 1.19 (colored)

allow table API to lookup for mailaddr mappings

ok sunil@, ok jung@

Revision 1.19 / (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.18: +9 -7 lines
Diff to previous 1.18 (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.18 / (download) - annotate - [select for diffs], Wed Jan 14 09:07:51 2015 UTC (9 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.17: +17 -2 lines
Diff to previous 1.17 (colored)

recipient and sender lists now support the user+TAG notation, allowing
among other things a secondary MX to filter recipients to be relayed to a
primary MX even if they are using tags. there are other nice things to do
with that feature, use your imagination.

tested and ok florian@, tested by several users for a few days too

Revision 1.17 / (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, OPENBSD_5_6
Changes since 1.16: +18 -33 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Fri May 9 21:30:11 2014 UTC (10 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.15: +13 -13 lines
Diff to previous 1.15 (colored)

stop casting sizeof to int

Revision 1.15 / (download) - annotate - [select for diffs], Sat Apr 19 18:01:01 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.14: +26 -8 lines
Diff to previous 1.14 (colored)

these snprintf() calls can't possibly truncate because they copy data from
buffers that are already protected against truncation and that do not
exceed the destination buffer size when copied together ...

however, i think we should add checks here too because it'll help us catch
errors in table backends when adding new ones if we miss a truncation check
there.

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

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

be a bit more strict with an strlcat() truncation by causing it to fail in
table_create() instead of later in parse.y - in both cases, this would
cause smtpd to fatal() at startup if a table has a config file too large

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

bcopy -> memmove
bzero -> memset

Revision 1.12 / (download) - annotate - [select for diffs], Thu Nov 28 10:57:29 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

allow subdomain matching in mailaddr tables

Revision 1.11 / (download) - annotate - [select for diffs], Mon Nov 18 11:47:16 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

change dict_poproot() prototype: do not take key placeholder parameter as
it can't work that way.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Oct 28 18:49:14 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.9: +12 -2 lines
Diff to previous 1.9 (colored)

accept credentials formated as "<user> <passwd>"

Revision 1.9 / (download) - annotate - [select for diffs], Sun Oct 27 18:13:28 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

fix parsing of inet6 addresses when prefixed with "IPv6:"

Revision 1.8 / (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.7: +5 -5 lines
Diff to previous 1.7 (colored)

%i -> %d in format strings

Revision 1.7 / (download) - annotate - [select for diffs], Sat Jul 20 09:06:46 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Update ldap and sqlite table backends and provide them as external backends.

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

Add a table_proc backend for delegating table lookups to another
process.  Stop building experimental table_sqlite and table_ldap as
they will be provided as external backends.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Jun 3 15:50:04 2013 UTC (11 years ago) by eric
Branch: MAIN
Changes since 1.4: +15 -2 lines
Diff to previous 1.4 (colored)

lowercase the key when adding an entry to a static table, since the
lookups are done on lowercase strings. warn about duplicates entries
and avoid to leak memory.

ok gilles@

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

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.3 / (download) - annotate - [select for diffs], Tue Feb 5 15:23:40 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.2: +11 -0 lines
Diff to previous 1.2 (colored)

unbreak broken smtpctl table update

fix by eric and I, ok eric@

Revision 1.2 / (download) - annotate - [select for diffs], Tue Feb 5 11:45:18 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.1: +6 -2 lines
Diff to previous 1.1 (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.1 / (download) - annotate - [select for diffs], Sat Jan 26 09:37:24 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.