summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.c
AgeCommit message (Collapse)Author
2009-03-29turn some log_debugs into log_warns or even fatals; "looks ok" gilles@Jacek Masiulaniec
2009-03-22fix a bug in the resolution of forward files which would cause usernamesGilles Chehade
not to be taken into account if they had no ~/.forward file AND were the result of an alias expansion that expanded to more than one username. while at it, I spotted another bug where I would check T_MDA_MESSAGE on the flags field instead of the type field. the bug could cause two MDA message to end up in the same batch which is no longer valid.
2009-03-10when calling external mda, use restricted environment; ok gilles@Jacek Masiulaniec
2009-03-10run external mda with cwd set to $HOME or /; ok gilles@Jacek Masiulaniec
2009-03-10kill few lines, saving one seteuid(2) call; ok gilles@Jacek Masiulaniec
2009-03-10- Use setsid(2) to create new process group for external mda.Jacek Masiulaniec
- Unignore SIGPIPE, otherwise it remains ignored in forked mda. - Use closefrom(2) to close all descriptors apart from stdin/stdout/stderr. ok gilles@
2009-03-10it's simpler to use pipe(2) than socketpair(2) to communicate withJacek Masiulaniec
external mda; ok gilles@
2009-03-10fork(2) or socketpair(2) failures are temporary, delivery attempt should beJacek Masiulaniec
retried later; ok gilles@
2009-03-09run external mda directly, not via sh -c; this steals addargs() APIJacek Masiulaniec
from OpenSSH; ok gilles@
2009-03-08~/.forward files handling was fixed recently so that it is the privilegedGilles Chehade
process that does the opening, this commit does some cleanup, and fixes a bug I experienced today which was caused by a use-after-free. I did some testing to make sure a user cannot cause smtpd to deadlock, or loop, with broken setups (self-referencing forwards/aliases, empty files, broken files...), but if you are playing with aliases/forwards PLEASE let me know of any bug you run into.
2009-03-04plug a memory leak, remove lka session from the the lka session tree whenGilles Chehade
we are done expanding aliases/forwards, and cleanup a bit the expansion code so that I can soon remove some of the duplication.
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-03-03fix mbox locking by having it done by mail.local(8) which in turns usesGilles Chehade
lockspool(1). this means our mbox delivery follows a code path that has become almost identical to external mda deliveries. this is the first of a serie of diffs actually... lockspool(1) suggestion by deraadt@, mail.local(8) idea by jacekm@, and fix and testing by me
2009-03-01- Refuse delivery to mbox that is a symlink, pipe, chardev, etc. etc.Jacek Masiulaniec
- Introduce secure_file, based on secure_filename from OpenSSH, it checks that mbox has right perms, and that path components are trustworthy, too. ok gilles@
2009-03-01open mbox with O_EXLOCK (better than open+flock), and without O_SYNC,Jacek Masiulaniec
since fsync is done in final safe_fclose; ok gilles@
2009-03-01fix possible NULL dereference when getpwnam fails; ok gilles@Jacek Masiulaniec
2009-03-01make the condition under which delivery is made by SMTPD_USER moreJacek Masiulaniec
explicit; ok gilles@
2009-03-01simplify *_open functions by passing them char * instead of structJacek Masiulaniec
path *; ok gilles@
2009-02-25remove chown's called when running with user privs, ie. basically noops;Jacek Masiulaniec
ok gilles@
2009-02-23add missing headers needed by time()Charles Longeau
ok jacekm@ gilles@
2009-02-22replace MAX* constants by sizeof where possibleOleg Safiullin
ok jacekm@
2009-02-15New config.c that allows for process cloning. Done by pyr@ forJacek Masiulaniec
relayd at n2k9, and adapted to smtpd; ok gilles@
2009-01-30bump descriptors limit to the max and set the maximum connections count toGilles Chehade
three quarters of that limit (a session typically has 3 descriptors). when we hit that limit, we stop accepting connections, and when client closes a session, we start accepting connections again. this prevents us from going into a session that is likely to fail because of scarce resources. idea discussed with jacekm@, code mostly ripped from relayd
2009-01-30fix debug messageOleg Safiullin
ok gilles@
2009-01-29Implement "smtpctl show stats"; ok gilles@Jacek Masiulaniec
2009-01-28when pausing listeners, do not simply disable their events as newGilles Chehade
clients would still be able to connect. instead, at pause time we close and remove the listeners, and at resume time we request the parent to reconfigure all listeners. discussed with pyr@
2009-01-27temporarily drop privileges to the final user before each delivery attempt,Gilles Chehade
wether it is maildir, mbox or external mda. rearrange a bit of code to also simplify most delivery methods by moving their common code to common place. while at it change some mode_t to int where it was wrongly used and unlink temporary maildir file if we fail to deliver for some reason. discussed with and ok jacek@
2009-01-21temporary quick fix to an issue that needs more thinking; ok gilles@Jacek Masiulaniec
2009-01-10- remove a comment that was no longer relevantGilles Chehade
- when authenticating user, instead of doing a getpwnam() and checking the passwd field, issue a call to auth_userokay(), this will allow the use of login scripts to implement custom authentications without bloating smtpd.
2009-01-08ensure getpwnam is always followed by endpwent; ok gilles@ henning@Jacek Masiulaniec
2009-01-01remove unnecessary includes; ok gilles@Jacek Masiulaniec
2008-12-27Merge hash() and queue_message_hash() into one func, queue_hash(). Fix callersJacek Masiulaniec
to use this interface consistently; ok chl@ gilles@
2008-12-22Remove entry from mdaproctree after reaping mda child; ok gilles@Jacek Masiulaniec
From: Nicholas Marriott <nicholas.marriott@gmail.com>
2008-12-21- AUTH PLAIN may receive credentials as a parameter to AUTH or on aGilles Chehade
following line, this commit brings support for the latter which was not supported yet. - AUTH LOGIN is now supported, allowing smtp auth support on clients that do not support AUTH PLAIN (ie: my mobile phone for instance ;)
2008-12-19- fatal() if flock() has failed for any reason that's not EWOULDBLOCK, thisGilles Chehade
is not supposed to happen but better safe than sorry. suggested by jacekm@ - while at it, remove the locking of delivery file we create when doing a Maildir delivery. the purpose of Maildir is to prevent the need for locking in the first place ... I must have been tired that day.
2008-12-19- smtpd handled mbox locking failures as "regular" temporary failures whichGilles Chehade
is not good at all. As a result, under heavy load messages would be kept in queue, and delayed for hours just because we failed locking a few times. This commit makes smtpd distinguish between lock fails and "regular" temporary fails. - delivery scheduler will reschedule immediately a message that couldn't be delivered because of a lock fail. If we fail to lock too many times we fallback to previous "delay increase" logic. "looks sane" jacekm@
2008-12-17Introduce /purge, where all msgs scheduled for deletion are put byJacek Masiulaniec
queue, and removed from disk by runner. On startup, clean /incoming by moving msgs within it to /purge. ok gilles@
2008-12-11- snprintf -> bsnprintfGilles Chehade
2008-12-05- last part of the new queue code: the runner process (unprivileged andGilles Chehade
chrooted) is now in charge of doing the scheduling of deliveries, and the dispatching of messages to MDA and MTA. queue process only does inserts/updates/removals from the queue and can no longer be so busy that it delays answers to imsg from smtp server.
2008-12-03- fix event masking issues in smtp process which could lead to a fatal() ifGilles Chehade
queue process did not answer fast enough to an imsg. spotted by Jacek Masiulaniec <jacekm@dobremiasto.net> - queue layout was mostly to bootstrap the project, it does not behave good under load, it does complex things to stay in a recoverable state and it probably didnt do it too well. New queue code is simpler, smaller and allows for atomic submissions (a mail can never be in a state where it needs to be recovered). It still needs some work but works better than previous code, no regression.
2008-11-22- do not set nochdir in daemon() call, we want parent and lka to have theirGilles Chehade
wd reset to / rather than current working directory. From Jacek Masiulaniec <jacekm@dobremiasto.net>
2008-11-17- replace uses of O_EXLOCK and O_EXLOCK|O_NONBLOCK with the correspondingGilles Chehade
open()/flock() constructs as chl@ says it prevents him from doing a portable build. discussed with chl@, diff is common work from him and myself
2008-11-17- exit() -> _exit()Gilles Chehade
- err() -> fatal() Both by Jacek Masiulaniec <jacekm@dobremiasto.net>
2008-11-11- temporarily comment chl@'s O_EXLOCK -> fcntl() change until we understandGilles Chehade
what causes the mailbox lock bug i'm observing under heavy load.
2008-11-11remove the use of O_EXLOCK, when open()ing a file, and use flock() instead.Charles Longeau
ok gilles@
2008-11-10spaces fixed while reading codeTheo de Raadt
2008-11-10- simplify the passing of ssl cert/key during ssl configuration,Gilles Chehade
from Jacek Masiulaniec <jacekm@dobremiasto.net>
2008-11-10- snprintf() can return -1, make sure every call is checked properlyGilles Chehade
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-02various minor tweaks, including spelling fixes from Brian KeeferJason McIntyre
and Jim Razmus;