summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
AgeCommit message (Collapse)Author
2010-01-11Fix wrong logic in error checking of buf_dynamic, found by pcc.Jacek Masiulaniec
2010-01-10- teach runner how to remove a message from queue given a message id/uidGilles Chehade
and assuming message is not in processing/scheduled state - teach smtpctl how to request message removal from runner discussed with todd@, idea ok jacekm@
2010-01-10have smtpd errx() at startup if no hostname could be detected either fromGilles Chehade
a gethostname() call or from a hostname directive in smtpd.conf discussed with jacekm@, i initially intended to only warn but errx seems to be a better solution for now
2010-01-03Implement "log verbose" and "log brief" to enable or disable verbose debugCharles Longeau
logging on runtime. Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd. With help/ideas/testing from gilles@ jacekm@ todd@ ok jacekm@
2010-01-02Replace 3 struct smtp_client members (ssl_handshake, rcptokay, dying) with aJacek Masiulaniec
bitmap called "flags".
2010-01-02Factor out parts of client_read() into client_socket_read() andJacek Masiulaniec
client_get_reply(), downsizing it from 170+ to just over 30 lines. The gotos are now gone, too.
2010-01-02Simplify code by removing struct smtp_client member, int iomode, which wasJacek Masiulaniec
used for keeping track of the current polling mode. Introduce new function client_poll() that determines what mode of polling is required at the time of call.
2009-12-31when separating command from parameters in smtp session, the parser triesGilles Chehade
to use ':' as a separator then fallbacks to ' ' so that it can detect the command names that contain more than one words (MAIL FROM and RCPT TO) or the one word ones (HELO, DATA, ...). this is incorrect and the parser can get confused if the parameter to any command contains a ':', for example "HELO [ipv6:...]" cause the parser to lookup for command "HELO [ipv6". fix this by using ':' as a delimiter for 'mail from' and 'rcpt to', while using ' ' as a delimiter for all other commands. fixes bug 6285/system reported by Lionel Le Folgoc <lionel@lefolgoc.net>
2009-12-24kill PATH_RUNQUEUEHIGH and PATH_RUNQUEUELOW, i had great plans for them butGilles Chehade
they're still unused months later and there's many ways to achieve having a set of priorities on envelopes without needing additionnal queues.
2009-12-23Implementation of RFC 2920 PIPELINING extension, client side only for now.Jacek Masiulaniec
This restructures the client_* API internals significantly. The code becomes pipelining in nature. All SMTP commands are put on the output queue and dequeued as quickly as possible. Once dequeued, they're moved to the receive queue so that replies can be matched with previous commands. Dequeuing commands from the output queue halts when the count of commands currently in-pipeline (``cmdi'') is equal to the command send window (``cmdw''). There are three cmdw values useful in practice: 0 clear pipeline, ie. inhibit all future sends 1 disable pipelining, ie. use old ``one-request-one-reply`` mode SIZE_T_MAX enable pipelining, ie. dequeue as many commands as possible At the beginning of session cmdw is 1. When it is found that peer supports PIPELINING, it grows to SIZE_T_MAX. After dequeing DATA it is again 1. After sending QUIT it is 0. Each command dequeued from the output queue becomes a buf in a msgbuf. The act of combining multiple commands into a single send operation did not need to be implemented: buf_write() already combines bufs using iovec and sends them at once using sendmsg(2). Tested by todd@ and oga@ "looks good" to gilles@
2009-12-16Don't lose a line each time a chunkful of content is read off the disk.Jacek Masiulaniec
Problem spotted by todd@
2009-12-16Fix RCPT TO failure handling, bug introduced in r1.18.Jacek Masiulaniec
2009-12-15Simplify SSL code client-side, no functional change.Jacek Masiulaniec
2009-12-15Must aim better.Jacek Masiulaniec
2009-12-14Handle 6yz code as permanent error.Jacek Masiulaniec
2009-12-14Tweak the logic behind setting the fd limits so that smtpd is less likelyJacek Masiulaniec
to get upset by custom soft/hard ulimit settings. Suggested by todd@
2009-12-14Set initial session limit so that IMSG_SMTP_ENQUEUE can be satisfied evenJacek Masiulaniec
in absence of all other real listening sockets. Spotted by todd@
2009-12-14Control maximum number of bounce sessions similarly to how the mta and mdaJacek Masiulaniec
are now controlled.
2009-12-14Clear S_MESSAGE_PERMFAILURE when creating the bounce message. Makes theJacek Masiulaniec
bounce mails visible in mailq output.
2009-12-14Impose sessions limit on the delivery sessions (mta and mda).Jacek Masiulaniec
2009-12-14Do non-blocking I/O when delivering locally over a pipe.Jacek Masiulaniec
2009-12-13Use safe fd limits in smtp, lka, queue, and control. Removes aJacek Masiulaniec
possibility for fd-starvation fatal when under heavy load.
2009-12-13typoJacek Masiulaniec
2009-12-12When acting as a client do content reads from the disk progressivelyJacek Masiulaniec
as the remote accepts more data instead of doing one big read into the memory in the beginning of session.
2009-12-12Simplify client_* api, mainly by making fatal conditions result in immediateJacek Masiulaniec
fatals instead of passing the error up (kills ~300 lines). Implement sending of the QUIT command which replaces crude close(2). tested by gilles@, todd@
2009-12-12Don't qualify empty sender address with the domain, eg. in sendmail -f "<>".Jacek Masiulaniec
2009-12-10Fix a case when 2yz status would not override existing 4yz one.Jacek Masiulaniec
Reported by jsing@
2009-12-10Fix few read overruns found by parfait.Jacek Masiulaniec
Nudge by deraadt@
2009-12-07Avoid dereferencing a null pointer when logging a DNS lookup failure.Joel Sing
ok gilles@
2009-12-06fix previousJacek Masiulaniec
2009-12-05fix interface tagging listeners in the ipv6 caseCharles Longeau
while there factor some common code (from jacekm input) ok jacekm@
2009-12-02log_warn() consistency.Michael Knudsen
`OK' claudio
2009-11-26fix copy & paste error: IMSG_MTA_RESUME --> IMSG_MDA_RESUMECharles Longeau
ok gilles
2009-11-23In "smtpd; smtpd;" the second instance would fatal quickly, but it wouldJacek Masiulaniec
remove the smtpd.sock file, without which /usr/sbin/sendmail will fail causing mails to be queued in offline. Initially reported by ian@, may explain oga@'s e-mail burst after smtpd restart.
2009-11-17Fix handling of 5yz response to EHLO, ie. fallback to HELO.Jacek Masiulaniec
2009-11-16Kill dead code.Jacek Masiulaniec
2009-11-16Minimize the delay between receiving response to "." and removing the queueJacek Masiulaniec
entry in order to avoid the risk of sending duplicate mail.
2009-11-14add missing header needed by signal()Charles Longeau
ok gilles@
2009-11-14remove duplicate header includeCharles Longeau
ok gilles@
2009-11-13add missing headers needed by time()Charles Longeau
ok jacekm@
2009-11-13Add logging of failed local deliveries.Jacek Masiulaniec
2009-11-13Log all 4yz and 5yz replies that we send to our clients.Jacek Masiulaniec
2009-11-13Include recipient address in "Recipient rejected" reply.Jacek Masiulaniec
2009-11-13Log FQDN and IP of the server we handed mail to. As a bonus, don't delayJacek Masiulaniec
logging of successful deliveries until all MXs were tried, plus add logging of 5yz replies. tested by todd@, "reads ok" gilles@
2009-11-12Fix a memleak in parse_config(). Correct return code in few error paths.Jacek Masiulaniec
Fix two memleaks in purge_config(). First problem spotted by parfait, the other ones - by myself. "looks good" gilles@
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@