Mercurial > hg > nginx
annotate src/mail/ngx_mail_imap_module.c @ 4192:61e4af19df9f
Autoindex: escape '?' in file names.
For files with '?' in their names autoindex generated links with '?' not
escaped. This resulted in effectively truncated links as '?' indicates
query string start.
This is an updated version of the patch originally posted at [1]. It
introduces generic NGX_ESCAPE_URI_COMPONENT which escapes everything but
unreserved characters as per RFC 3986. This approach also renders unneeded
special colon processing (as colon is percent-encoded now), it's dropped
accordingly.
[1] http://nginx.org/pipermail/nginx-devel/2010-February/000112.html
Reported by Konstantin Leonov.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 11 Oct 2011 17:56:51 +0000 |
parents | 8156bc03982a |
children | d620f497c50f |
rev | line source |
---|---|
521 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 #include <ngx_event.h> | |
1136 | 10 #include <ngx_mail.h> |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
11 #include <ngx_mail_imap_module.h> |
521 | 12 |
13 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
14 static void *ngx_mail_imap_create_srv_conf(ngx_conf_t *cf); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
15 static char *ngx_mail_imap_merge_srv_conf(ngx_conf_t *cf, void *parent, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
16 void *child); |
521 | 17 |
18 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
19 static ngx_str_t ngx_mail_imap_default_capabilities[] = { |
527 | 20 ngx_string("IMAP4"), |
21 ngx_string("IMAP4rev1"), | |
22 ngx_string("UIDPLUS"), | |
23 ngx_null_string | |
24 }; | |
25 | |
26 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
27 static ngx_conf_bitmask_t ngx_mail_imap_auth_methods[] = { |
1323 | 28 { ngx_string("plain"), NGX_MAIL_AUTH_PLAIN_ENABLED }, |
29 { ngx_string("login"), NGX_MAIL_AUTH_LOGIN_ENABLED }, | |
30 { ngx_string("cram-md5"), NGX_MAIL_AUTH_CRAM_MD5_ENABLED }, | |
31 { ngx_null_string, 0 } | |
32 }; | |
33 | |
34 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
35 static ngx_str_t ngx_mail_imap_auth_methods_names[] = { |
1323 | 36 ngx_string("AUTH=PLAIN"), |
37 ngx_string("AUTH=LOGIN"), | |
38 ngx_null_string, /* APOP */ | |
2309 | 39 ngx_string("AUTH=CRAM-MD5"), |
40 ngx_null_string /* NONE */ | |
1323 | 41 }; |
42 | |
43 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
44 static ngx_mail_protocol_t ngx_mail_imap_protocol = { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
45 ngx_string("imap"), |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
46 { 143, 993, 0, 0 }, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
47 NGX_MAIL_IMAP_PROTOCOL, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
48 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
49 ngx_mail_imap_init_session, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
50 ngx_mail_imap_init_protocol, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
51 ngx_mail_imap_parse_command, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
52 ngx_mail_imap_auth_state, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
53 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
54 ngx_string("* BAD internal server error" CRLF) |
1136 | 55 }; |
56 | |
57 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
58 static ngx_command_t ngx_mail_imap_commands[] = { |
521 | 59 |
60 { ngx_string("imap_client_buffer"), | |
1136 | 61 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, |
521 | 62 ngx_conf_set_size_slot, |
1136 | 63 NGX_MAIL_SRV_CONF_OFFSET, |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
64 offsetof(ngx_mail_imap_srv_conf_t, client_buffer_size), |
527 | 65 NULL }, |
66 | |
67 { ngx_string("imap_capabilities"), | |
1136 | 68 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
69 ngx_mail_capabilities, |
1136 | 70 NGX_MAIL_SRV_CONF_OFFSET, |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
71 offsetof(ngx_mail_imap_srv_conf_t, capabilities), |
800 | 72 NULL }, |
73 | |
1323 | 74 { ngx_string("imap_auth"), |
75 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, | |
76 ngx_conf_set_bitmask_slot, | |
77 NGX_MAIL_SRV_CONF_OFFSET, | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
78 offsetof(ngx_mail_imap_srv_conf_t, auth_methods), |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
79 &ngx_mail_imap_auth_methods }, |
800 | 80 |
521 | 81 ngx_null_command |
82 }; | |
83 | |
84 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
85 static ngx_mail_module_t ngx_mail_imap_module_ctx = { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
86 &ngx_mail_imap_protocol, /* protocol */ |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
87 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
88 NULL, /* create main configuration */ |
521 | 89 NULL, /* init main configuration */ |
90 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
91 ngx_mail_imap_create_srv_conf, /* create server configuration */ |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
92 ngx_mail_imap_merge_srv_conf /* merge server configuration */ |
521 | 93 }; |
94 | |
95 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
96 ngx_module_t ngx_mail_imap_module = { |
521 | 97 NGX_MODULE_V1, |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
98 &ngx_mail_imap_module_ctx, /* module context */ |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
99 ngx_mail_imap_commands, /* module directives */ |
1136 | 100 NGX_MAIL_MODULE, /* module type */ |
541 | 101 NULL, /* init master */ |
521 | 102 NULL, /* init module */ |
541 | 103 NULL, /* init process */ |
104 NULL, /* init thread */ | |
105 NULL, /* exit thread */ | |
106 NULL, /* exit process */ | |
107 NULL, /* exit master */ | |
108 NGX_MODULE_V1_PADDING | |
521 | 109 }; |
110 | |
111 | |
112 static void * | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
113 ngx_mail_imap_create_srv_conf(ngx_conf_t *cf) |
577 | 114 { |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
115 ngx_mail_imap_srv_conf_t *iscf; |
641 | 116 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
117 iscf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_imap_srv_conf_t)); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
118 if (iscf == NULL) { |
527 | 119 return NULL; |
521 | 120 } |
121 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
122 iscf->client_buffer_size = NGX_CONF_UNSET_SIZE; |
521 | 123 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
124 if (ngx_array_init(&iscf->capabilities, cf->pool, 4, sizeof(ngx_str_t)) |
1136 | 125 != NGX_OK) |
126 { | |
127 return NULL; | |
128 } | |
129 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
130 return iscf; |
521 | 131 } |
132 | |
133 | |
134 static char * | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
135 ngx_mail_imap_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
521 | 136 { |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
137 ngx_mail_imap_srv_conf_t *prev = parent; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
138 ngx_mail_imap_srv_conf_t *conf = child; |
521 | 139 |
1322 | 140 u_char *p, *auth; |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
141 size_t size; |
527 | 142 ngx_str_t *c, *d; |
1136 | 143 ngx_uint_t i, m; |
527 | 144 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
145 ngx_conf_merge_size_value(conf->client_buffer_size, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
146 prev->client_buffer_size, |
1481
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
147 (size_t) ngx_pagesize); |
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
148 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
149 ngx_conf_merge_bitmask_value(conf->auth_methods, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
150 prev->auth_methods, |
1481
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
151 (NGX_CONF_BITMASK_SET |
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
152 |NGX_MAIL_AUTH_PLAIN_ENABLED)); |
1323 | 153 |
800 | 154 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
155 if (conf->capabilities.nelts == 0) { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
156 conf->capabilities = prev->capabilities; |
527 | 157 } |
158 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
159 if (conf->capabilities.nelts == 0) { |
527 | 160 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
161 for (d = ngx_mail_imap_default_capabilities; d->len; d++) { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
162 c = ngx_array_push(&conf->capabilities); |
527 | 163 if (c == NULL) { |
164 return NGX_CONF_ERROR; | |
165 } | |
166 | |
167 *c = *d; | |
168 } | |
169 } | |
170 | |
1136 | 171 size = sizeof("* CAPABILITY" CRLF) - 1; |
527 | 172 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
173 c = conf->capabilities.elts; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
174 for (i = 0; i < conf->capabilities.nelts; i++) { |
527 | 175 size += 1 + c[i].len; |
176 } | |
177 | |
1323 | 178 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; |
179 m <= NGX_MAIL_AUTH_CRAM_MD5_ENABLED; | |
180 m <<= 1, i++) | |
181 { | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
182 if (m & conf->auth_methods) { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
183 size += 1 + ngx_mail_imap_auth_methods_names[i].len; |
1323 | 184 } |
185 } | |
186 | |
2049 | 187 p = ngx_pnalloc(cf->pool, size); |
583 | 188 if (p == NULL) { |
189 return NGX_CONF_ERROR; | |
190 } | |
191 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
192 conf->capability.len = size; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
193 conf->capability.data = p; |
583 | 194 |
195 p = ngx_cpymem(p, "* CAPABILITY", sizeof("* CAPABILITY") - 1); | |
196 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
197 for (i = 0; i < conf->capabilities.nelts; i++) { |
583 | 198 *p++ = ' '; |
199 p = ngx_cpymem(p, c[i].data, c[i].len); | |
200 } | |
201 | |
1323 | 202 auth = p; |
203 | |
204 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; | |
205 m <= NGX_MAIL_AUTH_CRAM_MD5_ENABLED; | |
206 m <<= 1, i++) | |
207 { | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
208 if (m & conf->auth_methods) { |
1323 | 209 *p++ = ' '; |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
210 p = ngx_cpymem(p, ngx_mail_imap_auth_methods_names[i].data, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
211 ngx_mail_imap_auth_methods_names[i].len); |
1323 | 212 } |
213 } | |
214 | |
583 | 215 *p++ = CR; *p = LF; |
216 | |
217 | |
218 size += sizeof(" STARTTLS") - 1; | |
219 | |
2049 | 220 p = ngx_pnalloc(cf->pool, size); |
583 | 221 if (p == NULL) { |
527 | 222 return NGX_CONF_ERROR; |
223 } | |
224 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
225 conf->starttls_capability.len = size; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
226 conf->starttls_capability.data = p; |
527 | 227 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
228 p = ngx_cpymem(p, conf->capability.data, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
229 conf->capability.len - (sizeof(CRLF) - 1)); |
583 | 230 p = ngx_cpymem(p, " STARTTLS", sizeof(" STARTTLS") - 1); |
231 *p++ = CR; *p = LF; | |
232 | |
233 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
234 size = (auth - conf->capability.data) + sizeof(CRLF) - 1 |
1323 | 235 + sizeof(" STARTTLS LOGINDISABLED") - 1; |
583 | 236 |
2049 | 237 p = ngx_pnalloc(cf->pool, size); |
583 | 238 if (p == NULL) { |
239 return NGX_CONF_ERROR; | |
527 | 240 } |
241 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
242 conf->starttls_only_capability.len = size; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
243 conf->starttls_only_capability.data = p; |
527 | 244 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
245 p = ngx_cpymem(p, conf->capability.data, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
246 auth - conf->capability.data); |
1323 | 247 p = ngx_cpymem(p, " STARTTLS LOGINDISABLED", |
248 sizeof(" STARTTLS LOGINDISABLED") - 1); | |
583 | 249 *p++ = CR; *p = LF; |
250 | |
521 | 251 return NGX_CONF_OK; |
252 } |