Mercurial > hg > nginx-tests
changeset 809:ded6b7648d6e
Tests: added mail resolver test for CNAME and PTR records combined.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 17 Dec 2015 16:55:49 +0300 |
parents | f02dac68d584 |
children | a4f806eb4426 |
files | mail_resolver.t |
diffstat | 1 files changed, 38 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mail_resolver.t Thu Dec 17 16:14:28 2015 +0300 +++ b/mail_resolver.t Thu Dec 17 16:55:49 2015 +0300 @@ -81,6 +81,13 @@ protocol smtp; resolver 127.0.0.1:8086; } + + server { + listen 127.0.0.1:8032; + protocol smtp; + resolver 127.0.0.1:8087; + } + } http { @@ -107,16 +114,16 @@ EOF -for (8081 .. 8086) { +for (8081 .. 8087) { $t->run_daemon(\&dns_daemon, $_, $t); } $t->run(); -for (8081 .. 8086) { +for (8081 .. 8087) { $t->waitforfile($t->testdir . "/$_"); } -$t->plan(7); +$t->plan(8); ############################################################################### @@ -193,7 +200,7 @@ $s->read(); $s->send('RCPT TO:<test@example.com>'); -$s->ok('PTR with CNAME'); +$s->ok('CNAME'); $s->send('QUIT'); $s->read(); @@ -238,6 +245,26 @@ } +# CNAME and PTR in one answer section + +TODO: { +local $TODO = 'not yet'; + +$s = Test::Nginx::SMTP->new(PeerAddr => "127.0.0.1:8032"); +$s->read(); +$s->send('EHLO example.com'); +$s->read(); +$s->send('MAIL FROM:<test@example.com> SIZE=100'); +$s->read(); + +$s->send('RCPT TO:<test@example.com>'); +$s->ok('CNAME with PTR'); + +$s->send('QUIT'); +$s->read(); + +} + ############################################################################### sub reply_handler { @@ -306,6 +333,13 @@ } elsif ($port == 8086) { push @rdata, rd_name(DNAME, $ttl, 'a.example.net'); + } elsif ($port == 8087) { + # PTR answered with CNAME+PTR + + push @rdata, rd_name(CNAME, $ttl, + '1.1.0.0.127.in-addr.arpa'); + push @rdata, pack("n3N n(C/a*)3 x", 0xc034, + PTR, IN, $ttl, 15, ('a', 'example', 'net')); } } elsif ($name eq '1.1.0.0.127.in-addr.arpa' && $type == PTR) {