summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/forward.c
AgeCommit message (Collapse)Author
2011-05-16murder struct path and make sure smtpd uses simpler structures that do notGilles Chehade
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.
2010-11-28remove all unused headersGilles Chehade
2010-11-28a bit of .h cleanups, no functionnal changeGilles Chehade
2010-04-27initial work at fixing aliases support:Gilles Chehade
- 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 ;)
2009-11-09now that we don't keep an expand_node in memory for each expansion result,Gilles Chehade
we don't need to calloc them as they won't be saved in the tree.
2009-11-09- add a reference count and flags to struct expand_nodeGilles Chehade
- during expansion, no longer create a new node for each result but try to lookup for an existing equivalent node and increment its reference count so that: a) we save on memory, b) we don't need to expand the same users again and again just because they keep appearing in expansion results. - while expanding, flag nodes as F_EXPAND_DONE so that we know which nodes we already processed - be smarter when expanding, if we have a clue that an iteration has not brought any new result (because no new nodes were added and all existing nodes have F_EXPAND_DONE), end expansion and proceed to delivery. - various small cleanups discussed with jacekm@ yesterday, rebuild aliases db, make clean
2009-11-08forwards_get() also calls alias_to_expand_node()Gilles Chehade
2009-11-08rework a bit expansion and data structures involved in the expansion so weGilles Chehade
no longer have a direct mapping between structures saved in aliases/virtual db and structures used at runtime during expansion. side effects ? struct alias is smaller, databases are smaller and it is no longer necessary to rebuild aliases/virtual databases each time jacekm@ or I make changes to some obscure structure used indirectely during expansion rebuild databases, flush queues, make clean
2009-11-08- make aliases expansion use a rb tree instead of a tail queue, the codeGilles Chehade
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
2009-11-08first commit of a serie to cleanup, simplify and improve aliases resolutionGilles Chehade
which is probably the most complex code in smtpd right now. no longer use a single list to hold aliases to be resolved and resolved aliases, and do not use struct alias to hold resolved aliases. instead use a delivery list that is a list of struct path, and populate it with resolved aliases. idea discussed with jacekm@, this needs some testing to make sure it does not introduce a regression with aliases. flush your queue and make clean.
2009-08-08import some changes from portable smtpd to reduce the delta between both.Gilles Chehade
this commit contains mostly missing casts and cosmethic changes, do not expect to build this anywhere but on OpenBSD, it does not contain any of the portable glue.
2009-03-03Fix a long standing issue where ~/.forward files were opened by user _smtpdGilles Chehade
causing them not to be handled when a user's homedir is set to mode 0700. I still need to do some cleanup and make sure it works as it should, but this diff provides better behavior than what we had.
2009-02-22replace MAX* constants by sizeof where possibleOleg Safiullin
ok jacekm@
2009-01-29better parsing of .forward filesOleg Safiullin
ok gilles@
2009-01-08ensure getpwnam is always followed by endpwent; ok gilles@ henning@Jacek Masiulaniec
2009-01-07- when performing aliases expansion, do not forget to set an action to eachGilles Chehade
expanded envelope, orelse they will use the default action and be passed to MTA no matter if recipient is local or not. bug reported by Nicholas Marriott <nicholas.marriott@gmail.com>, fixed by me and okayd by jacekm@, collaborative work ;-)
2009-01-04aliases/forwards expansion was not done correctly and a race couldGilles Chehade
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.
2009-01-01remove unnecessary includes; ok gilles@Jacek Masiulaniec
2008-12-13Declare alias_parse in smtpd.h, and fix callers that pass it wrongJacek Masiulaniec
number of arguments. ok gilles@
2008-12-06Don't include <err.h> where log.c API must be used.Jacek Masiulaniec
ok gilles@
2008-11-25- more prototype moving to smtpd.hGilles Chehade
2008-11-17- err() -> fatal()Gilles Chehade
- printf() -> log_debug() - be more verbose in debug mode
2008-11-05add a few missing id tags; there are a bunch of files, and developersIgor Sobrado
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@
2008-11-01smtpd is a smtp server implementation for OpenBSD. It is a work in progressGilles Chehade
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@