summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.h
AgeCommit message (Collapse)Author
2009-05-20first step towards configuration reload in smtpd, smtpctl reload will parseGilles Chehade
the configuration file again and replace current configuration with new one in all processes. what we don't support yet is graceful restart, clients in sessions at the moment of the reload will have a temp failure thrown at 'em which is ok RFC-wise but which we will try to improve anyway. tested with various setups, "diff reads good" jacekm@
2009-05-19- Don't advertise nor accept STARTTLS command when session is secure.Jacek Masiulaniec
- Make the condition when STARTTLS and AUTH are advertised & accepted more readable. ok gilles@
2009-05-19Do not ever run /usr/sbin/sendmail, it could link to sendmailJacek Masiulaniec
interface for a different MTA. Use the binary in /usr/libexec directly instead. Based on remark claudio@ made in passing. ok gilles@
2009-05-19Verify the amount of IMSG payload is exactly as expected; ok gilles@Jacek Masiulaniec
2009-05-18Complete rework of bufferevent event masking allowing for moreJacek Masiulaniec
strictness: - Drop clients attempting command pipelining; protects the daemon from all kinds of abuse. - Replace F_EVLOCKED flag with F_WRITEONLY which has cleaner sematics: when up, session must not be destroyed nor read from, but may be written to. - Write callback becomes a central place for enabling EV_READ. - Delay bufferevent creation until after ssl handshake is completed. A bunch of session error stats were added to smtpctl's "show stats". These could help spotting event masking errors in the future. ok gilles@
2009-05-09give few states more meaningful names; ok gilles@Jacek Masiulaniec
2009-05-09- New API to handle all DNS query types (A, MX, PTR) asynchronously.Jacek Masiulaniec
- Improve RFC compliance: CNAMEs are resolved, equal preference MXs are randomized, relaying via MX that has equal/lower preference than local server is prevented, decision on when to treat domain name as implicit MX is better. ok gilles@
2009-04-28smtp auth happened to work by luck because delivery to mbox action was theGilles Chehade
first action of an enum and we allocated a struct using calloc, but we did not properly initialize the action for authenticated users. while at it, change the name of path action flags so that we know at first sight that they are path related. this diff fixes the immediate issue but still needs work. ok jacekm@, "we'll work out a long term solution"
2009-04-24Make aliases case-insensitive, issue reported by Daniel Ouelett; ok gilles@Jacek Masiulaniec
2009-04-24use same timeout at each session state, and make use ofJacek Masiulaniec
bufferevent_settimeout instead of rolling our own; ok gilles@
2009-04-24kill unnecessary struct message_recipient; ok gilles@Jacek Masiulaniec
2009-04-21Make /usr/sbin/sendmail not fail due to smtpd being down.Jacek Masiulaniec
The approach is to save cmdline + stdin in a file under a newly added directory /var/spool/smtpd/offline (uid 0 gid 0 mode 1777). Next time daemon starts, it uses information in that directory to replay sendmail on user's behalf. ok gilles@
2009-04-20Rewrite smtp session timeouts; use evtimer_* from event(3) insteadJacek Masiulaniec
of regularly walking session tree in search of idle clients. Gives the smtp process a chance to become idle. As a bonus, add smtp.sessions.timeout counter to "smtpctl show stats". ok gilles@
2009-04-16Total rewrite of the sendmail interface. Adds support for -t, -v,Jacek Masiulaniec
and -F cmdline args. Also, date and Message-Id headers are added when missing. The main trouble with the current enqueue code is that it requires dealing with problems in the control process that are already solved in the smtp process, ie. duplicating a lot of code which interacts with untrusted clients. This diff solves this by making sendmail obtain a SMTP socket from smtp via smtpd.sock, and using that socket to deliver the message. For smtpd it looks as if connection was made from the network, only difference being the F_MESSAGE_ENQUEUED message flag, handy when differentation between local and remote deliveries is wanted. Most of the features come from the femail program, created by henning@. Additional testing by Nigel J. Taylor. ok gilles@, henning@ happy with smtpd using femail code
2009-04-15s/ssmtp/smtps/; ok gilles@Jacek Masiulaniec
2009-04-09change syntax of the "listen on" and "relay via" directives:Jacek Masiulaniec
1) kill the ssmtp keyword in "ssmtp listen on ..."; 2) kill the use keyword in "... use certificate foo"; 3) tls no longer implicit, user must explicitely use the tls or smtps option. 4) for "relay via", move the tls/smtps options to right after the port specification; makes it similar to "listen on". These directives: ssmtp listen on fxp0 use ceritifate "foo" accept for all relay via tls "mx.bar.com" now become: listen on fxp0 smtps certificate "foo" accept for all relay via "mx.bar.com" tls ok gilles@
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-19make action_type == 0 mean A_INVALID, not A_RELAY; ok gilles@Jacek Masiulaniec
2009-03-15since we are going to share code in smtp sessions and mta sessions, we needGilles Chehade
to also share the statistics structure, still being worked on
2009-03-15the mda process no longer uses struct batch as its central structure toGilles Chehade
deal with deliveries, it now uses struct session just like mta and smtp processes. we now keep the mbox and message descriptors in the session, saving space in struct message which is now as small as we can make it. While at it, plugged a memory leak and did some cosmethic changes This was the last planned change to our struct message which means that later changes will no longer require a queue flush before rebuild.
2009-03-15save 4 bytes per message by moving the datafp field of struct message toGilles Chehade
struct session where it really belongs.
2009-03-12Add new function time_to_text to correctly display the date.pea
Use it to display the date in received from header and when we store headers. ok jacekm@
2009-03-10implement basic logging, needs more work; ok gilles@Jacek Masiulaniec
2009-03-09run external mda directly, not via sh -c; this steals addargs() APIJacek Masiulaniec
from OpenSSH; ok gilles@
2009-03-09Drop ALIAS_TEXT, plain maps got implemented in a different way; ok gilles@Jacek Masiulaniec
2009-03-09add basic support for outgoing authentication (AUTH PLAIN over ssl) whichGilles Chehade
can be turned on by adding "enable auth" to a "relay via" rule. this made me rework the mx resolution so that it is done by the mta process and not the runner process anymore.
2009-03-08when operating in enqueue mode, it was easy to make smtpctl fatal() byGilles Chehade
writing a small app that sent out of order imsg's. prevent this by use of a state machine and read event masking. issue spotted by jacekm@, temporary fix by me. there are ideas around this, but we want to experiment them a bit and they are low priority.
2009-03-08shrink struct message a bit by removing a couple fields which are no longerGilles Chehade
used and by moving the rcpt count in struct session where it really belongs while at it, remove some unused splay tree generation in mfa
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-06missing prototypeGilles Chehade
2009-03-03when forwards/aliases expansion fails in an lka session, make sure that mfaGilles Chehade
is notified so that the session does not hang
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-01In "smtpctl show stats", break queue.inserts into queue.inserts.remoteJacek Masiulaniec
and queue.inserts.local; ok gilles@
2009-02-24teach smtpctl's parser how to deal with parameters that are not necessarilyGilles Chehade
a token so that it is possible to do: smtpctl schedule <message id/uid> introduce F_MESSAGE_FORCESCHEDULE which lets the runner schedule a message even if the retry delay has not been expired. F_MESSAGE_ENQUEUED is a valid flag for a message and should not cause an\ errx() in smtpctl show queue
2009-02-23add valid_message_id() and valid_message_uid() which test that a message idGilles Chehade
and uid do not look wrong. this was not needed earlier because we only deal with message id's coming from trusted sources, but smtpctl will soon have a new feature which requires us to deal with user provided message id's.
2009-02-22put repeated inet_ntop calls into new func ss_to_text, which usesJacek Masiulaniec
getnameinfo internally; ok gilles@
2009-02-19don't let libevent buffer long lines forever; ok gilles@Jacek Masiulaniec
2009-02-18- add basic syntax checking to mfaJacek Masiulaniec
- decline source routing at MAIL FROM, strip at RCPT TO ok gilles@
2009-02-17make newaliases read aliases path from smtpd.conf; idea discussed withJacek Masiulaniec
gilles@, pyr@ and henning@, diff ok gilles@.
2009-02-15If MX query fails due to DNS error, do not attempt more queries; ok gilles@Jacek Masiulaniec
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-02-14Implement makemap -t and -o, for output type and dest resp.; ok gilles@Jacek Masiulaniec
2009-01-30when decreasing ssl related counters, make sure the session was flagged asGilles Chehade
F_SECURE. while at it, add "smtp.sessions.aborted" which keeps track of sessions which were interrupted before completion.
2009-01-30improve statistics for smtp process. not only collect the current sessionsGilles Chehade
count, but also the total sessions count, ssmtp sessions (both current and total) and starttls sessions (both current and total) # ./smtpctl/smtpctl show stats|grep smtp.sessions smtp.sessions = 0 smtp.sessions.active = 0 smtp.sessions.ssmtp = 0 smtp.sessions.ssmtp.active = 0 smtp.sessions.starttls = 0 smtp.sessions.starttls.active = 0 #
2009-01-30clear the F_EVLOCK flag earlier to prevent the error event handler fromGilles Chehade
being called again with F_EVLOCK set. this fixes a bug where disconnect after smtpd sends greeting and before entering any command failed to go into session_destroy(). while at it, rename the "smtp.clients" statistic to "smtp.sessions" and add counters to struct s_smtp so that I can add ssmtp and starttls with my next commit ;)
2009-01-30Do not break header for messages received via smtp.Oleg Safiullin
look 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 a very annoying events masking issue which would cause a fatal() to beGilles Chehade
hit under certain conditions; while tracking the bug I ran into other bugs which were kind of related and could cause us to hit a fatal() too. fix by me, but with lots of testing and investigation with jacekm@, ok jacekm@