OpenBSD CVS

CVS log for src/usr.sbin/smtpd/Attic/map.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.36, Sat Jan 26 09:42:46 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: HEAD
Changes since 1.35: +1 -1 lines
FILE REMOVED

these are no longer used, maps were replaced with something better

Revision 1.35 / (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.34: +9 -9 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Sun Oct 14 11:58:23 2012 UTC (11 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.33: +72 -12 lines
Diff to previous 1.33 (colored)

introduce map_file.c which will deprecate map_stdio.c

The idea is to have a file-backed map but to have smtpd(8) cache the maps
so that it cannot be partially read if edited while mail is received. The
file is read and converted to a static map (map_static.c), changes aren't
visible to smtpd until an explicit: smtpctl update map  which reads file,
builds a new static map and invalidates the former.

partial-read issue discussed with beck@ and halex@
idea to convert internally to a static map by eric@

diff ok eric@ and chl@

Revision 1.33 / (download) - annotate - [select for diffs], Sat Oct 13 08:01:47 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.32: +15 -4 lines
Diff to previous 1.32 (colored)

Make map_lookup() and make_compare() set errno on failure to distinguish
between "no match" and "internal error" (e.g. missing or broken db file).
Adapt alias expansion and ruleset matching code to check for such errors,
in which case the current processing is aborted, and a temporary failure
is reported to the smtp session.

ok gilles@

Revision 1.32 / (download) - annotate - [select for diffs], Thu Oct 11 21:43:11 2012 UTC (11 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored)

- map_create() takes a map_src not a map_kind

ok eric@ and chl@

Revision 1.31 / (download) - annotate - [select for diffs], Wed Sep 26 12:28:08 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

maps must be numbered from 1 up, as 0 means "no map".

ok gilles@

Revision 1.30 / (download) - annotate - [select for diffs], Fri Sep 21 10:22:29 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

Move ruleset_match() prototype to smtpd.h and make the envelope const.
Adapt a lot of functions in chain to use const args where required.

ok gilles@

Revision 1.29 / (download) - annotate - [select for diffs], Mon Sep 17 20:19:18 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.28: +58 -1 lines
Diff to previous 1.28 (colored)

Add map_create() and map_add() helpers.  Simplify the config parser by a
great deal.

While there, rename the default "localhost" map to "<localhost>" to make
it look more internal, and create a single "<anyhost>" map referenced by
"from all" rules, instead of creating a dynamic one for each of them.

ok gilles@ chl@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Aug 30 18:25:44 2012 UTC (11 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.27: +6 -2 lines
Diff to previous 1.27 (colored)

- import latest aldap.[ch] and ber.[ch] from ypldap
- revive map_ldap.c by updating it to the current API

diff by Mathieu Masson who played puzzle with an oooold changeset of mine,
this import is to let us work on it in tree, it won't work as is.

idea ok eric@ and chl@

Revision 1.27 / (download) - annotate - [select for diffs], Tue May 29 19:53:10 2012 UTC (12 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.26: +8 -3 lines
Diff to previous 1.26 (colored)

- introduce map_static.c as a backend to static maps in parse.y, this has
  the benefit that we no longer have two code paths whenever we deal with
  maps, we can always use the backend mechanism.

I have not plugged this in yet, I'll do it in a later commit, just get it
out of my sandbox

Revision 1.26 / (download) - annotate - [select for diffs], Sun May 13 00:10:49 2012 UTC (12 years ago) by gilles
Branch: MAIN
Changes since 1.25: +27 -1 lines
Diff to previous 1.25 (colored)

- cleanup parse.y by removing lots of code that should not have been there,
  but in ruleset.c and util.c instead.

- introduce the new map_compare() map API call to allow iterating over keys
  and comparing them with provided key using provided function. this allows
  checking a partial key in a key set, very useful for comparing an address
  to a set of netmask.

- introduce new map kind K_NETADDR
- implement K_NETADDR for map_db and map_stdio
- teach ruleset checking how to use the map_compare() with K_NETADDR

we can now do the following:

   map "srcaddr" source plain "/etc/mail/srcaddr.txt"

   accept from map srcaddr for domain "openbsd.org" [...]

Revision 1.25 / (download) - annotate - [select for diffs], Tue Dec 13 22:09:53 2011 UTC (12 years, 5 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.24: +20 -2 lines
Diff to previous 1.24 (colored)

merge map_backend.c into map.c

ok gilles@

Revision 1.24 / (download) - annotate - [select for diffs], Sat May 21 18:43:08 2011 UTC (13 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.23: +2 -15 lines
Diff to previous 1.23 (colored)

until now the map_backend API was not really useful for backends that are
not key/val stores. refactored a bit so that smtpd can really take
advantage of backends. preliminary work for ldap support ;-)

no functionnal change

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

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

discussed with and ok gilles@

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

remove all unused headers

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

a bit of .h cleanups, no functionnal change

Revision 1.20 / (download) - annotate - [select for diffs], Sat Oct 9 22:05:35 2010 UTC (13 years, 8 months ago) by gilles
Branch: MAIN
Changes since 1.19: +12 -12 lines
Diff to previous 1.19 (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.19 / (download) - annotate - [select for diffs], Tue Jun 1 23:06:23 2010 UTC (14 years ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.18: +12 -12 lines
Diff to previous 1.18 (colored)

new queue, again; gcc2 compile tested by deraadt

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

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

Revision 1.17 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.16: +12 -12 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Tue Apr 27 09:49:23 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

initial work at fixing aliases support:
- kill struct alias, struct expandnode is used instead
- introduce map_parse_alias() and map_parse_virtual()
- aliases and virtual code no longer assume db(3) but use the map API which
  lets them become backend agnostic AND value-checked. this actually makes
  the code simpler by removing all values parsing from aliases.c
- rename K_SECRETS -> K_SECRET, K_ALIASES -> K_ALIAS for consistency the
  enum has singular names.
- aliases, virtual and forward now work with an expandtree and deal with
  multiple levels of resolving by merging expandtree's

more coming soon ;)

Revision 1.15 / (download) - annotate - [select for diffs], Wed Apr 21 21:47:38 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

introduce first map parser for maps of kind K_SECRETS !

map_parse_secret() converts a map value into a struct map_secret. lka no
longer needs to do any parsing, it simply calls map_lookup() with kind
K_SECRETS, checks if it returned a !NULL value, and call lka_encode_secret
to safely do the base64 encoding.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Apr 21 21:04:29 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.13: +1 -183 lines
Diff to previous 1.13 (colored)

map.c is growing big, split it into three different files:
map.c contains the map API calls as usable by smtpd processes,
map_backend.c contains backend implementations and map_parser.c contains
parser implementations used internally by the map API

Revision 1.13 / (download) - annotate - [select for diffs], Wed Apr 21 20:10:24 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.12: +33 -17 lines
Diff to previous 1.12 (colored)

change prototypes for map_*_get() functions, we need the get-er function
to fill the size of value for the caller.

have map_lookup() actually lookup the parser in map_parsers table and
call it if it is set, otherwise return raw value which is similar to
current behavior. currently, no map kind has a parser set, so this is
essentially no functionnal change.

fix map_stdio_get(), it was not used yet in -current but i spotted a
bug while enabling it in my sandbox. it returns key and value instead
of key.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Apr 21 19:53:16 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.11: +3 -2 lines
Diff to previous 1.11 (colored)

map_lookup() takes an additionnal parameter of type enum map_kind which
will be used to select the appropriate map parser. make sure every call
to map_lookup() is updated. map_lookup() currently ignores the value.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Apr 21 19:45:07 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.10: +25 -1 lines
Diff to previous 1.10 (colored)

introduce enum map_kind, the map_parsers array and map_parser_lookup()
which will be used to perform stronger checks on map values. they are
unused yet ...

Revision 1.10 / (download) - annotate - [select for diffs], Wed Apr 21 19:37:32 2010 UTC (14 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.9: +20 -10 lines
Diff to previous 1.9 (colored)

simplify map_lookup() by having the backend lookup done in new
map_backend_lookup() function, no functionnal change, first of
many changes to come in map.c

Revision 1.9 / (download) - annotate - [select for diffs], Wed Feb 17 17:37:15 2010 UTC (14 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

in map_stdio_get() use strdup on the right buffer, not on a pointer that
will be NULL 99% of the times... fixes segv in path that's not enabled
yet

Revision 1.8 / (download) - annotate - [select for diffs], Wed Feb 17 13:47:31 2010 UTC (14 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.7: +150 -34 lines
Diff to previous 1.7 (colored)

the map api becomes backend-agnostic with initial support for db(3) and
stdio(3) backends, though for now we only enable db(3). this is the first
commit of a serie to improve maps and everything related.

idea discussed with and diff okay jacekm@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Nov 3 22:57:41 2009 UTC (14 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.6: +17 -5 lines
Diff to previous 1.6 (colored)

teach makemap how to build a set, which is a map containing only keys.
smtpd is now capable of looking primary domains at runtime in a set, which
means that the following becomes possible:

	map "primary" { source db "/etc/mail/primary.db" }
	accept for domain map "primary" deliver to mbox

while at it fix a couple bugs in the aliases resolution path which caused
recipients to bounce if a ruleset did not have an "accept for local" rule

"diff reads good" jacekm@, flush queue & make clean

Revision 1.6 / (download) - annotate - [select for diffs], Wed May 13 21:20:55 2009 UTC (15 years ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.5: +5 -2 lines
Diff to previous 1.5 (colored)

log dbopen and db->get errors; based on diff from Daniel Ouellet.
looks ok to gilles@

Revision 1.5 / (download) - annotate - [select for diffs], Fri Mar 6 23:38:18 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
Changes since 1.4: +46 -1 lines
Diff to previous 1.4 (colored)

introduce map_dblookup() which allows us to query db maps for plain entries
and catch (and warn) about invalid map types.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jan 1 16:15:47 2009 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.3: +1 -10 lines
Diff to previous 1.3 (colored)

remove unnecessary includes; ok gilles@

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

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

ok gilles@

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

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

written with excellent advice from jmc@

ok gilles@

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

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

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

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