Mercurial > hg > nginx-tests
annotate mail_proxy_smtp_auth.t @ 1825:3629eda94c1b
Tests: handling of EWOULDBLOCK from sysread() with IO::Socket::SSL.
With IO::Socket::SSL, when select() reports that the socket is readable,
reading from it might still fail with EWOULDBLOCK, since no application
data is available in the socket. In particular, this might happen with
TLSv1.3 when a session ticket is received after the handshake. Fix is
to explicitly check for EWOULDBLOCK errors.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 21 Mar 2023 02:57:39 +0300 |
parents | 5ac6efbe5552 |
children |
rev | line source |
---|---|
1599
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for nginx mail proxy module, the proxy_smtp_auth directive. |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 use MIME::Base64; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use lib 'lib'; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 use Test::Nginx::SMTP; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 ############################################################################### |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDERR; $| = 1; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 select STDOUT; $| = 1; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 local $SIG{PIPE} = 'IGNORE'; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/) |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 ->write_file_expand('nginx.conf', <<'EOF'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 %%TEST_GLOBALS%% |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 daemon off; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 events { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 mail { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 proxy_pass_error_message on; |
1679
74986ebee2fd
Tests: added proxy_timeout in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1599
diff
changeset
|
42 proxy_timeout 15s; |
1599
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 proxy_smtp_auth on; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 auth_http http://127.0.0.1:8080/mail/auth; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 smtp_auth login plain external; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 server { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 listen 127.0.0.1:8025; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 protocol smtp; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 server { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 listen 127.0.0.1:8027; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 protocol smtp; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 xclient off; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 http { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 %%TEST_GLOBALS_HTTP%% |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 server { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 listen 127.0.0.1:8080; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 server_name localhost; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 location = /mail/auth { |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 add_header Auth-Status OK; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 add_header Auth-Server 127.0.0.1; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 add_header Auth-Port %%PORT_8026%%; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 add_header Auth-Wait 1; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 return 204; |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 } |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 EOF |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1679
diff
changeset
|
79 $t->run()->plan(7); |
1599
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 $t->waitforsocket('127.0.0.1:' . port(8026)); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 ############################################################################### |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 # The following combinations may be sent to backend with proxy_smtp_auth on: |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 # |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 # ehlo, xclient, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 # ehlo, xclient, helo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 # ehlo, xclient, ehlo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 # helo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 # ehlo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 # |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 # Test them in order. |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 # ehlo, xclient, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 my $s = Test::Nginx::SMTP->new(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 $s->authok('ehlo, xclient, auth'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 # ehlo, xclient, helo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 $s = Test::Nginx::SMTP->new(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 $s->send('HELO example.com'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 $s->authok('ehlo, xclient, helo, auth'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 # ehlo, xclient, ehlo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 $s = Test::Nginx::SMTP->new(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 $s->send('EHLO example.com'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 $s->authok('ehlo, xclient, ehlo, auth'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 # helo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8027)); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 $s->authok('helo, auth'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 # ehlo, auth |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8027)); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 $s->send('EHLO example.com'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 $s->authok('ehlo, auth'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 # Try auth external |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 $s = Test::Nginx::SMTP->new(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 $s->send('EHLO example.com'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 $s->read(); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 $s->send('AUTH EXTERNAL'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 $s->check(qr/^334 VXNlcm5hbWU6/, 'auth external challenge'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 $s->send(encode_base64('test@example.com', '')); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 $s->check(qr/^4.. /, 'auth external no password'); |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 |
4e0644119341
Tests: proxy_smtp_auth directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 ############################################################################### |