# HG changeset patch # User Maxim Dounin # Date 1231692816 -10800 # Node ID 573c8293ac381a2c9e09b6d4870bbc08c34a70ec # Parent 2020bf9c75ce7c7e32b47fe327f254154fc2d323 Tests: fix smtp auth plain tests to check username. diff --git a/smtp.t b/smtp.t --- a/smtp.t +++ b/smtp.t @@ -66,7 +66,9 @@ http { if ($http_auth_smtp_to ~ example.com) { set $reply OK; } - if ($http_auth_pass ~ secret) { + + set $userpass "$http_auth_user:$http_auth_pass"; + if ($userpass ~ '^test@example.com:secret$') { set $reply OK; } @@ -89,10 +91,10 @@ my $s = Test::Nginx::SMTP->new(); $s->send('EHLO example.com'); $s->check(qr/^250 /, "ehlo"); -$s->send('AUTH PLAIN ' . encode_base64("test\@example.com\0\0bad", '')); +$s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0bad", '')); $s->check(qr/^5.. /, 'auth plain with bad password'); -$s->send('AUTH PLAIN ' . encode_base64("test\@example.com\0\0secret", '')); +$s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); $s->ok('auth plain'); # We are talking to backend from this point @@ -123,13 +125,13 @@ my $s = Test::Nginx::SMTP->new(); $s->ok('pipelined rset after invalid command'); $s->send('AUTH PLAIN ' - . encode_base64("test\@example.com\0\0bad", '') . CRLF + . encode_base64("\0test\@example.com\0bad", '') . CRLF . 'MAIL FROM: SIZE=100'); $s->read(); $s->ok('mail from after failed pipelined auth'); $s->send('AUTH PLAIN ' - . encode_base64("test\@example.com\0\0secret", '') . CRLF + . encode_base64("\0test\@example.com\0secret", '') . CRLF . 'MAIL FROM: SIZE=100'); $s->read(); $s->ok('mail from after pipelined auth');