comparison mail_smtp.t @ 1111:6c2538ad642d

Tests: auth external in mail is explicitly enabled since 1.11.9.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 12 Jan 2017 19:23:14 +0300
parents b9b115a2a28d
children 766bcbb632ee
comparison
equal deleted inserted replaced
1110:b9b115a2a28d 1111:6c2538ad642d
25 select STDERR; $| = 1; 25 select STDERR; $| = 1;
26 select STDOUT; $| = 1; 26 select STDOUT; $| = 1;
27 27
28 local $SIG{PIPE} = 'IGNORE'; 28 local $SIG{PIPE} = 'IGNORE';
29 29
30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(30) 30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)
31 ->write_file_expand('nginx.conf', <<'EOF'); 31 ->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
35 daemon off; 35 daemon off;
43 xclient off; 43 xclient off;
44 44
45 server { 45 server {
46 listen 127.0.0.1:8025; 46 listen 127.0.0.1:8025;
47 protocol smtp; 47 protocol smtp;
48 smtp_auth login plain none cram-md5; 48 smtp_auth login plain none cram-md5 external;
49 } 49 }
50 } 50 }
51 51
52 http { 52 http {
53 %%TEST_GLOBALS_HTTP%% 53 %%TEST_GLOBALS_HTTP%%
88 } 88 }
89 89
90 EOF 90 EOF
91 91
92 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); 92 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon);
93 $t->run()->waitforsocket('127.0.0.1:' . port(8026)); 93 $t->try_run('no auth external')->plan(30);
94
95 $t->waitforsocket('127.0.0.1:' . port(8026));
94 96
95 ############################################################################### 97 ###############################################################################
96 98
97 my $s = Test::Nginx::SMTP->new(); 99 my $s = Test::Nginx::SMTP->new();
98 $s->check(qr/^220 /, "greeting"); 100 $s->check(qr/^220 /, "greeting");
159 $s->send('AUTH CRAM-MD5'); 161 $s->send('AUTH CRAM-MD5');
160 $s->check(qr/^334 /, 'auth cram-md5 challenge'); 162 $s->check(qr/^334 /, 'auth cram-md5 challenge');
161 $s->send(encode_base64('test@example.com ' . ('0' x 32), '')); 163 $s->send(encode_base64('test@example.com ' . ('0' x 32), ''));
162 $s->authok('auth cram-md5'); 164 $s->authok('auth cram-md5');
163 165
164 TODO: {
165 local $TODO = 'not yet' unless $t->has_version('1.11.6');
166
167 # Try auth external 166 # Try auth external
168 167
169 $s = Test::Nginx::SMTP->new(); 168 $s = Test::Nginx::SMTP->new();
170 $s->read(); 169 $s->read();
171 $s->send('EHLO example.com'); 170 $s->send('EHLO example.com');
184 $s->read(); 183 $s->read();
185 184
186 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); 185 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', ''));
187 $s->ok('auth external with username'); 186 $s->ok('auth external with username');
188 187
189 }
190
191 # Try auth plain with pipelining 188 # Try auth plain with pipelining
192 189
193 $s = Test::Nginx::SMTP->new(); 190 $s = Test::Nginx::SMTP->new();
194 $s->read(); 191 $s->read();
195 $s->send('EHLO example.com'); 192 $s->send('EHLO example.com');