comparison src/mail/ngx_mail_pop3_handler.c @ 570:8246d8a2c2be NGINX_0_8_37

nginx 0.8.37 *) Feature: the ngx_http_split_clients_module. *) Feature: the "map" directive supports keys more than 255 characters. *) Bugfix: nginx ignored the "private" and "no-store" values in the "Cache-Control" backend response header line. *) Bugfix: a "stub" parameter of an "include" SSI directive was not used, if empty response has 200 status code. *) Bugfix: if a proxied or FastCGI request was internally redirected to another proxied or FastCGI location, then a segmentation fault might occur in a worker process; the bug had appeared in 0.8.33. Thanks to Yichun Zhang. *) Bugfix: IMAP connections may hang until they timed out while talking to Zimbra server. Thanks to Alan Batie.
author Igor Sysoev <http://sysoev.ru>
date Mon, 17 May 2010 00:00:00 +0400
parents da3c99095432
children d0f7a625f27c
comparison
equal deleted inserted replaced
569:19b134bf21c0 570:8246d8a2c2be
57 p = ngx_cpymem(p, s->salt.data, s->salt.len); 57 p = ngx_cpymem(p, s->salt.data, s->salt.len);
58 58
59 s->out.len = p - s->out.data; 59 s->out.len = p - s->out.data;
60 60
61 } else { 61 } else {
62 s->out.len = sizeof(pop3_greeting) - 1; 62 ngx_str_set(&s->out, pop3_greeting);
63 s->out.data = pop3_greeting;
64 } 63 }
65 64
66 c->read->handler = ngx_mail_pop3_init_protocol; 65 c->read->handler = ngx_mail_pop3_init_protocol;
67 66
68 ngx_add_timer(c->read, cscf->timeout); 67 ngx_add_timer(c->read, cscf->timeout);
147 146
148 if (rc == NGX_AGAIN || rc == NGX_ERROR) { 147 if (rc == NGX_AGAIN || rc == NGX_ERROR) {
149 return; 148 return;
150 } 149 }
151 150
152 s->out.len = sizeof(pop3_ok) - 1; 151 ngx_str_set(&s->out, pop3_ok);
153 s->out.data = pop3_ok;
154 152
155 if (rc == NGX_OK) { 153 if (rc == NGX_OK) {
156 switch (s->mail_state) { 154 switch (s->mail_state) {
157 155
158 case ngx_pop3_start: 156 case ngx_pop3_start:
224 break; 222 break;
225 223
226 case ngx_pop3_auth_login_username: 224 case ngx_pop3_auth_login_username:
227 rc = ngx_mail_auth_login_username(s, c, 0); 225 rc = ngx_mail_auth_login_username(s, c, 0);
228 226
229 s->out.len = sizeof(pop3_password) - 1; 227 ngx_str_set(&s->out, pop3_password);
230 s->out.data = pop3_password;
231 s->mail_state = ngx_pop3_auth_login_password; 228 s->mail_state = ngx_pop3_auth_login_password;
232 break; 229 break;
233 230
234 case ngx_pop3_auth_login_password: 231 case ngx_pop3_auth_login_password:
235 rc = ngx_mail_auth_login_password(s, c); 232 rc = ngx_mail_auth_login_password(s, c);
257 254
258 case NGX_MAIL_PARSE_INVALID_COMMAND: 255 case NGX_MAIL_PARSE_INVALID_COMMAND:
259 s->mail_state = ngx_pop3_start; 256 s->mail_state = ngx_pop3_start;
260 s->state = 0; 257 s->state = 0;
261 258
262 s->out.len = sizeof(pop3_invalid_command) - 1; 259 ngx_str_set(&s->out, pop3_invalid_command);
263 s->out.data = pop3_invalid_command;
264 260
265 /* fall through */ 261 /* fall through */
266 262
267 case NGX_OK: 263 case NGX_OK:
268 264
464 460
465 switch (rc) { 461 switch (rc) {
466 462
467 case NGX_MAIL_AUTH_LOGIN: 463 case NGX_MAIL_AUTH_LOGIN:
468 464
469 s->out.len = sizeof(pop3_username) - 1; 465 ngx_str_set(&s->out, pop3_username);
470 s->out.data = pop3_username;
471 s->mail_state = ngx_pop3_auth_login_username; 466 s->mail_state = ngx_pop3_auth_login_username;
472 467
473 return NGX_OK; 468 return NGX_OK;
474 469
475 case NGX_MAIL_AUTH_LOGIN_USERNAME: 470 case NGX_MAIL_AUTH_LOGIN_USERNAME:
476 471
477 s->out.len = sizeof(pop3_password) - 1; 472 ngx_str_set(&s->out, pop3_password);
478 s->out.data = pop3_password;
479 s->mail_state = ngx_pop3_auth_login_password; 473 s->mail_state = ngx_pop3_auth_login_password;
480 474
481 return ngx_mail_auth_login_username(s, c, 1); 475 return ngx_mail_auth_login_username(s, c, 1);
482 476
483 case NGX_MAIL_AUTH_PLAIN: 477 case NGX_MAIL_AUTH_PLAIN:
484 478
485 s->out.len = sizeof(pop3_next) - 1; 479 ngx_str_set(&s->out, pop3_next);
486 s->out.data = pop3_next;
487 s->mail_state = ngx_pop3_auth_plain; 480 s->mail_state = ngx_pop3_auth_plain;
488 481
489 return NGX_OK; 482 return NGX_OK;
490 483
491 case NGX_MAIL_AUTH_CRAM_MD5: 484 case NGX_MAIL_AUTH_CRAM_MD5: