Mercurial > hg > nginx-quic
annotate src/mail/ngx_mail_pop3_module.c @ 5260:e088695737c3
Core: consolidated log-related code.
The stderr redirection code is moved to ngx_log_redirect_stderr().
The opening of the default log code is moved to ngx_log_open_default().
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 28 Jun 2013 17:24:54 +0400 |
parents | d620f497c50f |
children | ec01b1d1fff1 |
rev | line source |
---|---|
521 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
521 | 5 */ |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_event.h> | |
1136 | 11 #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
|
12 #include <ngx_mail_pop3_module.h> |
521 | 13 |
14 | |
1487
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 void *ngx_mail_pop3_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
|
16 static char *ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, |
521 | 17 void *child); |
18 | |
19 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
20 static ngx_str_t ngx_mail_pop3_default_capabilities[] = { |
527 | 21 ngx_string("TOP"), |
22 ngx_string("USER"), | |
23 ngx_string("UIDL"), | |
24 ngx_null_string | |
25 }; | |
26 | |
27 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
28 static ngx_conf_bitmask_t ngx_mail_pop3_auth_methods[] = { |
1136 | 29 { ngx_string("plain"), NGX_MAIL_AUTH_PLAIN_ENABLED }, |
30 { ngx_string("apop"), NGX_MAIL_AUTH_APOP_ENABLED }, | |
31 { ngx_string("cram-md5"), NGX_MAIL_AUTH_CRAM_MD5_ENABLED }, | |
800 | 32 { ngx_null_string, 0 } |
33 }; | |
34 | |
35 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
36 static ngx_str_t ngx_mail_pop3_auth_plain_capability = |
809 | 37 ngx_string("+OK methods supported:" CRLF |
38 "LOGIN" CRLF | |
39 "PLAIN" CRLF | |
40 "." CRLF); | |
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_str_t ngx_mail_pop3_auth_cram_md5_capability = |
809 | 44 ngx_string("+OK methods supported:" CRLF |
45 "LOGIN" CRLF | |
46 "PLAIN" CRLF | |
47 "CRAM-MD5" CRLF | |
48 "." CRLF); | |
49 | |
50 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
51 static ngx_mail_protocol_t ngx_mail_pop3_protocol = { |
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_string("pop3"), |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
53 { 110, 995, 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
|
54 NGX_MAIL_POP3_PROTOCOL, |
521 | 55 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
56 ngx_mail_pop3_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
|
57 ngx_mail_pop3_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
|
58 ngx_mail_pop3_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
|
59 ngx_mail_pop3_auth_state, |
1481
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
60 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
61 ngx_string("-ERR internal server error" CRLF) |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
62 }; |
1481
b58ce1cf66da
smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
63 |
587 | 64 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
65 static ngx_command_t ngx_mail_pop3_commands[] = { |
521 | 66 |
527 | 67 { ngx_string("pop3_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_pop3_srv_conf_t, capabilities), |
527 | 72 NULL }, |
73 | |
1136 | 74 { ngx_string("pop3_auth"), |
75 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, | |
800 | 76 ngx_conf_set_bitmask_slot, |
1136 | 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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_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_pop3_srv_conf_t *pscf; |
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 pscf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_pop3_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 (pscf == 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 if (ngx_array_init(&pscf->capabilities, cf->pool, 4, sizeof(ngx_str_t)) |
1136 | 123 != NGX_OK) |
124 { | |
125 return NULL; | |
126 } | |
127 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
128 return pscf; |
521 | 129 } |
130 | |
131 | |
132 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
|
133 ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
521 | 134 { |
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_pop3_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
|
136 ngx_mail_pop3_srv_conf_t *conf = child; |
521 | 137 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
138 u_char *p; |
1136 | 139 size_t size, stls_only_size; |
527 | 140 ngx_str_t *c, *d; |
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 ngx_uint_t i; |
1136 | 142 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
143 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
|
144 prev->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
|
145 (NGX_CONF_BITMASK_SET |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
146 |NGX_MAIL_AUTH_PLAIN_ENABLED)); |
800 | 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 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
|
149 conf->capabilities = prev->capabilities; |
800 | 150 } |
151 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
152 if (conf->capabilities.nelts == 0) { |
527 | 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 for (d = ngx_mail_pop3_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
|
155 c = ngx_array_push(&conf->capabilities); |
527 | 156 if (c == NULL) { |
157 return NGX_CONF_ERROR; | |
158 } | |
159 | |
160 *c = *d; | |
161 } | |
162 } | |
163 | |
164 size = sizeof("+OK Capability list follows" CRLF) - 1 | |
165 + sizeof("." CRLF) - 1; | |
166 | |
1136 | 167 stls_only_size = size + sizeof("STLS" CRLF) - 1; |
168 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
169 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
|
170 for (i = 0; i < conf->capabilities.nelts; i++) { |
527 | 171 size += c[i].len + sizeof(CRLF) - 1; |
1136 | 172 |
173 if (ngx_strcasecmp(c[i].data, (u_char *) "USER") == 0) { | |
174 continue; | |
175 } | |
176 | |
177 stls_only_size += c[i].len + sizeof(CRLF) - 1; | |
527 | 178 } |
179 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
180 if (conf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) { |
809 | 181 size += sizeof("SASL LOGIN PLAIN CRAM-MD5" CRLF) - 1; |
182 | |
183 } else { | |
184 size += sizeof("SASL LOGIN PLAIN" CRLF) - 1; | |
185 } | |
186 | |
2049 | 187 p = ngx_pnalloc(cf->pool, size); |
583 | 188 if (p == NULL) { |
527 | 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, "+OK Capability list follows" CRLF, | |
196 sizeof("+OK Capability list follows" CRLF) - 1); | |
527 | 197 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
198 for (i = 0; i < conf->capabilities.nelts; i++) { |
583 | 199 p = ngx_cpymem(p, c[i].data, c[i].len); |
200 *p++ = CR; *p++ = LF; | |
527 | 201 } |
202 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
203 if (conf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) { |
809 | 204 p = ngx_cpymem(p, "SASL LOGIN PLAIN CRAM-MD5" CRLF, |
205 sizeof("SASL LOGIN PLAIN CRAM-MD5" CRLF) - 1); | |
206 | |
207 } else { | |
208 p = ngx_cpymem(p, "SASL LOGIN PLAIN" CRLF, | |
209 sizeof("SASL LOGIN PLAIN" CRLF) - 1); | |
210 } | |
211 | |
583 | 212 *p++ = '.'; *p++ = CR; *p = LF; |
213 | |
214 | |
215 size += sizeof("STLS" CRLF) - 1; | |
527 | 216 |
2049 | 217 p = ngx_pnalloc(cf->pool, size); |
583 | 218 if (p == NULL) { |
219 return NGX_CONF_ERROR; | |
220 } | |
221 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
222 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
|
223 conf->starttls_capability.data = p; |
583 | 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 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
|
226 conf->capability.len - (sizeof("." CRLF) - 1)); |
583 | 227 |
228 p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1); | |
229 *p++ = '.'; *p++ = CR; *p = LF; | |
527 | 230 |
231 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
232 if (conf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
233 conf->auth_capability = ngx_mail_pop3_auth_cram_md5_capability; |
809 | 234 |
235 } else { | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
236 conf->auth_capability = ngx_mail_pop3_auth_plain_capability; |
809 | 237 } |
238 | |
239 | |
2049 | 240 p = ngx_pnalloc(cf->pool, stls_only_size); |
1136 | 241 if (p == NULL) { |
242 return NGX_CONF_ERROR; | |
243 } | |
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 conf->starttls_only_capability.len = stls_only_size; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
246 conf->starttls_only_capability.data = p; |
1136 | 247 |
248 p = ngx_cpymem(p, "+OK Capability list follows" CRLF, | |
249 sizeof("+OK Capability list follows" CRLF) - 1); | |
250 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1481
diff
changeset
|
251 for (i = 0; i < conf->capabilities.nelts; i++) { |
1136 | 252 if (ngx_strcasecmp(c[i].data, (u_char *) "USER") == 0) { |
253 continue; | |
254 } | |
255 | |
256 p = ngx_cpymem(p, c[i].data, c[i].len); | |
257 *p++ = CR; *p++ = LF; | |
258 } | |
259 | |
260 p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1); | |
261 *p++ = '.'; *p++ = CR; *p = LF; | |
262 | |
521 | 263 return NGX_CONF_OK; |
264 } |