Mercurial > hg > nginx-vendor-0-5
comparison src/imap/ngx_imap_handler.c @ 286:5bef04fc3fd5 NGINX_0_5_13
nginx 0.5.13
*) Feature: the COPY and MOVE methods.
*) Bugfix: the ngx_http_realip_module set garbage for requests passed
via keep-alive connection.
*) Bugfix: nginx did not work on big-endian 64-bit Linux.
Thanks to Andrei Nigmatulin.
*) Bugfix: now when IMAP/POP3 proxy receives too long command it closes
the connection right away, but not after timeout.
*) Bugfix: if the "epoll" method was used and a client closed a
connection prematurely, then nginx closed the connection after a
send timeout only.
*) Bugfix: nginx could not be built on platforms different from i386,
amd64, sparc and ppc; bug appeared in 0.5.8.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 19 Feb 2007 00:00:00 +0300 |
parents | 052a7b1d40e5 |
children |
comparison
equal
deleted
inserted
replaced
285:0e505c8b6528 | 286:5bef04fc3fd5 |
---|---|
800 | 800 |
801 arg = s->args.elts; | 801 arg = s->args.elts; |
802 | 802 |
803 if (arg[0].len == 5) { | 803 if (arg[0].len == 5) { |
804 | 804 |
805 if (ngx_strncasecmp(arg[0].data, "LOGIN", 5) == 0) { | 805 if (ngx_strncasecmp(arg[0].data, (u_char *) "LOGIN", 5) |
806 == 0) | |
807 { | |
806 | 808 |
807 if (s->args.nelts != 1) { | 809 if (s->args.nelts != 1) { |
808 rc = NGX_IMAP_PARSE_INVALID_COMMAND; | 810 rc = NGX_IMAP_PARSE_INVALID_COMMAND; |
809 break; | 811 break; |
810 } | 812 } |
814 size = sizeof(pop3_username) - 1; | 816 size = sizeof(pop3_username) - 1; |
815 text = pop3_username; | 817 text = pop3_username; |
816 | 818 |
817 break; | 819 break; |
818 | 820 |
819 } else if (ngx_strncasecmp(arg[0].data, "PLAIN", 5) == 0) { | 821 } else if (ngx_strncasecmp(arg[0].data, (u_char *) "PLAIN", |
822 5) | |
823 == 0) | |
824 { | |
820 | 825 |
821 if (s->args.nelts == 1) { | 826 if (s->args.nelts == 1) { |
822 s->imap_state = ngx_pop3_auth_plain; | 827 s->imap_state = ngx_pop3_auth_plain; |
823 | 828 |
824 size = sizeof(pop3_next) - 1; | 829 size = sizeof(pop3_next) - 1; |
854 rc = NGX_IMAP_PARSE_INVALID_COMMAND; | 859 rc = NGX_IMAP_PARSE_INVALID_COMMAND; |
855 break; | 860 break; |
856 } | 861 } |
857 | 862 |
858 } else if (arg[0].len == 8 | 863 } else if (arg[0].len == 8 |
859 && ngx_strncasecmp(arg[0].data, "CRAM-MD5", 8) == 0) | 864 && ngx_strncasecmp(arg[0].data, |
865 (u_char *) "CRAM-MD5", 8) | |
866 == 0) | |
860 { | 867 { |
861 s->imap_state = ngx_pop3_auth_cram_md5; | 868 s->imap_state = ngx_pop3_auth_cram_md5; |
862 | 869 |
863 text = ngx_palloc(c->pool, | 870 text = ngx_palloc(c->pool, |
864 sizeof("+ " CRLF) - 1 | 871 sizeof("+ " CRLF) - 1 |
1203 static ngx_int_t | 1210 static ngx_int_t |
1204 ngx_imap_read_command(ngx_imap_session_t *s) | 1211 ngx_imap_read_command(ngx_imap_session_t *s) |
1205 { | 1212 { |
1206 ssize_t n; | 1213 ssize_t n; |
1207 ngx_int_t rc; | 1214 ngx_int_t rc; |
1215 ngx_str_t l; | |
1208 | 1216 |
1209 n = s->connection->recv(s->connection, s->buffer->last, | 1217 n = s->connection->recv(s->connection, s->buffer->last, |
1210 s->buffer->end - s->buffer->last); | 1218 s->buffer->end - s->buffer->last); |
1211 | 1219 |
1212 if (n == NGX_ERROR || n == 0) { | 1220 if (n == NGX_ERROR || n == 0) { |
1231 rc = ngx_pop3_parse_command(s); | 1239 rc = ngx_pop3_parse_command(s); |
1232 } else { | 1240 } else { |
1233 rc = ngx_imap_parse_command(s); | 1241 rc = ngx_imap_parse_command(s); |
1234 } | 1242 } |
1235 | 1243 |
1236 if (rc == NGX_AGAIN | 1244 if (rc == NGX_AGAIN) { |
1237 || rc == NGX_IMAP_NEXT | 1245 |
1238 || rc == NGX_IMAP_PARSE_INVALID_COMMAND) | 1246 if (s->buffer->last < s->buffer->end) { |
1239 { | 1247 return rc; |
1248 } | |
1249 | |
1250 l.len = s->buffer->last - s->buffer->start; | |
1251 l.data = s->buffer->start; | |
1252 | |
1253 ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, | |
1254 "client sent too long command \"%V\"", &l); | |
1255 | |
1256 s->quit = 1; | |
1257 | |
1258 return NGX_IMAP_PARSE_INVALID_COMMAND; | |
1259 } | |
1260 | |
1261 if (rc == NGX_IMAP_NEXT || rc == NGX_IMAP_PARSE_INVALID_COMMAND) { | |
1240 return rc; | 1262 return rc; |
1241 } | 1263 } |
1242 | 1264 |
1243 if (rc == NGX_ERROR) { | 1265 if (rc == NGX_ERROR) { |
1244 ngx_imap_close_connection(s->connection); | 1266 ngx_imap_close_connection(s->connection); |