summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.c
AgeCommit message (Collapse)Author
2019-03-31Avoid calling dup2(oldd, newd) when oldd == newd. In that case theYASUOKA Masahiko
descriptor keeps CLOEXEC flag then it will be closed unexpectedly by exec(). ok tedu florian
2019-01-30revert previous commit, i wasn't happy with it and it probably came from aGilles Chehade
misunderstanding.
2019-01-30don't be too strict with .forward permissions, it's ok to process it if theGilles Chehade
group has write access, it's not ok if the world has write access. ok eric@
2018-12-23remove dead codeEric Faurot
ok gilles@
2018-12-23revive filters tracing (-T filters) to make it easier understand what isGilles Chehade
happening at filters level
2018-12-13do not use err() on fork_processor() exitGilles Chehade
2018-12-13we don't want to parse a filter command lineGilles Chehade
2018-12-11do some imsg renaming to make them more clearGilles Chehade
2018-12-11remove unused imsg namesGilles Chehade
2018-12-07Refactor certificate initialization and verification.Eric Faurot
Factorize code duplicated in smtp_session.c and mta_session.c Implement a simple callback interface, with proper request management and simplified imsg protocol. Only add the necessary parts for now. Exisiting code path will be adapted later. input from gilles@ sunil@ ok gilles@
2018-12-06bring the first bits of DATA filtering plumbing but bypass it for nowGilles Chehade
ok eric@
2018-11-25flock was needed by delivery_filename which was moved to the standalone MDAGilles Chehade
mail.mboxfile, remove pledge from parent process diff from Edgar Pettijohn III <edgar@pettijohn-web.com>
2018-11-16add missing imsg namesEric Faurot
2018-11-03remove log_debugGilles Chehade
2018-11-01allow smtpd to fork processes at startup and maintain a socketpair withGilles Chehade
them. ok jung@, eric@
2018-09-04upon mda failure, smtpd would assume tempfail and retry. this is at oddsGilles Chehade
with the other MTA which assume a permfail unless the exit status is one of a specific set. make smtpd honour the same exit statuses as postfix. note that all errors that occur before the user mda is executed (fork, pipe and related) are still considered tempfail, only errors coming from the mda itself are handled as permfail. this commit is a temporary solution as i believe the SIGCHLD handler is way more complex than it should be and we'll simplify it after 6.4 is out. ok eric@
2018-07-25Implement a generic interface to forward resolver queries to the lkaEric Faurot
process. Use it for the reverse lookups required by smtp and mta. Until now, DNS-related lookups were implemented using ad-hoc IMSGs between the lka and other processes. It turns out to be confusing and difficult to maintain/extend. So we want to replace this with a better set of IMSGs matching the standard resolver interface. ok gilles@
2018-06-28Don't ignore -n; OK gilles@Tim van der Molen
2018-06-18simplify parse_config() further so it no longer has any side effect outsideGilles Chehade
of parse.y, there's still work to be done but it's now able to run twice if we want (we don't) without failing due to some global side-effect. ok millert@
2018-06-03split forkmda() in two:Gilles Chehade
- forkmda() creates the process that will be used for the delivery and does the switching of privileges then calls mda_unpriv() - mda_unpriv() runs with privileges of the recipient, it expands variables, sets up environment and executes the mda ok millert@ and eric@
2018-05-31remove 'where' parameter from all x*() functions in utils.c, it doesn'tGilles Chehade
really help us with anything, propagate the change in codebase ok millert@
2018-05-29RECIPIENT should really be the dest address, post-expansion, not rcptGilles Chehade
suggested by eric@
2018-05-29provide mail user agents with the same environments as PostfixGilles Chehade
ok millert@, eric@
2018-05-24switch smtpd to new grammarGilles Chehade
ok eric@
2018-05-14kill corrupt / uncorrupt queue mechanism as it has never been usable and itGilles Chehade
will be made irrelevant when the new config comes up soon ok eric@
2018-04-26sync log.h with other daemonsEric Faurot
ok gilles@
2018-01-27Avoid passing NULL to vprintf() by assigning a name to client processes. Whileanton
here rework the switch proc_title(), both clang and gcc will now warn if all possible values are not enumerated. ok gilles@
2017-11-21no need to check the sending process in imsg handlers when there is noEric Faurot
ambiguity: just use a single switch. ok gilles@ sunil@
2017-09-08remove more filter-related cruftEric Faurot
ok gilles@
2017-05-12queue is not owned by _smtpd but _smtpq so a bug in lookup process does notGilles Chehade
allow read/write of envelopes and messages, unfortunately the purge_task() function which is in charge of garbage collecting left-overs from aborted transactions is still executed as _smtpd preventing it from working. issue reported by Philippe Meunier, fix from Edgar Pettijohn
2017-01-09smtpd joins the 7 other daemons that share the same log.c file.Reyk Floeter
The only major difference was the "log_trace" concept that is only used by smtpd - move it from log.c into util.c and make it a local concept. This also needed to rename the global "verbose" variable to "tracing" in a few places. OK krw@ gilles@ eric@
2016-10-19add -F to usage() too;Jason McIntyre
2016-09-08Streamline the daemon shutdown sequence.Eric Faurot
Only the parent process handles SIGTERM and SIGINT. Upon receiving one of those, it closes all imsg sockets and waitpid() for the children. It fatal()s if one of the sockets is closed unexpectedly. Other processes exit() "normally" when one of the imsg sockets is closed. ok gilles@ sunil@
2016-09-06use closefrom() before reexec to make sure the new process only getsEric Faurot
the imsg socket. ok gilles@ sunil@
2016-09-04The smtpd processes are not expected to ever leave their event loop.Eric Faurot
So stop pretending that the *_shutdown() functions could ever be called in this context, and just fatal() if event_dispatch() returns. ok gilles@ sunil@ giovanni@
2016-09-04Remove the "smtpctl stop" command.Eric Faurot
The daemon is stopped with kill(1). ok gilles@
2016-09-01remove noop functionEric Faurot
ok sunil@
2016-09-01get rid of the imsg buffer usage profiling code.Eric Faurot
ok gilles@ jung@ sunil@
2016-08-19make smtpd less verbose at startupEric Faurot
ok gilles@ sunil@ jung@ millert@
2016-06-20with new fork+reexec, in case of failure in init of any child processGilles Chehade
causing it to exit, we could end up with a NULL deref in parent. free commit offered by eric@, ok gilles@
2016-06-07use io_set_nonblocking() instead of SOCK_NONBLOCKING to reduce delta withGilles Chehade
-portable
2016-05-28Implement the fork+exec pattern in smtpd.Eric Faurot
The parent process forks child processes and re-exec each of them with an additional "-x <proc>" argument. During the early setup phase, the parent process sends ipc socket pairs to interconnect the child processes as needed, and it passes the queue encryption key to the queue if necessary. When this is done, all processes have their environment set as in the fork-only case, and they can start doing their work as before. ok gilles@ jung@
2016-04-21Use automatic DH parameters, instead of fixed ones. Also disable DHE byJoel Sing
default since it is computationally expensive and a potential DoS vector. ok gilles@
2016-03-17Last parameter to execl[e]() functions *must* be cast to a pointer.Kenneth R Westerback
Just NULL is not good practise as NULL is theoretically allowed to be an integer rather than a pointer. Use (char *)NULL consistently instead of scattering a few (char *)0 and (void *)NULL into the mix. Prompted by and probably ok deraadt@ millert@ kettenis@ Definitely ok mestre@ ratchov@
2016-02-05use SMTPD_NAME defineJoerg Jung
ok gilles
2016-02-02Remove setproctitle() for the parent process. Because rc.d(8) uses processStuart Henderson
titles (including flags) to distinguish between daemons, this makes it possible to manage multiple copies of a daemon using the normal infrastructure by symlinking rc.d scripts to a new name. ok jung@ ajacoutot@, smtpd ok gilles@
2016-01-27Check imsg data length before use.Sunil Nimmagadda
Ok jung@ gilles@ eric@
2016-01-18Load pki keys before daemon(3). Keys with passphrase require accessSunil Nimmagadda
to stdin. Ok millert@ jung@ gilles@
2016-01-04switch to /usr/local/libexec when looking for -extras and drop loop iteratingJoerg Jung
paths this effectively reverts table.c r1.21 which was mainly introduced for a smooth transition in -current ok gilles
2015-12-28remove spaces after '!'Joerg Jung
no binary change ok millert