summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/lka.c
AgeCommit message (Collapse)Author
2012-05-12- 'secret' -> 'credentials' in some logsGilles Chehade
- log_warn() admin that a map that's needed by an envelope is no longer in the configuration file
2012-05-12- rename all occurences of K_SECRET to K_CREDENTIALSGilles Chehade
- rename all occurences of struct map_secret to map_credentials - do not fatal if the credentials map has disappeared, instead make the auth fail with a lookup failure. the mail will be temporary failed so it stays in queue until admin fixes smtpd.conf, removes mail, or lets it expires
2011-11-14when receiving an unexpected imsg, print its name.Charles Longeau
with help and ideas from eric@ ok eric@ gilles@
2011-10-23a few important fixes:Eric Faurot
- use correct endianness when dumping/loading port - use the right flag set when dumping/loading flags - keep and use the authmap name when needed, rather than an id that might change when smtpd is restarted - dump/load the authmap name with the envelope - remove the rule struct from rq_batch as only the relay info is useful ok gilles@
2011-10-23fsqueue no longer stores envelopes by dumping the structure, instead use aGilles Chehade
couple of load/dump functions to convert to and from a human readable fmt. while at it kill struct delivery and merge back its fields to the envelope. this basically means we shouldn't require users to flush their queues every time we make a change to struct envelope. work is not done, but we're at a better state than the binary fsqueue so we'll improve it in-tree. has been running on my own box for the last 12 hours or so ok eric@, chl@
2011-10-09show messages sent between processes in debug modeEric Faurot
ok gilles@ chl@
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.
2011-05-01the smtpd env is meant to be global, so do not pass it all around.Eric Faurot
discussed with and ok gilles@
2011-04-17cleanups, cosmethic changes, functions that should be static are now staticGilles Chehade
no functionnal change
2011-04-17a structure describing an envelope should be called struct envelope, notGilles Chehade
struct message ...
2010-11-29replace the fork-based-non-blocking-resolver-hack by shiny async resolverGilles Chehade
written by eric@. it is still experimental but still better than what we had earlier so ... we'll improve in tree :) diff by me with *lots* of help from eric@, tested by todd and I (and a few people out there)
2010-11-28remove all unused headersGilles Chehade
2010-11-28a bit of .h cleanups, no functionnal changeGilles Chehade
2010-10-29smtpd no longer knows a map called "secrets" which holds credentials forGilles Chehade
authenticated relaying. one can create many maps holding credentials and name them however he/she wants, just like any other map. teach smtpd how to select a credentials map at the rule-level allowing a setup to relay through the same MX with different credentials depending on the source. smtpd.conf.5 updated to reflect changes with help from jmc@
2010-10-09backout the "new" queue code commited 4 months ago. it has many good ideas,Gilles Chehade
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.
2010-09-20- fix a regression caused by latest commit (long story made short: do notGilles Chehade
attempt to expand the local delivery buffer when relaying mail, it was kind of ok before but no longer is) - use the same buffer for local deliveries to files and commands tested by jmc@ and I
2010-09-12oga@ spotted a bug in lka_expand() which caused it to miscalculate theGilles Chehade
length of its expand buffer. this commit introduces a new lka_expand() that has been simplified, that fixes the bug and that is more robust. callers of lka_expand() can now determine that it has failed and throw the recipient at session time. lka_expand() rewrite by oga@, changes around it by me, tested on a few different setups but no feedback from tech@ so ... let me know if it's breaking something for you
2010-09-08add support for sender expansion in smtpd.conf:Gilles Chehade
%U for sender localpart %D for sender domainpart diff sent to tech@ by Gregory Edigarov <greg@bestnet.kharkov.ua>, timeout by jacekm@, ok by me
2010-06-04Use correct imsg type in error reply.Jacek Masiulaniec
2010-06-02check event_dispatch() return valueCharles Longeau
ok jacekm@
2010-06-01new queue, again; gcc2 compile tested by deraadtJacek Masiulaniec
2010-06-01New queue doesn't compile on gcc2, back out. Spotted by deraadt@Jacek Masiulaniec
2010-06-01Don't interpret garbage on stack; problem seemingly exposed by myJacek Masiulaniec
queue rewrite. Proper fix after gilles wakes up.
2010-06-01Fix one case of not sending smtp session id on error.Jacek Masiulaniec
2010-05-31Rewrite entire queue code.Jacek Masiulaniec
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.
2010-05-27when a rule has two conditions (ie: accept for { domain foo, domain bar } )Gilles Chehade
expand to two rules each having its own condition rather than one rule with a tail queue of conditions. this simplifies code a bit and removes a couple hacks. basic testing by oga and me
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 ;)
2010-04-21introduce first map parser for maps of kind K_SECRETS !Gilles Chehade
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.
2010-04-21map_lookup() takes an additionnal parameter of type enum map_kind whichGilles Chehade
will be used to select the appropriate map parser. make sure every call to map_lookup() is updated. map_lookup() currently ignores the value.
2010-04-21Runner process is just a helper for queue, so tear down its imsgJacek Masiulaniec
channels to parent, mda, mta, lka, smtp, and control. This leaves just the channel to queue, which forwards imsgs on runner's behalf and redirects any replies back to it. OK gilles@
2010-04-21Remove unusable ifdef DEBUG code.Jacek Masiulaniec
2010-04-20Kill *2400* lines of code by abstracting common bits of the imsg handlers.Jacek Masiulaniec
2010-02-17erf, previous fix to lka crash was still using the wrong define ...Gilles Chehade
2010-02-17the map api becomes backend-agnostic with initial support for db(3) andGilles Chehade
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@
2010-02-17localpart of a struct path may legally exceed MAXLOGNAME, causing lka toGilles Chehade
fatalx() on a lowercase() call in some cases. make sure lka uses a buffer capable of holding a localpart, and do not attempt getpwnam() if we know it's going to fail anyway... issue reported by Ben Lindstrom <mouring@eviladmin.org>
2010-01-03Implement "log verbose" and "log brief" to enable or disable verbose debugCharles Longeau
logging on runtime. Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd. With help/ideas/testing from gilles@ jacekm@ todd@ ok jacekm@
2009-12-15Must aim better.Jacek Masiulaniec
2009-12-14Tweak the logic behind setting the fd limits so that smtpd is less likelyJacek Masiulaniec
to get upset by custom soft/hard ulimit settings. Suggested by todd@
2009-12-13Use safe fd limits in smtp, lka, queue, and control. Removes aJacek Masiulaniec
possibility for fd-starvation fatal when under heavy load.
2009-11-13Log FQDN and IP of the server we handed mail to. As a bonus, don't delayJacek Masiulaniec
logging of successful deliveries until all MXs were tried, plus add logging of 5yz replies. tested by todd@, "reads ok" gilles@
2009-11-10In relay case, avoid freeing garbage pointer by copying the required structJacek Masiulaniec
from the temporary imsg buffer. ok gilles@
2009-11-10move format expansion to the right place, from gilles@Jacek Masiulaniec
2009-11-10sync code with comment, from gilles@Jacek Masiulaniec
2009-11-10- add comments to explain the logic in the aliases expansion loopGilles Chehade
- more cosmethic changes to help readability - fix memory leaks - if deliverylist is empty, it means something went bad during expansion, reject recipient
2009-11-10pfff remove a comment i pasted to help me refactor code ;-)Gilles Chehade
2009-11-10more cleanup, let lka_resolve_path() request forward files and populateGilles Chehade
expandtree, this makes a lot of code clearer and removes quite a bit of complexity from various places.
2009-11-10cosmethic changes, code reordering, no functionnal changeGilles Chehade
2009-11-10introduce lka_session_fail() which factors a small piece of code used inGilles Chehade
three places: set code to 530, send imsg to notify rejection, kill lkasession
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-09support the userpart+foobar@domainpart syntax which got wiped when i wroteGilles Chehade
the virtual domains support as it was in my way. this time, make it work as it should: userpart+foobar@domainpart becomes: path->user = userpart+foobar path->domain = domainpart path->pw_name = userpart discussed quickly with jacekm@