summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
AgeCommit message (Collapse)Author
2009-11-11Fix previous. When configured to relay via IP address, MX lookup would failJacek Masiulaniec
(NXDOMAIN), leading to a bounce. Precede the MX lookup with an attempt to parse the relay as numeric string. "reads ok" gilles@
2009-11-11Check if the receive buffer has any unused space before reading from socket inJacek Masiulaniec
buf_read (and in ssl_buf_read).
2009-11-11Fix crlf issue in buf_getln, similar to that in smtp_session.c r1.123.Jacek Masiulaniec
ok gilles@
2009-11-11improve buf_getln readability, no fuctional change.Jacek Masiulaniec
2009-11-11Ensure all replies are at least 4 chars long. If only 3 chars wereJacek Masiulaniec
received, append a space character. This enables other parts of the daemon to safely index into 4th character of the reply buffer without the risk of accessing one byte beyond NUL. ok gilles@
2009-11-11add missing headers needed by time()Charles Longeau
ok jacekm@
2009-11-10Eliminate space after colon in "RCPT TO:" as required by RFC.Jacek Masiulaniec
2009-11-10In absence of the ehlo parameter, generate one based on locallyJacek Masiulaniec
bound IP address ("EHLO [1.2.3.4]") as dictated by RFC. 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-10Check for extension keywords on final multiline reply. Skip theJacek Masiulaniec
check for states other than CLIENT_EHLO. Verify response is not shorter than 3 chars. From Nils Frohberg ok gilles@
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-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-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@
2009-11-09fatal on RB_INSERT failureJacek Masiulaniec
2009-11-08forwards_get() also calls alias_to_expand_node()Gilles Chehade
2009-11-08add an alias_to_expand_node() function and use it in aliases.cGilles Chehade
2009-11-08move expansion code to new expand.c to clearly separate it from aliasesGilles 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-11-05evbuffer_readline() assumes end of line to be \r, \n, \r\n, \n\r or \r\r.Gilles Chehade
smtp protocol expects lines to end with \r\n. if a client sends a very long line which is unfortunately read up to \r, evbuffer_readline() will return the line, then will detect another line when the buffer is filled again and starts with \n, returning again with an empty line. this is a bug which trigger very rarely and usually shows up as an empty line in the middle of headers, causing all subsequent headers to appear as part of the body to most mail user agents. upstream fixes this with evbuffer_readln() in version 2.0 of libevent, a mail will be sent to see if they can backport it, meanwhile we fix it by introducing evbuffer_readln_crlf(). discussed with and ok jacekm@
2009-11-05another log_debug() cleanupGilles Chehade
2009-11-05some structures reference the maps they use by their id, if we allow 0 as aGilles Chehade
valid map id, then we have no way to know for these structures if they have a reference to a map, or if the member was not set. make map id start at 1.
2009-11-05Consider DNS lookups that result in NXDOMAIN to be a permanent failure.Joel Sing
ok gilles@ jacekm@
2009-11-05Include a Date: header in bounce messages.Joel Sing
ok jacekm@ gilles@
2009-11-05cleanup a bit the log_debug outputGilles Chehade
2009-11-05Introduce a 6yz status code, used internally to report permanent errors.Joel Sing
The 1yz and 6yz status codes are now removed prior to reporting the status message in bounce messages, which provides an easy way to distinguish between local and remote status messages. Initial diff from jacekm@ ok gilles@ jacekm@
2009-11-05- introduce lka_session_destroy() which replaces the splay tree removal andGilles Chehade
free(lkasession) in lka_expand_rcpt() - while at it, plug a very very unlikely memory leak which i spotted while reviewing the logic
2009-11-05- move a couple prototypes in smtpd.hGilles Chehade
- remove prototypes from deprecated functions
2009-11-04tweak previous;Jason McIntyre
2009-11-03document the new -t set mode of makemap, and add a paragraph describingGilles Chehade
the use of makemap to generate a primary domains map
2009-11-03teach makemap how to build a set, which is a map containing only keys.Gilles Chehade
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
2009-11-03this commit removes the hardcoded special "aliases" map and brings supportGilles Chehade
for multiple aliases maps that can be attached at the rule level. with it, you can for example define different aliases maps for different domains or different aliases maps for the same domain depending on the client source: map "localiases" { source db "/etc/mail/localiases.db" } map "netaliases" { source db "/etc/mail/netaliases.db" } accept from 192.168.0.0/16 for local alias "localiases" deliver to mbox accept from all for local alias "netaliases" deliver to mbox idea discussed with jacekm@ and various other hackers, diff contains some bug fixes too which were not part of the original diff. man page follows very shortly ... make clean & flush queue !
2009-11-03- remove a useless member of struct condGilles Chehade
- have virtual related functions take a map id instead of a map - shrink a tiny bit ruleset matching - add missing lka_resolve_path() call in aliases resolution leading to issues spotted by nicm@
2009-11-03remove annoying log_debugGilles Chehade
2009-11-03Improve error logging.Jacek Masiulaniec
2009-11-03Don't need regex.h and remove two declarations that are now in smtpd.h.Nicholas Marriott
ok jacekm
2009-11-01fix a couple log_info()s,Gilles Chehade
from Tim van der Molen <tbvdm@xs4all.nl>
2009-10-25fix aliases map name in man pageGilles Chehade
reported by Emmanuel Vadot and David Hill
2009-10-25fix the aliases resolution path so that smtpd does not accidentally skipGilles Chehade
recipients when an alias resolves to more than one. issue spotted by martijn@bunix.org
2009-10-25tag should also be copied from listener to message when the message isGilles Chehade
enqueued through smtpctl
2009-10-25Fix potential null dereference.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok gilles@
2009-10-25smtpctl reload is work in progress, do not expose it and make sure smtpd'sGilles Chehade
control process does not try to handle it. spotted and reported by martijn@bunix.org