aboutsummaryrefslogtreecommitdiff
path: root/src/imap/ngx_imap_core_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-12-05 13:18:09 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-12-05 13:18:09 +0000
commitd3283ff9224a41a1a24c2d89f671811c0747480a (patch)
treee122c436f72f587622e8ec0e75632434045e330d /src/imap/ngx_imap_core_module.c
parent0624ed3d7eaa1995d9e5ec4292bd1eccda09cafc (diff)
downloadnginx-release-0.3.13.tar.gz
nginx-release-0.3.13.zip
nginx-0.3.13-RELEASE importrelease-0.3.13
*) Feature: the IMAP/POP3 proxy supports STARTTLS and STLS. *) Bugfix: the IMAP/POP3 proxy did not work with the select, poll, and /dev/poll methods. *) Bugfix: in SSI handling. *) Bugfix: now Solaris sendfilev() is not used to transfer the client request body to FastCGI-server via the unix domain socket. *) Bugfix: the "auth_basic" directive did not disable the authorization; the bug had appeared in 0.3.11.
Diffstat (limited to 'src/imap/ngx_imap_core_module.c')
-rw-r--r--src/imap/ngx_imap_core_module.c84
1 files changed, 68 insertions, 16 deletions
diff --git a/src/imap/ngx_imap_core_module.c b/src/imap/ngx_imap_core_module.c
index 6408e5401..e805a8161 100644
--- a/src/imap/ngx_imap_core_module.c
+++ b/src/imap/ngx_imap_core_module.c
@@ -181,8 +181,8 @@ ngx_imap_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_imap_core_srv_conf_t *prev = parent;
ngx_imap_core_srv_conf_t *conf = child;
+ u_char *p;
size_t size;
- ngx_buf_t *b;
ngx_str_t *c, *d;
ngx_uint_t i;
@@ -218,22 +218,40 @@ ngx_imap_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size += c[i].len + sizeof(CRLF) - 1;
}
- b = ngx_create_temp_buf(cf->pool, size);
- if (b == NULL) {
+ p = ngx_palloc(cf->pool, size);
+ if (p == NULL) {
return NGX_CONF_ERROR;
}
- b->last = ngx_cpymem(b->last, "+OK Capability list follows" CRLF,
- sizeof("+OK Capability list follows" CRLF) - 1);
+ conf->pop3_capability.len = size;
+ conf->pop3_capability.data = p;
+
+ p = ngx_cpymem(p, "+OK Capability list follows" CRLF,
+ sizeof("+OK Capability list follows" CRLF) - 1);
for (i = 0; i < conf->pop3_capabilities.nelts; i++) {
- b->last = ngx_cpymem(b->last, c[i].data, c[i].len);
- *b->last++ = CR; *b->last++ = LF;
+ p = ngx_cpymem(p, c[i].data, c[i].len);
+ *p++ = CR; *p++ = LF;
+ }
+
+ *p++ = '.'; *p++ = CR; *p = LF;
+
+
+ size += sizeof("STLS" CRLF) - 1;
+
+ p = ngx_palloc(cf->pool, size);
+ if (p == NULL) {
+ return NGX_CONF_ERROR;
}
- *b->last++ = '.'; *b->last++ = CR; *b->last++ = LF;
+ conf->pop3_starttls_capability.len = size;
+ conf->pop3_starttls_capability.data = p;
+
+ p = ngx_cpymem(p, conf->pop3_capability.data,
+ conf->pop3_capability.len - (sizeof("." CRLF) - 1));
- conf->pop3_capability = b;
+ p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1);
+ *p++ = '.'; *p++ = CR; *p = LF;
if (conf->imap_capabilities.nelts == 0) {
@@ -259,21 +277,55 @@ ngx_imap_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
size += 1 + c[i].len;
}
- b = ngx_create_temp_buf(cf->pool, size);
- if (b == NULL) {
+ p = ngx_palloc(cf->pool, size);
+ if (p == NULL) {
return NGX_CONF_ERROR;
}
- b->last = ngx_cpymem(b->last, "* CAPABILITY", sizeof("* CAPABILITY") - 1);
+ conf->imap_capability.len = size;
+ conf->imap_capability.data = p;
+
+ p = ngx_cpymem(p, "* CAPABILITY", sizeof("* CAPABILITY") - 1);
for (i = 0; i < conf->imap_capabilities.nelts; i++) {
- *b->last++ = ' ';
- b->last = ngx_cpymem(b->last, c[i].data, c[i].len);
+ *p++ = ' ';
+ p = ngx_cpymem(p, c[i].data, c[i].len);
}
- *b->last++ = CR; *b->last++ = LF;
+ *p++ = CR; *p = LF;
+
+
+ size += sizeof(" STARTTLS") - 1;
+
+ p = ngx_palloc(cf->pool, size);
+ if (p == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ conf->imap_starttls_capability.len = size;
+ conf->imap_starttls_capability.data = p;
+
+ p = ngx_cpymem(p, conf->imap_capability.data,
+ conf->imap_capability.len - (sizeof(CRLF) - 1));
+ p = ngx_cpymem(p, " STARTTLS", sizeof(" STARTTLS") - 1);
+ *p++ = CR; *p = LF;
+
+
+ size += sizeof(" LOGINDISABLED") - 1;
+
+ p = ngx_palloc(cf->pool, size);
+ if (p == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ conf->imap_starttls_only_capability.len = size;
+ conf->imap_starttls_only_capability.data = p;
+
+ p = ngx_cpymem(p, conf->imap_starttls_capability.data,
+ conf->imap_starttls_capability.len - (sizeof(CRLF) - 1));
+ p = ngx_cpymem(p, " LOGINDISABLED", sizeof(" LOGINDISABLED") - 1);
+ *p++ = CR; *p = LF;
- conf->imap_capability = b;
return NGX_CONF_OK;
}