Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/imap
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-10-21 23:12:18 +0400
committerIgor Sysoev <igor@sysoev.ru>2005-10-21 23:12:18 +0400
commit055951dc96d1ba9457cdce04bad60fe50b6ea7be (patch)
tree1ed865f8a532be30837787ff3ee0305f4d86596a /src/imap
parentb6b31c91be09794b3689bb705b29cc8cb2f7258a (diff)
nginx-0.3.5-RELEASE importrelease-0.3.5
*) Bugfix: the segmentation fault may occurred if the IMAP/POP3 login was changed by authorization server; the bug had appeared in 0.2.2. *) Bugfix: the accept mutex did not work and all connections were handled by one process; the bug had appeared in 0.3.3. *) Bugfix: the timeout did not work if the "rtsig" method and the "timer_resolution" directive were used.
Diffstat (limited to 'src/imap')
-rw-r--r--src/imap/ngx_imap_auth_http_module.c22
-rw-r--r--src/imap/ngx_imap_handler.c6
2 files changed, 21 insertions, 7 deletions
diff --git a/src/imap/ngx_imap_auth_http_module.c b/src/imap/ngx_imap_auth_http_module.c
index bc98dc8b8..4b8584de1 100644
--- a/src/imap/ngx_imap_auth_http_module.c
+++ b/src/imap/ngx_imap_auth_http_module.c
@@ -44,6 +44,7 @@ struct ngx_imap_auth_http_ctx_s {
ngx_str_t addr;
ngx_str_t port;
ngx_str_t err;
+ ngx_str_t errmsg;
time_t sleep;
@@ -459,6 +460,9 @@ ngx_imap_auth_http_process_headers(ngx_imap_session_t *s,
continue;
}
+ ctx->errmsg.len = len;
+ ctx->errmsg.data = ctx->header_start;
+
if (s->protocol == NGX_IMAP_POP3_PROTOCOL) {
size = sizeof("-ERR") - 1 + len + sizeof(CRLF) - 1;
@@ -486,6 +490,7 @@ ngx_imap_auth_http_process_headers(ngx_imap_session_t *s,
}
*p++ = ' ';
+
p = ngx_cpymem(p, ctx->header_start, len);
*p++ = CR; *p++ = LF;
@@ -519,7 +524,16 @@ ngx_imap_auth_http_process_headers(ngx_imap_session_t *s,
sizeof("Auth-User") - 1) == 0)
{
s->login.len = ctx->header_end - ctx->header_start;
- s->login.data = ctx->header_start;
+
+ s->login.data = ngx_palloc(s->connection->pool, s->login.len);
+ if (s->login.data == NULL) {
+ ngx_close_connection(ctx->peer.connection);
+ ngx_destroy_pool(ctx->pool);
+ ngx_imap_session_internal_server_error(s);
+ return;
+ }
+
+ ngx_memcpy(s->login.data, ctx->header_start, s->login.len);
continue;
}
@@ -550,14 +564,14 @@ ngx_imap_auth_http_process_headers(ngx_imap_session_t *s,
ngx_close_connection(ctx->peer.connection);
if (ctx->err.len) {
+ ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
+ "client login failed: \"%V\"", &ctx->errmsg);
+
s->out = ctx->err;
timer = ctx->sleep;
ngx_destroy_pool(ctx->pool);
- ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
- "client login failed");
-
if (timer == 0) {
s->quit = 1;
ngx_imap_send(s->connection->write);
diff --git a/src/imap/ngx_imap_handler.c b/src/imap/ngx_imap_handler.c
index 4fe124871..b8c5bfc04 100644
--- a/src/imap/ngx_imap_handler.c
+++ b/src/imap/ngx_imap_handler.c
@@ -767,9 +767,9 @@ ngx_imap_ssl_close_handler(ngx_event_t *ev)
static u_char *
ngx_imap_log_error(ngx_log_t *log, u_char *buf, size_t len)
{
- u_char *p;
- ngx_imap_session_t *s;
- ngx_imap_log_ctx_t *ctx;
+ u_char *p;
+ ngx_imap_session_t *s;
+ ngx_imap_log_ctx_t *ctx;
if (log->action) {
p = ngx_snprintf(buf, len, " while %s", log->action);