Mercurial > hg > nginx
annotate src/mail/ngx_mail_pop3_module.c @ 1737:ff3334e863ca stable-0.5
bump version
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 13 Dec 2007 10:55:18 +0000 |
parents | ed9cd1702f7a |
children |
rev | line source |
---|---|
1621
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2 /* |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
4 */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_event.h> |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <ngx_mail.h> |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 #include <ngx_mail_pop3_module.h> |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 static void *ngx_mail_pop3_create_srv_conf(ngx_conf_t *cf); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 static char *ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 void *child); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
18 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 static ngx_str_t ngx_mail_pop3_default_capabilities[] = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 ngx_string("TOP"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 ngx_string("USER"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 ngx_string("UIDL"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
23 ngx_null_string |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
24 }; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
27 static ngx_conf_bitmask_t ngx_mail_pop3_auth_methods[] = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 { ngx_string("plain"), NGX_MAIL_AUTH_PLAIN_ENABLED }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 { ngx_string("apop"), NGX_MAIL_AUTH_APOP_ENABLED }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 { ngx_string("cram-md5"), NGX_MAIL_AUTH_CRAM_MD5_ENABLED }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 { ngx_null_string, 0 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 }; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 static ngx_str_t ngx_mail_pop3_auth_plain_capability = |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 ngx_string("+OK methods supported:" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 "LOGIN" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 "PLAIN" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 "." CRLF); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
42 static ngx_str_t ngx_mail_pop3_auth_cram_md5_capability = |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 ngx_string("+OK methods supported:" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 "LOGIN" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 "PLAIN" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 "CRAM-MD5" CRLF |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 "." CRLF); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 static ngx_mail_protocol_t ngx_mail_pop3_protocol = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
51 ngx_string("pop3"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
52 { 110, 995, 0, 0 }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 NGX_MAIL_POP3_PROTOCOL, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
54 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
55 ngx_mail_pop3_init_session, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
56 ngx_mail_pop3_init_protocol, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
57 ngx_mail_pop3_parse_command, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
58 ngx_mail_pop3_auth_state, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
59 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 ngx_string("-ERR internal server error" CRLF) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
61 }; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
63 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
64 static ngx_command_t ngx_mail_pop3_commands[] = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
65 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
66 { ngx_string("pop3_capabilities"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
67 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
68 ngx_mail_capabilities, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
69 NGX_MAIL_SRV_CONF_OFFSET, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
70 offsetof(ngx_mail_pop3_srv_conf_t, capabilities), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
71 NULL }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
72 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
73 { ngx_string("pop3_auth"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
74 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
75 ngx_conf_set_bitmask_slot, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
76 NGX_MAIL_SRV_CONF_OFFSET, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
77 offsetof(ngx_mail_pop3_srv_conf_t, auth_methods), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
78 &ngx_mail_pop3_auth_methods }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
79 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
80 ngx_null_command |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
81 }; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
82 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
83 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
84 static ngx_mail_module_t ngx_mail_pop3_module_ctx = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 &ngx_mail_pop3_protocol, /* protocol */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
86 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
87 NULL, /* create main configuration */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
88 NULL, /* init main configuration */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
89 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
90 ngx_mail_pop3_create_srv_conf, /* create server configuration */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
91 ngx_mail_pop3_merge_srv_conf /* merge server configuration */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
92 }; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
93 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
94 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
95 ngx_module_t ngx_mail_pop3_module = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
96 NGX_MODULE_V1, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
97 &ngx_mail_pop3_module_ctx, /* module context */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
98 ngx_mail_pop3_commands, /* module directives */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
99 NGX_MAIL_MODULE, /* module type */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 NULL, /* init master */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 NULL, /* init module */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 NULL, /* init process */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
103 NULL, /* init thread */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
104 NULL, /* exit thread */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
105 NULL, /* exit process */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
106 NULL, /* exit master */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
107 NGX_MODULE_V1_PADDING |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
108 }; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
109 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
110 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
111 static void * |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
112 ngx_mail_pop3_create_srv_conf(ngx_conf_t *cf) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
114 ngx_mail_pop3_srv_conf_t *pscf; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
115 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
116 pscf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_pop3_srv_conf_t)); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
117 if (pscf == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
118 return NULL; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
119 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
120 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
121 if (ngx_array_init(&pscf->capabilities, cf->pool, 4, sizeof(ngx_str_t)) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
122 != NGX_OK) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
123 { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
124 return NULL; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
125 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
126 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
127 return pscf; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
128 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
129 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
130 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
131 static char * |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
132 ngx_mail_pop3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
133 { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
134 ngx_mail_pop3_srv_conf_t *prev = parent; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
135 ngx_mail_pop3_srv_conf_t *conf = child; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
136 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
137 u_char *p; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
138 size_t size, stls_only_size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
139 ngx_str_t *c, *d; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
140 ngx_uint_t i; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
141 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
142 ngx_conf_merge_bitmask_value(conf->auth_methods, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
143 prev->auth_methods, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
144 (NGX_CONF_BITMASK_SET |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
145 |NGX_MAIL_AUTH_PLAIN_ENABLED)); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
146 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
147 if (conf->capabilities.nelts == 0) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
148 conf->capabilities = prev->capabilities; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
149 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
150 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
151 if (conf->capabilities.nelts == 0) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
152 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
153 for (d = ngx_mail_pop3_default_capabilities; d->len; d++) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
154 c = ngx_array_push(&conf->capabilities); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
155 if (c == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
156 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
157 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
158 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
159 *c = *d; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
160 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
161 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
162 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
163 size = sizeof("+OK Capability list follows" CRLF) - 1 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
164 + sizeof("." CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
165 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
166 stls_only_size = size + sizeof("STLS" CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
167 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
168 c = conf->capabilities.elts; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 for (i = 0; i < conf->capabilities.nelts; i++) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
170 size += c[i].len + sizeof(CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
171 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
172 if (ngx_strcasecmp(c[i].data, (u_char *) "USER") == 0) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
173 continue; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
174 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
175 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
176 stls_only_size += c[i].len + sizeof(CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
177 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
178 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
179 if (conf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
180 size += sizeof("SASL LOGIN PLAIN CRAM-MD5" CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
182 } else { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 size += sizeof("SASL LOGIN PLAIN" CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
184 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
185 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
186 p = ngx_palloc(cf->pool, size); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
187 if (p == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
188 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
189 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
190 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
191 conf->capability.len = size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
192 conf->capability.data = p; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
193 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
194 p = ngx_cpymem(p, "+OK Capability list follows" CRLF, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
195 sizeof("+OK Capability list follows" CRLF) - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
196 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
197 for (i = 0; i < conf->capabilities.nelts; i++) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
198 p = ngx_cpymem(p, c[i].data, c[i].len); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
199 *p++ = CR; *p++ = LF; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
200 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
201 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
202 if (conf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
203 p = ngx_cpymem(p, "SASL LOGIN PLAIN CRAM-MD5" CRLF, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
204 sizeof("SASL LOGIN PLAIN CRAM-MD5" CRLF) - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
205 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
206 } else { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
207 p = ngx_cpymem(p, "SASL LOGIN PLAIN" CRLF, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
208 sizeof("SASL LOGIN PLAIN" CRLF) - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
209 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
210 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
211 *p++ = '.'; *p++ = CR; *p = LF; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
212 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
213 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
214 size += sizeof("STLS" CRLF) - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
215 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
216 p = ngx_palloc(cf->pool, size); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
217 if (p == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
218 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
219 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
220 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
221 conf->starttls_capability.len = size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
222 conf->starttls_capability.data = p; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
223 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
224 p = ngx_cpymem(p, conf->capability.data, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
225 conf->capability.len - (sizeof("." CRLF) - 1)); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
226 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
227 p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
228 *p++ = '.'; *p++ = CR; *p = LF; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
229 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
230 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
231 if (conf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
232 conf->auth_capability = ngx_mail_pop3_auth_cram_md5_capability; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
233 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
234 } else { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
235 conf->auth_capability = ngx_mail_pop3_auth_plain_capability; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
236 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
237 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
238 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
239 p = ngx_palloc(cf->pool, stls_only_size); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
240 if (p == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
241 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
242 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
243 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
244 conf->starttls_only_capability.len = stls_only_size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
245 conf->starttls_only_capability.data = p; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
246 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
247 p = ngx_cpymem(p, "+OK Capability list follows" CRLF, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
248 sizeof("+OK Capability list follows" CRLF) - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
249 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
250 for (i = 0; i < conf->capabilities.nelts; i++) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
251 if (ngx_strcasecmp(c[i].data, (u_char *) "USER") == 0) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
252 continue; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
253 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
254 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
255 p = ngx_cpymem(p, c[i].data, c[i].len); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
256 *p++ = CR; *p++ = LF; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
257 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
258 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
259 p = ngx_cpymem(p, "STLS" CRLF, sizeof("STLS" CRLF) - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
260 *p++ = '.'; *p++ = CR; *p = LF; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
261 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
262 return NGX_CONF_OK; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
263 } |