comparison src/mail/ngx_mail_pop3_module.c @ 6924:03735fef08da

Mail: don't emit separator in capability lists for APOP. Notably, this fixes CAPA and AUTH output. The bug had appeared in nginx 1.11.6 (73b451d304c0).
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 06 Mar 2017 17:56:23 +0300
parents bcb107bb89cd
children dc955d274130
comparison
equal deleted inserted replaced
6923:fbdaad9b0e7b 6924:03735fef08da
183 183
184 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; 184 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
185 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED; 185 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
186 m <<= 1, i++) 186 m <<= 1, i++)
187 { 187 {
188 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
189 continue;
190 }
191
188 if (m & conf->auth_methods) { 192 if (m & conf->auth_methods) {
189 size += 1 + ngx_mail_pop3_auth_methods_names[i].len; 193 size += 1 + ngx_mail_pop3_auth_methods_names[i].len;
190 } 194 }
191 } 195 }
192 196
210 214
211 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; 215 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
212 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED; 216 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
213 m <<= 1, i++) 217 m <<= 1, i++)
214 { 218 {
219 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
220 continue;
221 }
222
215 if (m & conf->auth_methods) { 223 if (m & conf->auth_methods) {
216 *p++ = ' '; 224 *p++ = ' ';
217 p = ngx_cpymem(p, ngx_mail_pop3_auth_methods_names[i].data, 225 p = ngx_cpymem(p, ngx_mail_pop3_auth_methods_names[i].data,
218 ngx_mail_pop3_auth_methods_names[i].len); 226 ngx_mail_pop3_auth_methods_names[i].len);
219 } 227 }
246 254
247 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; 255 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
248 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED; 256 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
249 m <<= 1, i++) 257 m <<= 1, i++)
250 { 258 {
259 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
260 continue;
261 }
262
251 if (m & conf->auth_methods) { 263 if (m & conf->auth_methods) {
252 size += ngx_mail_pop3_auth_methods_names[i].len 264 size += ngx_mail_pop3_auth_methods_names[i].len
253 + sizeof(CRLF) - 1; 265 + sizeof(CRLF) - 1;
254 } 266 }
255 } 267 }
267 279
268 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; 280 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
269 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED; 281 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
270 m <<= 1, i++) 282 m <<= 1, i++)
271 { 283 {
284 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
285 continue;
286 }
287
272 if (m & conf->auth_methods) { 288 if (m & conf->auth_methods) {
273 p = ngx_cpymem(p, ngx_mail_pop3_auth_methods_names[i].data, 289 p = ngx_cpymem(p, ngx_mail_pop3_auth_methods_names[i].data,
274 ngx_mail_pop3_auth_methods_names[i].len); 290 ngx_mail_pop3_auth_methods_names[i].len);
275 *p++ = CR; *p++ = LF; 291 *p++ = CR; *p++ = LF;
276 } 292 }