summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.c
AgeCommit message (Collapse)Author
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
2015-12-20remove redundant logGilles Chehade
2015-12-14remove trailing whitespaceJoerg Jung
ok sunil gilles
2015-12-12remove CA from pki and no longer allow specifying a CA with 'pki' keyword.Gilles Chehade
introduce 'ca' keyword to allow specifying a custom CA. making CA part of pki was a bad idea and several people hit use-cases that plain couldn't work. instead of: pki foobar.org ca "/etc/mail/CA.pem" use now: ca foobar.org certificate "/etc/mail/CA.pem" ok sunil@, jung@
2015-12-12Implement senders map.Sunil Nimmagadda
senders table allows to restrict the addresses that an authenticated user can use in the SMTP dialogue. Ok gilles@
2015-12-12prepare load_pki_tree() for pki/ca splitGilles Chehade
2015-12-12In the configuration test mode (smtpd -n) setup queue crypto iff aSunil Nimmagadda
valid queue key is specified. Ok gilles@ jung@
2015-12-11New '-F' option to let smtpd run in foreground while logging toSunil Nimmagadda
syslog. Ok gilles@ jung@
2015-12-10free sc_queue_key only when it points to something other than "stdin"Sunil Nimmagadda
string literal. Ok gilles@
2015-12-10Do not fatal when a log_warn suffices.Sunil Nimmagadda
Ok jung@ gilles@
2015-12-08Let smtpd shutdown gracefully with a zero exit code when the privSunil Nimmagadda
process receives a SIGINT/SIGTERM. Initial diff by nfnty <git@nfnty.se> Ok gilles@ jung@ millert@
2015-12-05Remove a few NULL-checks before free().mmcc
2015-12-01whitespaceGilles Chehade
2015-11-30when looking up tables, start in /usr/local/libexec before /usr/libexec, soGilles Chehade
ports/packages can be installed in the proper place ok jung@
2015-11-30mechanical rename of some IMSG constantsGilles Chehade
ok sunil@, ok jung@
2015-11-05Implement smtpctl uncorrupt <msgid>Sunil Nimmagadda
"uncorrupt" moves envelopes from corrupt bucket back to the queue for further discovery by the daemon. After correcting the corrupt envelopes, admin could now... # smtpctl uncorrupt msgid # smtpctl discover msgid to schedule the messages. Ok gilles@
2015-10-29Implement smtpctl discover <evpid|msgid>.Sunil Nimmagadda
discover subcommand schedules envelopes manually moved to the queue. It triggers a queue walk searching for envelopes with the given id, schedules them and informs the user number of envelopes scheduled. Admins no longer would need to restart the daemon to discover manually moved messages. Ok gilles@