Mercurial > hg > nginx
annotate src/mail/ngx_mail_imap_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_imap_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_imap_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_imap_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_imap_default_capabilities[] = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 ngx_string("IMAP4"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 ngx_string("IMAP4rev1"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 ngx_string("UIDPLUS"), |
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_imap_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("login"), NGX_MAIL_AUTH_LOGIN_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_imap_auth_methods_names[] = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 ngx_string("AUTH=PLAIN"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 ngx_string("AUTH=LOGIN"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 ngx_null_string, /* APOP */ |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 ngx_string("AUTH=CRAM-MD5") |
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 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 static ngx_mail_protocol_t ngx_mail_imap_protocol = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 ngx_string("imap"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 { 143, 993, 0, 0 }, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 NGX_MAIL_IMAP_PROTOCOL, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 ngx_mail_imap_init_session, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 ngx_mail_imap_init_protocol, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 ngx_mail_imap_parse_command, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
51 ngx_mail_imap_auth_state, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
52 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 ngx_string("* BAD internal server error" CRLF) |
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 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
56 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
57 static ngx_command_t ngx_mail_imap_commands[] = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
58 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
59 { ngx_string("imap_client_buffer"), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
60 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
61 ngx_conf_set_size_slot, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 NGX_MAIL_SRV_CONF_OFFSET, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
63 offsetof(ngx_mail_imap_srv_conf_t, client_buffer_size), |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
64 NULL }, |
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("imap_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_imap_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("imap_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_imap_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_imap_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_imap_module_ctx = { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
85 &ngx_mail_imap_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_imap_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_imap_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_imap_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_imap_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_imap_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_imap_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_imap_srv_conf_t *iscf; |
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 iscf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_imap_srv_conf_t)); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
117 if (iscf == 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 iscf->client_buffer_size = NGX_CONF_UNSET_SIZE; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
122 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
123 if (ngx_array_init(&iscf->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
|
124 != NGX_OK) |
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 return NULL; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
127 } |
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 return iscf; |
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 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
132 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
133 static char * |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
134 ngx_mail_imap_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
|
135 { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
136 ngx_mail_imap_srv_conf_t *prev = parent; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
137 ngx_mail_imap_srv_conf_t *conf = child; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
138 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
139 u_char *p, *auth; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
140 size_t size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
141 ngx_str_t *c, *d; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
142 ngx_uint_t i, m; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
143 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
144 ngx_conf_merge_size_value(conf->client_buffer_size, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
145 prev->client_buffer_size, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
146 (size_t) ngx_pagesize); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
147 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
148 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
|
149 prev->auth_methods, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
150 (NGX_CONF_BITMASK_SET |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
151 |NGX_MAIL_AUTH_PLAIN_ENABLED)); |
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 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
154 if (conf->capabilities.nelts == 0) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
155 conf->capabilities = prev->capabilities; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
156 } |
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 if (conf->capabilities.nelts == 0) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
159 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
160 for (d = ngx_mail_imap_default_capabilities; d->len; d++) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
161 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
|
162 if (c == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
163 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
164 } |
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 *c = *d; |
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 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
169 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
170 size = sizeof("* CAPABILITY" 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 c = conf->capabilities.elts; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
173 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
|
174 size += 1 + c[i].len; |
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 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
177 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
178 m <= 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
|
179 m <<= 1, i++) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
180 { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
181 if (m & conf->auth_methods) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
182 size += 1 + ngx_mail_imap_auth_methods_names[i].len; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 } |
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, "* CAPABILITY", sizeof("* CAPABILITY") - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
195 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
196 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
|
197 *p++ = ' '; |
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 } |
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 auth = p; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
202 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
203 for (m = NGX_MAIL_AUTH_PLAIN_ENABLED, i = 0; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
204 m <= 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
|
205 m <<= 1, i++) |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
206 { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
207 if (m & conf->auth_methods) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
208 *p++ = ' '; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
209 p = ngx_cpymem(p, ngx_mail_imap_auth_methods_names[i].data, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
210 ngx_mail_imap_auth_methods_names[i].len); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
211 } |
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 *p++ = CR; *p = LF; |
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 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
217 size += sizeof(" STARTTLS") - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
218 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
219 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
|
220 if (p == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
221 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
222 } |
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 conf->starttls_capability.len = size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
225 conf->starttls_capability.data = p; |
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, conf->capability.data, |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
228 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
|
229 p = ngx_cpymem(p, " STARTTLS", sizeof(" STARTTLS") - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
230 *p++ = CR; *p = LF; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
231 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
232 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
233 size = (auth - conf->capability.data) + sizeof(CRLF) - 1 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
234 + sizeof(" STARTTLS LOGINDISABLED") - 1; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
235 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
236 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
|
237 if (p == NULL) { |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
238 return NGX_CONF_ERROR; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
239 } |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
240 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
241 conf->starttls_only_capability.len = size; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
242 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
|
243 |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
244 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
|
245 auth - conf->capability.data); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
246 p = ngx_cpymem(p, " STARTTLS LOGINDISABLED", |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
247 sizeof(" STARTTLS LOGINDISABLED") - 1); |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
248 *p++ = CR; *p = LF; |
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 return NGX_CONF_OK; |
ed9cd1702f7a
r1477, r1478, r1479, r1480, r1481, r1482, r1483, r1484, r1485, r1486,
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
251 } |