File: dnsbl

package info (click to toggle)
qpsmtpd 0.40-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,024 kB
  • ctags: 393
  • sloc: perl: 6,462; sh: 383; makefile: 54
file content (27 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

sub register_tests {
    my $self = shift;
    $self->register_test("test_local", 1);
    $self->register_test("test_returnval", 1);
}

sub test_local {
    my $self = shift;
    
    my $connection = $self->qp->connection;
    $connection->remote_ip('127.0.0.2'); # standard dnsbl test value
    
    $self->hook_connect($self->qp->transaction);
    
    ok($self->qp->connection->notes('dnsbl_sockets'));
}

sub test_returnval {
    my $self = shift;

    my $address = Qpsmtpd::Address->parse('<rcpt@example.com>');
    my ($ret, $note) = $self->hook_rcpt($self->qp->transaction,
      $address);
    is($ret, DENY, "Check we got a DENY");
    print("# dnsbl result: $note\n");
}