Mercurial > hg > nginx-quic
annotate src/mail/ngx_mail_imap_module.c @ 1908:f2953601ed3c
fix memory leak in long-lived non buffered connections
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 03 Mar 2008 10:42:00 +0000 |
parents | f69493e8faab |
children | 2a92804f4109 |
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 */ | |
39 ngx_string("AUTH=CRAM-MD5") | |
40 }; | |
41 | |
42 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
43 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
|
44 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
|
45 { 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
|
46 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
|
47 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 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
|
52 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
53 ngx_string("* BAD internal server error" CRLF) |
1136 | 54 }; |
55 | |
56 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
57 static ngx_command_t ngx_mail_imap_commands[] = { |
521 | 58 |
59 { ngx_string("imap_client_buffer"), | |
1136 | 60 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, |
521 | 61 ngx_conf_set_size_slot, |
1136 | 62 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
|
63 offsetof(ngx_mail_imap_srv_conf_t, client_buffer_size), |
527 | 64 NULL }, |
65 | |
66 { ngx_string("imap_capabilities"), | |
1136 | 67 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
|
68 ngx_mail_capabilities, |
1136 | 69 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
|
70 offsetof(ngx_mail_imap_srv_conf_t, capabilities), |
800 | 71 NULL }, |
72 | |
1323 | 73 { ngx_string("imap_auth"), |
74 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, | |
75 ngx_conf_set_bitmask_slot, | |
76 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
|
77 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
|
78 &ngx_mail_imap_auth_methods }, |
800 | 79 |
521 | 80 ngx_null_command |
81 }; | |
82 | |
83 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
84 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
|
85 &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
|
86 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
87 NULL, /* create main configuration */ |
521 | 88 NULL, /* init main configuration */ |
89 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
90 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
|
91 ngx_mail_imap_merge_srv_conf /* merge server configuration */ |
521 | 92 }; |
93 | |
94 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
95 ngx_module_t ngx_mail_imap_module = { |
521 | 96 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
|
97 &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
|
98 ngx_mail_imap_commands, /* module directives */ |
1136 | 99 NGX_MAIL_MODULE, /* module type */ |
541 | 100 NULL, /* init master */ |
521 | 101 NULL, /* init module */ |
541 | 102 NULL, /* init process */ |
103 NULL, /* init thread */ | |
104 NULL, /* exit thread */ | |
105 NULL, /* exit process */ | |
106 NULL, /* exit master */ | |
107 NGX_MODULE_V1_PADDING | |
521 | 108 }; |
109 | |
110 | |
111 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
|
112 ngx_mail_imap_create_srv_conf(ngx_conf_t *cf) |
577 | 113 { |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
114 ngx_mail_imap_srv_conf_t *iscf; |
641 | 115 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
116 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
|
117 if (iscf == NULL) { |
527 | 118 return NULL; |
521 | 119 } |
120 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
121 iscf->client_buffer_size = NGX_CONF_UNSET_SIZE; |
521 | 122 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
123 if (ngx_array_init(&iscf->capabilities, cf->pool, 4, sizeof(ngx_str_t)) |
1136 | 124 != NGX_OK) |
125 { | |
126 return NULL; | |
127 } | |
128 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
129 return iscf; |
521 | 130 } |
131 | |
132 | |
133 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
|
134 ngx_mail_imap_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
521 | 135 { |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
136 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
|
137 ngx_mail_imap_srv_conf_t *conf = child; |
521 | 138 |
1322 | 139 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
|
140 size_t size; |
527 | 141 ngx_str_t *c, *d; |
1136 | 142 ngx_uint_t i, m; |
527 | 143 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
144 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
|
145 prev->client_buffer_size, |
1481
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
146 (size_t) ngx_pagesize); |
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
147 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
148 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
|
149 prev->auth_methods, |
1481
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
150 (NGX_CONF_BITMASK_SET |
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
151 |NGX_MAIL_AUTH_PLAIN_ENABLED)); |
1323 | 152 |
800 | 153 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
154 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
|
155 conf->capabilities = prev->capabilities; |
527 | 156 } |
157 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
158 if (conf->capabilities.nelts == 0) { |
527 | 159 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
160 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
|
161 c = ngx_array_push(&conf->capabilities); |
527 | 162 if (c == NULL) { |
163 return NGX_CONF_ERROR; | |
164 } | |
165 | |
166 *c = *d; | |
167 } | |
168 } | |
169 | |
1136 | 170 size = sizeof("* CAPABILITY" CRLF) - 1; |
527 | 171 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
172 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
|
173 for (i = 0; i < conf->capabilities.nelts; i++) { |
527 | 174 size += 1 + c[i].len; |
175 } | |
176 | |
1323 | 177 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; |
178 m <= NGX_MAIL_AUTH_CRAM_MD5_ENABLED; | |
179 m <<= 1, i++) | |
180 { | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
181 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
|
182 size += 1 + ngx_mail_imap_auth_methods_names[i].len; |
1323 | 183 } |
184 } | |
185 | |
583 | 186 p = ngx_palloc(cf->pool, size); |
187 if (p == NULL) { | |
188 return NGX_CONF_ERROR; | |
189 } | |
190 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
191 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
|
192 conf->capability.data = p; |
583 | 193 |
194 p = ngx_cpymem(p, "* CAPABILITY", sizeof("* CAPABILITY") - 1); | |
195 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
196 for (i = 0; i < conf->capabilities.nelts; i++) { |
583 | 197 *p++ = ' '; |
198 p = ngx_cpymem(p, c[i].data, c[i].len); | |
199 } | |
200 | |
1323 | 201 auth = p; |
202 | |
203 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; | |
204 m <= NGX_MAIL_AUTH_CRAM_MD5_ENABLED; | |
205 m <<= 1, i++) | |
206 { | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
207 if (m & conf->auth_methods) { |
1323 | 208 *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
|
209 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
|
210 ngx_mail_imap_auth_methods_names[i].len); |
1323 | 211 } |
212 } | |
213 | |
583 | 214 *p++ = CR; *p = LF; |
215 | |
216 | |
217 size += sizeof(" STARTTLS") - 1; | |
218 | |
219 p = ngx_palloc(cf->pool, size); | |
220 if (p == NULL) { | |
527 | 221 return NGX_CONF_ERROR; |
222 } | |
223 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
224 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
|
225 conf->starttls_capability.data = p; |
527 | 226 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
227 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
|
228 conf->capability.len - (sizeof(CRLF) - 1)); |
583 | 229 p = ngx_cpymem(p, " STARTTLS", sizeof(" STARTTLS") - 1); |
230 *p++ = CR; *p = LF; | |
231 | |
232 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
233 size = (auth - conf->capability.data) + sizeof(CRLF) - 1 |
1323 | 234 + sizeof(" STARTTLS LOGINDISABLED") - 1; |
583 | 235 |
236 p = ngx_palloc(cf->pool, size); | |
237 if (p == NULL) { | |
238 return NGX_CONF_ERROR; | |
527 | 239 } |
240 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
241 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
|
242 conf->starttls_only_capability.data = p; |
527 | 243 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
244 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
|
245 auth - conf->capability.data); |
1323 | 246 p = ngx_cpymem(p, " STARTTLS LOGINDISABLED", |
247 sizeof(" STARTTLS LOGINDISABLED") - 1); | |
583 | 248 *p++ = CR; *p = LF; |
249 | |
521 | 250 return NGX_CONF_OK; |
251 } |