comparison 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
comparison
equal deleted inserted replaced
403:d4cac61d8e95 404:481e8f936572
66 typedef struct { 66 typedef struct {
67 ngx_array_t servers; /* ngx_mail_core_srv_conf_t */ 67 ngx_array_t servers; /* ngx_mail_core_srv_conf_t */
68 ngx_array_t listen; /* ngx_mail_listen_t */ 68 ngx_array_t listen; /* ngx_mail_listen_t */
69 } ngx_mail_core_main_conf_t; 69 } ngx_mail_core_main_conf_t;
70 70
71 typedef void (*ngx_mail_handler_pt)(ngx_connection_t *c);
71 72
72 #define NGX_MAIL_POP3_PROTOCOL 0 73 #define NGX_MAIL_POP3_PROTOCOL 0
73 #define NGX_MAIL_IMAP_PROTOCOL 1 74 #define NGX_MAIL_IMAP_PROTOCOL 1
74 #define NGX_MAIL_SMTP_PROTOCOL 2 75 #define NGX_MAIL_SMTP_PROTOCOL 2
75 76
104 ngx_uint_t smtp_auth_methods; 105 ngx_uint_t smtp_auth_methods;
105 106
106 ngx_array_t pop3_capabilities; 107 ngx_array_t pop3_capabilities;
107 ngx_array_t imap_capabilities; 108 ngx_array_t imap_capabilities;
108 ngx_array_t smtp_capabilities; 109 ngx_array_t smtp_capabilities;
110
111 /*
112 * Handlers:
113 *
114 * - handler_init_session
115 *
116 * Init new session after client connects. Protocol greetings printed
117 * from here, so you need to define this if you need custom greeting
118 * (or pause before greeting printed).
119 *
120 * - handler_init_protocol
121 *
122 * Initialize protocol-specific data after client sent first command.
123 * Notably, this is re-called after STARTTLS negotiation.
124 *
125 * - handler_read
126 *
127 * Read client command. Could be the only handler used by simple
128 * modules.
129 *
130 * NB: handler_read is re-used after auth_http module work (if it was
131 * called throgh ngx_mail_auth_http_init()) in case of error returned
132 * by auth server, so you should set this if you use auth_http.
133 */
134
135 ngx_mail_handler_pt handler_init_session;
136 ngx_event_handler_pt handler_init_protocol;
137 ngx_event_handler_pt handler_read;
109 138
110 /* server ctx */ 139 /* server ctx */
111 ngx_mail_conf_ctx_t *ctx; 140 ngx_mail_conf_ctx_t *ctx;
112 } ngx_mail_core_srv_conf_t; 141 } ngx_mail_core_srv_conf_t;
113 142
150 ngx_smtp_auth_login_username, 179 ngx_smtp_auth_login_username,
151 ngx_smtp_auth_login_password, 180 ngx_smtp_auth_login_password,
152 ngx_smtp_auth_plain, 181 ngx_smtp_auth_plain,
153 ngx_smtp_auth_cram_md5, 182 ngx_smtp_auth_cram_md5,
154 ngx_smtp_helo, 183 ngx_smtp_helo,
155 ngx_smtp_noxclient, 184 ngx_smtp_helo_xclient,
156 ngx_smtp_xclient 185 ngx_smtp_helo_from,
186 ngx_smtp_xclient,
187 ngx_smtp_xclient_from,
188 ngx_smtp_from,
189 ngx_smtp_to
157 } ngx_smtp_state_e; 190 } ngx_smtp_state_e;
158 191
159 192
160 typedef struct { 193 typedef struct {
161 ngx_peer_connection_t upstream; 194 ngx_peer_connection_t upstream;
185 unsigned quoted:1; 218 unsigned quoted:1;
186 unsigned backslash:1; 219 unsigned backslash:1;
187 unsigned no_sync_literal:1; 220 unsigned no_sync_literal:1;
188 unsigned starttls:1; 221 unsigned starttls:1;
189 unsigned esmtp:1; 222 unsigned esmtp:1;
190 unsigned auth_method:2; 223 unsigned auth_method:3;
191 unsigned auth_wait:1; 224 unsigned auth_wait:1;
192 225
193 ngx_str_t login; 226 ngx_str_t login;
194 ngx_str_t passwd; 227 ngx_str_t passwd;
195 228
197 ngx_str_t tag; 230 ngx_str_t tag;
198 ngx_str_t tagged_line; 231 ngx_str_t tagged_line;
199 232
200 ngx_str_t *addr_text; 233 ngx_str_t *addr_text;
201 ngx_str_t smtp_helo; 234 ngx_str_t smtp_helo;
235 ngx_str_t smtp_from;
236 ngx_str_t smtp_to;
202 237
203 ngx_uint_t command; 238 ngx_uint_t command;
204 ngx_array_t args; 239 ngx_array_t args;
205 240
206 ngx_uint_t login_attempt; 241 ngx_uint_t login_attempt;
266 301
267 #define NGX_MAIL_AUTH_PLAIN 0 302 #define NGX_MAIL_AUTH_PLAIN 0
268 #define NGX_MAIL_AUTH_LOGIN 1 303 #define NGX_MAIL_AUTH_LOGIN 1
269 #define NGX_MAIL_AUTH_APOP 2 304 #define NGX_MAIL_AUTH_APOP 2
270 #define NGX_MAIL_AUTH_CRAM_MD5 3 305 #define NGX_MAIL_AUTH_CRAM_MD5 3
306 #define NGX_MAIL_AUTH_NONE 4
271 307
272 308
273 #define NGX_MAIL_AUTH_PLAIN_ENABLED 0x0002 309 #define NGX_MAIL_AUTH_PLAIN_ENABLED 0x0002
274 #define NGX_MAIL_AUTH_LOGIN_ENABLED 0x0004 310 #define NGX_MAIL_AUTH_LOGIN_ENABLED 0x0004
275 #define NGX_MAIL_AUTH_APOP_ENABLED 0x0008 311 #define NGX_MAIL_AUTH_APOP_ENABLED 0x0008
276 #define NGX_MAIL_AUTH_CRAM_MD5_ENABLED 0x0010 312 #define NGX_MAIL_AUTH_CRAM_MD5_ENABLED 0x0010
313 #define NGX_MAIL_AUTH_NONE_ENABLED 0x0020
277 314
278 315
279 #define NGX_MAIL_PARSE_INVALID_COMMAND 20 316 #define NGX_MAIL_PARSE_INVALID_COMMAND 20
280 317
281 318
310 void ngx_imap_auth_state(ngx_event_t *rev); 347 void ngx_imap_auth_state(ngx_event_t *rev);
311 void ngx_smtp_auth_state(ngx_event_t *rev); 348 void ngx_smtp_auth_state(ngx_event_t *rev);
312 void ngx_mail_close_connection(ngx_connection_t *c); 349 void ngx_mail_close_connection(ngx_connection_t *c);
313 void ngx_mail_session_internal_server_error(ngx_mail_session_t *s); 350 void ngx_mail_session_internal_server_error(ngx_mail_session_t *s);
314 351
352 ngx_int_t ngx_mail_read_command(ngx_mail_session_t *s);
353
315 ngx_int_t ngx_pop3_parse_command(ngx_mail_session_t *s); 354 ngx_int_t ngx_pop3_parse_command(ngx_mail_session_t *s);
316 ngx_int_t ngx_imap_parse_command(ngx_mail_session_t *s); 355 ngx_int_t ngx_imap_parse_command(ngx_mail_session_t *s);
317 ngx_int_t ngx_smtp_parse_command(ngx_mail_session_t *s); 356 ngx_int_t ngx_smtp_parse_command(ngx_mail_session_t *s);
318 357
358 #if (NGX_MAIL_SSL)
359 void ngx_mail_starttls_handler(ngx_event_t *rev);
360 #endif
319 361
320 /* STUB */ 362 /* STUB */
321 void ngx_mail_proxy_init(ngx_mail_session_t *s, ngx_peer_addr_t *peer); 363 void ngx_mail_proxy_init(ngx_mail_session_t *s, ngx_peer_addr_t *peer);
322 void ngx_mail_auth_http_init(ngx_mail_session_t *s); 364 void ngx_mail_auth_http_init(ngx_mail_session_t *s);
323 /**/ 365 /**/