Mercurial > hg > nginx-mail
diff src/mail/ngx_mail.h @ 404:481e8f936572
Mail: rename "unauth" to "none".
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 23 Jul 2007 23:30:01 +0000 |
parents | d4cac61d8e95 |
children | 52b28d322d76 |
line wrap: on
line diff
--- a/src/mail/ngx_mail.h +++ b/src/mail/ngx_mail.h @@ -68,6 +68,7 @@ typedef struct { ngx_array_t listen; /* ngx_mail_listen_t */ } ngx_mail_core_main_conf_t; +typedef void (*ngx_mail_handler_pt)(ngx_connection_t *c); #define NGX_MAIL_POP3_PROTOCOL 0 #define NGX_MAIL_IMAP_PROTOCOL 1 @@ -107,6 +108,34 @@ typedef struct { ngx_array_t imap_capabilities; ngx_array_t smtp_capabilities; + /* + * Handlers: + * + * - handler_init_session + * + * Init new session after client connects. Protocol greetings printed + * from here, so you need to define this if you need custom greeting + * (or pause before greeting printed). + * + * - handler_init_protocol + * + * Initialize protocol-specific data after client sent first command. + * Notably, this is re-called after STARTTLS negotiation. + * + * - handler_read + * + * Read client command. Could be the only handler used by simple + * modules. + * + * NB: handler_read is re-used after auth_http module work (if it was + * called throgh ngx_mail_auth_http_init()) in case of error returned + * by auth server, so you should set this if you use auth_http. + */ + + ngx_mail_handler_pt handler_init_session; + ngx_event_handler_pt handler_init_protocol; + ngx_event_handler_pt handler_read; + /* server ctx */ ngx_mail_conf_ctx_t *ctx; } ngx_mail_core_srv_conf_t; @@ -152,8 +181,12 @@ typedef enum { ngx_smtp_auth_plain, ngx_smtp_auth_cram_md5, ngx_smtp_helo, - ngx_smtp_noxclient, - ngx_smtp_xclient + ngx_smtp_helo_xclient, + ngx_smtp_helo_from, + ngx_smtp_xclient, + ngx_smtp_xclient_from, + ngx_smtp_from, + ngx_smtp_to } ngx_smtp_state_e; @@ -187,7 +220,7 @@ typedef struct { unsigned no_sync_literal:1; unsigned starttls:1; unsigned esmtp:1; - unsigned auth_method:2; + unsigned auth_method:3; unsigned auth_wait:1; ngx_str_t login; @@ -199,6 +232,8 @@ typedef struct { ngx_str_t *addr_text; ngx_str_t smtp_helo; + ngx_str_t smtp_from; + ngx_str_t smtp_to; ngx_uint_t command; ngx_array_t args; @@ -268,12 +303,14 @@ typedef struct { #define NGX_MAIL_AUTH_LOGIN 1 #define NGX_MAIL_AUTH_APOP 2 #define NGX_MAIL_AUTH_CRAM_MD5 3 +#define NGX_MAIL_AUTH_NONE 4 #define NGX_MAIL_AUTH_PLAIN_ENABLED 0x0002 #define NGX_MAIL_AUTH_LOGIN_ENABLED 0x0004 #define NGX_MAIL_AUTH_APOP_ENABLED 0x0008 #define NGX_MAIL_AUTH_CRAM_MD5_ENABLED 0x0010 +#define NGX_MAIL_AUTH_NONE_ENABLED 0x0020 #define NGX_MAIL_PARSE_INVALID_COMMAND 20 @@ -312,10 +349,15 @@ void ngx_smtp_auth_state(ngx_event_t *re void ngx_mail_close_connection(ngx_connection_t *c); void ngx_mail_session_internal_server_error(ngx_mail_session_t *s); +ngx_int_t ngx_mail_read_command(ngx_mail_session_t *s); + ngx_int_t ngx_pop3_parse_command(ngx_mail_session_t *s); ngx_int_t ngx_imap_parse_command(ngx_mail_session_t *s); ngx_int_t ngx_smtp_parse_command(ngx_mail_session_t *s); +#if (NGX_MAIL_SSL) +void ngx_mail_starttls_handler(ngx_event_t *rev); +#endif /* STUB */ void ngx_mail_proxy_init(ngx_mail_session_t *s, ngx_peer_addr_t *peer);