summaryrefslogtreecommitdiffhomepage
path: root/src/mail/ngx_mail_handler.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-06-08SSL: removed the "ssl" directive.Roman Arutyunyan1-3/+3
It has been deprecated since 7270:46c0c7ef4913 (1.15.0) in favour of the "ssl" parameter of the "listen" directive, which has been available since 2224:109849282793 (0.7.14).
2021-05-19Mail: max_errors directive.Maxim Dounin1-1/+14
Similarly to smtpd_hard_error_limit in Postfix and smtp_max_unknown_commands in Exim, specifies the number of errors after which the connection is closed.
2021-04-21Mail: fixed reading with fully filled buffer (ticket #2159).Maxim Dounin1-11/+14
With SMTP pipelining, ngx_mail_read_command() can be called with s->buffer without any space available, to parse additional commands received to the buffer on previous calls. Previously, this resulted in recv() being called with zero length, resulting in zero being returned, which was interpreted as a connection close by the client, so nginx silently closed connection. Fix is to avoid calling c->recv() if there is no free space in the buffer, but continue parsing of the already received commands.
2021-03-11Mail: fixed build without SSL.Maxim Dounin1-3/+4
Broken by d84f13618277 and 12ea1de7d87c (1.19.8). Reported by Sergey Osokin.
2021-03-05Mail: realip module.Maxim Dounin1-0/+5
When configured with the "set_real_ip_from", it can set client's IP address as visible in logs to the one obtained via the PROXY protocol.
2021-03-05Mail: parsing of the PROXY protocol from clients.Maxim Dounin1-3/+91
Activated with the "proxy_protocol" parameter of the "listen" directive. Obtained information is passed to the auth_http script in Proxy-Protocol-Addr, Proxy-Protocol-Port, Proxy-Protocol-Server-Addr, and Proxy-Protocol-Server-Port headers.
2021-03-05Mail: fixed log action after SSL handshake.Maxim Dounin1-0/+2
2021-03-05Mail: postponed session initialization under accept mutex.Maxim Dounin1-1/+28
Similarly to 40e8ce405859 in the stream module, this reduces the time accept mutex is held. This also simplifies following changes to introduce PROXY protocol support.
2021-03-05Mail: added missing event handling after reading data.Maxim Dounin1-5/+0
If we need to be notified about further events, ngx_handle_read_event() needs to be called after a read event is processed. Without this, an event can be removed from the kernel and won't be reported again, notably when using oneshot event methods, such as eventport on Solaris. For consistency, existing ngx_handle_read_event() call removed from ngx_mail_read_command(), as this call only covers one of the code paths where ngx_mail_read_command() returns NGX_AGAIN. Instead, appropriate processing added to the callers, covering all code paths where NGX_AGAIN is returned.
2018-04-24SSL: detect "listen ... ssl" without certificates (ticket #178).Maxim Dounin1-17/+1
In mail and stream modules, no certificate provided is a fatal condition, much like with the "ssl" and "starttls" directives. In http, "listen ... ssl" can be used in a non-default server without certificates as long as there is a certificate in the default one, so missing certificate is only fatal for default servers.
2018-01-30SSL: using default server context in session remove (closes #1464).Sergey Kandaurov1-2/+2
This fixes segfault in configurations with multiple virtual servers sharing the same port, where a non-default virtual server block misses certificate.
2017-05-29Style: changed checks of ngx_ssl_create_connection() to != NGX_OK.Maxim Dounin1-1/+1
In http these checks were changed in a6d6d762c554, though mail module was missed at that time. Since then, the stream module was introduced based on mail, using "== NGX_ERROR" check.
2016-10-08Mail: support SASL EXTERNAL (RFC 4422).Rob N ★1-0/+34
This is needed to allow TLS client certificate auth to work. With ssl_verify_client configured, the auth daemon can choose to allow the connection to proceed based on the certificate data. This has been tested with Thunderbird for IMAP only. I've not yet found a client that will do client certificate auth for POP3 or SMTP, and the method is not really documented anywhere that I can find. That said, its simple enough that the way I've done is probably right.
2015-02-20Mail: error_log support.Vladimir Homutov1-12/+17
2015-02-25Mail: client SSL certificates support.Maxim Dounin1-0/+71
The "ssl_verify_client", "ssl_verify_depth", "ssl_client_certificate", "ssl_trusted_certificate", and "ssl_crl" directives introduced to control SSL client certificate verification in mail proxy module. If there is a certificate, detail of the certificate are passed to the auth_http script configured via Auth-SSL-Verify, Auth-SSL-Subject, Auth-SSL-Issuer, Auth-SSL-Serial, Auth-SSL-Fingerprint headers. If the auth_http_pass_client_cert directive is set, client certificate in PEM format will be passed in the Auth-SSL-Cert header (urlencoded). If there is no required certificate provided during an SSL handshake or certificate verification fails then a protocol-specific error is returned after the SSL handshake and the connection is closed. Based on previous work by Sven Peter, Franck Levionnois and Filipe Da Silva.
2014-09-01Mail: initialize the "signature" field of ngx_mail_session_t.Valentin Bartenev1-0/+2
Currently it isn't used, but it can be suitable to distinguish objects stored in c->data.
2014-05-22Mail: output client port number on client connects (ticket #531).Ruslan Ermilov1-2/+6
2014-03-31Mail: fixed ngx_mail_send() (ticket #519).Maxim Dounin1-0/+7
2014-03-06Fixed format specifier in logging of "c->number".Sergey Kandaurov1-1/+1
2013-09-30Mail: smtp pipelining support.Maxim Dounin1-3/+9
Basically, this does the following two changes (and corresponding modifications of related code): 1. Does not reset session buffer unless it's reached it's end, and always wait for LF to terminate command (even if we detected invalid command). 2. Record command name to make it available for handlers (since now we can't assume that command starts from s->buffer->start).
2012-08-17Removed a stale "AF_INET only" comment.Ruslan Ermilov1-2/+0
IPv6 client connections in mail modules have been supported since r2856.
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2010-06-23style fixIgor Sysoev1-4/+4
2009-06-18ignore ngx_atomic_fetch_add() resultIgor Sysoev1-1/+1
this fixes building at least by gcc 4.2.1 on Mac OS X 10.6
2009-05-18mail proxy listen IPv6 supportIgor Sysoev1-36/+72
2009-05-04axe imap module artifactsIgor Sysoev1-11/+11
2009-02-09compatibility with Microsoft'sIgor Sysoev1-4/+5
AUTH LOGIN [base64 encoded user name ] patch by Maxim Dounin
2008-12-09use "!= NGX_OK" instead of "== NGX_ERROR"Igor Sysoev1-3/+3
2008-09-01*) listen sslIgor Sysoev1-0/+19
*) no default ssl_cetificate and ssl_cetificate_key
2008-08-12backout both r2162 and r2128 and implement a new fixIgor Sysoev1-0/+2
2008-06-17*) back out r2040Igor Sysoev1-9/+10
*) refactor ngx_palloc() *) introduce ngx_pnalloc() *) additional pool blocks have smaller header
2007-12-10move condition declarations inside blocks where they are usedIgor Sysoev1-5/+3
2007-09-21fix "AUTH PLAIN [initial-response]" bug introduced in r1477Igor Sysoev1-1/+1
2007-09-20log starttlsIgor Sysoev1-1/+3
2007-09-15ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_moduleIgor Sysoev1-38/+20
2007-09-14optimizationsIgor Sysoev1-10/+9
2007-09-14move event handling to protocol specific code,Igor Sysoev1-6/+0
it is required to support SMTP greeting delay
2007-09-13optimizationsIgor Sysoev1-0/+52
2007-09-13style fix and optimizationsIgor Sysoev1-5/+5
2007-09-13split pop3, imap, and smtp handlersIgor Sysoev1-1666/+191
2007-09-11decrement active connection counter in mail proxyIgor Sysoev1-0/+4
2007-07-20IMAP AUTHENTICATEIgor Sysoev1-68/+311
patch by Maxim Dounin
2007-07-20SMTP STARTTLSIgor Sysoev1-0/+67
patch by Maxim Dounin
2007-07-11fix segfault when CRAM-MD5 is not enabled but client tries itIgor Sysoev1-2/+11
2007-04-18style fix: remove tabsIgor Sysoev1-27/+27
2007-03-19Many changes:Igor Sysoev1-0/+1838
*) rename imap to mail, sort pop3/imap functions *) smtp auth support *) pop3 starttls only *) fix segfault if cram-md5 was used without apop