annotate src/mail/ngx_mail_pop3_module.c @ 7660:d33e17499088

Version bump.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 26 May 2020 22:03:00 +0300
parents 03735fef08da
children dc955d274130
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 /*
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
3 * Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 2049
diff changeset
4 * Copyright (C) Nginx, Inc.
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5 */
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 #include <ngx_config.h>
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #include <ngx_core.h>
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 #include <ngx_event.h>
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
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
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
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
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 void *child);
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
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
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
21 ngx_string("TOP"),
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
22 ngx_string("USER"),
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
23 ngx_string("UIDL"),
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
24 ngx_null_string
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
25 };
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
26
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
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
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
29 { ngx_string("plain"), NGX_MAIL_AUTH_PLAIN_ENABLED },
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
30 { ngx_string("apop"), NGX_MAIL_AUTH_APOP_ENABLED },
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
31 { ngx_string("cram-md5"), NGX_MAIL_AUTH_CRAM_MD5_ENABLED },
6774
bcb107bb89cd Mail: support SASL EXTERNAL (RFC 4422).
Rob N ★ <robn@fastmail.com>
parents: 6773
diff changeset
32 { ngx_string("external"), NGX_MAIL_AUTH_EXTERNAL_ENABLED },
800
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
33 { ngx_null_string, 0 }
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
34 };
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
35
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
36
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
37 static ngx_str_t ngx_mail_pop3_auth_methods_names[] = {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
38 ngx_string("PLAIN"),
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
39 ngx_string("LOGIN"),
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
40 ngx_null_string, /* APOP */
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
41 ngx_string("CRAM-MD5"),
6774
bcb107bb89cd Mail: support SASL EXTERNAL (RFC 4422).
Rob N ★ <robn@fastmail.com>
parents: 6773
diff changeset
42 ngx_string("EXTERNAL"),
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
43 ngx_null_string /* NONE */
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
44 };
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
45
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
46
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
47 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
48 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
49 { 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
50 NGX_MAIL_POP3_PROTOCOL,
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
51
1487
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_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
53 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
54 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
55 ngx_mail_pop3_auth_state,
1481
b58ce1cf66da smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents: 1323
diff changeset
56
5989
ec01b1d1fff1 Mail: client SSL certificates support.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
57 ngx_string("-ERR internal server error" CRLF),
ec01b1d1fff1 Mail: client SSL certificates support.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
58 ngx_string("-ERR SSL certificate error" CRLF),
ec01b1d1fff1 Mail: client SSL certificates support.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
59 ngx_string("-ERR No required SSL certificate" CRLF)
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
60 };
1481
b58ce1cf66da smtp_client_buffer and smtp_greeting_delay
Igor Sysoev <igor@sysoev.ru>
parents: 1323
diff changeset
61
587
284cc140593b nginx-0.3.15-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 583
diff changeset
62
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 static ngx_command_t ngx_mail_pop3_commands[] = {
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
64
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
65 { ngx_string("pop3_capabilities"),
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
66 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
67 ngx_mail_capabilities,
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
68 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
69 offsetof(ngx_mail_pop3_srv_conf_t, capabilities),
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
70 NULL },
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
71
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
72 { ngx_string("pop3_auth"),
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
73 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE,
800
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
74 ngx_conf_set_bitmask_slot,
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
75 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
76 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
77 &ngx_mail_pop3_auth_methods },
800
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
78
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
79 ngx_null_command
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
80 };
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
81
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
82
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
83 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
84 &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
85
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
86 NULL, /* create main configuration */
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
87 NULL, /* init main configuration */
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
88
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
89 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
90 ngx_mail_pop3_merge_srv_conf /* merge server configuration */
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
91 };
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
92
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
93
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
94 ngx_module_t ngx_mail_pop3_module = {
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
95 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
96 &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
97 ngx_mail_pop3_commands, /* module directives */
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
98 NGX_MAIL_MODULE, /* module type */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
99 NULL, /* init master */
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
100 NULL, /* init module */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
101 NULL, /* init process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
102 NULL, /* init thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
103 NULL, /* exit thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
104 NULL, /* exit process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
105 NULL, /* exit master */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 539
diff changeset
106 NGX_MODULE_V1_PADDING
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
107 };
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
108
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
109
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
110 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
111 ngx_mail_pop3_create_srv_conf(ngx_conf_t *cf)
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 563
diff changeset
112 {
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_srv_conf_t *pscf;
641
5e8fb59c18c1 nginx-0.3.42-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 619
diff changeset
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 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
116 if (pscf == NULL) {
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
117 return NULL;
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
118 }
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
119
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
120 if (ngx_array_init(&pscf->capabilities, cf->pool, 4, sizeof(ngx_str_t))
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
121 != NGX_OK)
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
122 {
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
123 return NULL;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
124 }
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
125
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
126 return pscf;
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
127 }
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
128
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
129
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
130 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
131 ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
132 {
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_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
134 ngx_mail_pop3_srv_conf_t *conf = child;
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
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 u_char *p;
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
137 size_t size, stls_only_size;
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
138 ngx_str_t *c, *d;
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
139 ngx_uint_t i, m;
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
140
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_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
142 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
143 (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
144 |NGX_MAIL_AUTH_PLAIN_ENABLED));
800
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
145
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
146 if (conf->auth_methods & NGX_MAIL_AUTH_PLAIN_ENABLED) {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
147 conf->auth_methods |= NGX_MAIL_AUTH_LOGIN_ENABLED;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
148 }
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
149
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
150 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
151 conf->capabilities = prev->capabilities;
800
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
152 }
Igor Sysoev <igor@sysoev.ru>
parents: 663
diff changeset
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) {
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
155
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
156 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
157 c = ngx_array_push(&conf->capabilities);
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
158 if (c == NULL) {
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
159 return NGX_CONF_ERROR;
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
160 }
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
161
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
162 *c = *d;
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
163 }
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
164 }
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
165
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
166 size = sizeof("+OK Capability list follows" CRLF) - 1
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
167 + sizeof("." CRLF) - 1;
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
168
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
169 stls_only_size = size + sizeof("STLS" CRLF) - 1;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
170
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
171 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
172 for (i = 0; i < conf->capabilities.nelts; i++) {
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
173 size += c[i].len + sizeof(CRLF) - 1;
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
174
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
175 if (ngx_strcasecmp(c[i].data, (u_char *) "USER") == 0) {
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
176 continue;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
177 }
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
178
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
179 stls_only_size += c[i].len + sizeof(CRLF) - 1;
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
180 }
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
181
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
182 size += sizeof("SASL") - 1 + sizeof(CRLF) - 1;
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
183
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
184 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
6774
bcb107bb89cd Mail: support SASL EXTERNAL (RFC 4422).
Rob N ★ <robn@fastmail.com>
parents: 6773
diff changeset
185 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
186 m <<= 1, i++)
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
187 {
6924
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
188 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
189 continue;
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
190 }
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
191
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
192 if (m & conf->auth_methods) {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
193 size += 1 + ngx_mail_pop3_auth_methods_names[i].len;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
194 }
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
195 }
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
196
2049
2a92804f4109 *) back out r2040
Igor Sysoev <igor@sysoev.ru>
parents: 1487
diff changeset
197 p = ngx_pnalloc(cf->pool, size);
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
198 if (p == NULL) {
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
199 return NGX_CONF_ERROR;
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
200 }
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
201
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
202 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
203 conf->capability.data = p;
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
204
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
205 p = ngx_cpymem(p, "+OK Capability list follows" CRLF,
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
206 sizeof("+OK Capability list follows" CRLF) - 1);
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
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 for (i = 0; i < conf->capabilities.nelts; i++) {
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
209 p = ngx_cpymem(p, c[i].data, c[i].len);
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
210 *p++ = CR; *p++ = LF;
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
211 }
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
212
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
213 p = ngx_cpymem(p, "SASL", sizeof("SASL") - 1);
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
214
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
215 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
6774
bcb107bb89cd Mail: support SASL EXTERNAL (RFC 4422).
Rob N ★ <robn@fastmail.com>
parents: 6773
diff changeset
216 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
217 m <<= 1, i++)
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
218 {
6924
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
219 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
220 continue;
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
221 }
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
222
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
223 if (m & conf->auth_methods) {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
224 *p++ = ' ';
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
225 p = ngx_cpymem(p, ngx_mail_pop3_auth_methods_names[i].data,
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
226 ngx_mail_pop3_auth_methods_names[i].len);
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
227 }
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
228 }
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
229
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
230 *p++ = CR; *p++ = LF;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
231
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
232 *p++ = '.'; *p++ = CR; *p = LF;
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
233
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
234
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
235 size += sizeof("STLS" CRLF) - 1;
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
236
2049
2a92804f4109 *) back out r2040
Igor Sysoev <igor@sysoev.ru>
parents: 1487
diff changeset
237 p = ngx_pnalloc(cf->pool, size);
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
238 if (p == NULL) {
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
239 return NGX_CONF_ERROR;
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
240 }
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
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_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_capability.data = p;
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
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 conf->capability.len - (sizeof("." CRLF) - 1));
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
247
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
248 p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1);
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
249 *p++ = '.'; *p++ = CR; *p = LF;
527
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
250
7fa11e5c6e96 nginx-0.1.38-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 523
diff changeset
251
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
252 size = sizeof("+OK methods supported:" CRLF) - 1
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
253 + sizeof("." CRLF) - 1;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
254
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
255 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
6774
bcb107bb89cd Mail: support SASL EXTERNAL (RFC 4422).
Rob N ★ <robn@fastmail.com>
parents: 6773
diff changeset
256 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
257 m <<= 1, i++)
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
258 {
6924
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
259 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
260 continue;
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
261 }
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
262
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
263 if (m & conf->auth_methods) {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
264 size += ngx_mail_pop3_auth_methods_names[i].len
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
265 + sizeof(CRLF) - 1;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
266 }
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
267 }
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
268
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
269 p = ngx_pnalloc(cf->pool, size);
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
270 if (p == NULL) {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
271 return NGX_CONF_ERROR;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
272 }
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
273
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
274 conf->auth_capability.data = p;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
275 conf->auth_capability.len = size;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
276
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
277 p = ngx_cpymem(p, "+OK methods supported:" CRLF,
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
278 sizeof("+OK methods supported:" CRLF) - 1);
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
279
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
280 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0;
6774
bcb107bb89cd Mail: support SASL EXTERNAL (RFC 4422).
Rob N ★ <robn@fastmail.com>
parents: 6773
diff changeset
281 m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
282 m <<= 1, i++)
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
283 {
6924
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
284 if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
285 continue;
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
286 }
03735fef08da Mail: don't emit separator in capability lists for APOP.
Sergey Kandaurov <pluknet@nginx.com>
parents: 6774
diff changeset
287
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
288 if (m & conf->auth_methods) {
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
289 p = ngx_cpymem(p, ngx_mail_pop3_auth_methods_names[i].data,
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
290 ngx_mail_pop3_auth_methods_names[i].len);
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
291 *p++ = CR; *p++ = LF;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
292 }
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
293 }
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
294
6773
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
295 *p++ = '.'; *p++ = CR; *p = LF;
73b451d304c0 Mail: extensible auth methods in pop3 module.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5989
diff changeset
296
809
da9c1521319d AUTH PLAIN LOGIN CRAM-MD5
Igor Sysoev <igor@sysoev.ru>
parents: 804
diff changeset
297
2049
2a92804f4109 *) back out r2040
Igor Sysoev <igor@sysoev.ru>
parents: 1487
diff changeset
298 p = ngx_pnalloc(cf->pool, stls_only_size);
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
299 if (p == NULL) {
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
300 return NGX_CONF_ERROR;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
301 }
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
302
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
303 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
304 conf->starttls_only_capability.data = p;
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
305
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
306 p = ngx_cpymem(p, "+OK Capability list follows" CRLF,
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
307 sizeof("+OK Capability list follows" CRLF) - 1);
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
308
1487
f69493e8faab ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents: 1481
diff changeset
309 for (i = 0; i < conf->capabilities.nelts; i++) {
1136
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
310 if (ngx_strcasecmp(c[i].data, (u_char *) "USER") == 0) {
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
311 continue;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
312 }
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
313
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
314 p = ngx_cpymem(p, c[i].data, c[i].len);
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
315 *p++ = CR; *p++ = LF;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
316 }
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
317
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
318 p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1);
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
319 *p++ = '.'; *p++ = CR; *p = LF;
68f30ab68bb7 Many changes:
Igor Sysoev <igor@sysoev.ru>
parents: 906
diff changeset
320
521
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
321 return NGX_CONF_OK;
6f00349b98e5 nginx-0.1.35-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
322 }