diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-10-21 19:12:18 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-10-21 19:12:18 +0000 |
commit | 055951dc96d1ba9457cdce04bad60fe50b6ea7be (patch) | |
tree | 1ed865f8a532be30837787ff3ee0305f4d86596a /src/imap/ngx_imap_auth_http_module.c | |
parent | b6b31c91be09794b3689bb705b29cc8cb2f7258a (diff) | |
download | nginx-release-0.3.5.tar.gz nginx-release-0.3.5.zip |
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/ngx_imap_auth_http_module.c')
-rw-r--r-- | src/imap/ngx_imap_auth_http_module.c | 22 |
1 files changed, 18 insertions, 4 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); |