8 print "1..0 # Skipped: test cert has expired\n";
11 if ( grep { $^O =~m{$_} } qw( MacOS VOS vmesa riscos amigaos ) ) {
12 print "1..0 # Skipped: fork not implemented on this platform\n";
16 # subjectAltNames are not supported or buggy in older versions,
17 # so certificates cannot be checked
18 if ( $Net::SSLeay::VERSION < 1.33 ) {
19 print "1..0 # Skipped because of \$Net::SSLeay::VERSION= $Net::SSLeay::VERSION <1.33\n";
23 use vars qw( $SSL_SERVER_ADDR );
24 do "t/ssl_settings.req" || do "ssl_settings.req";
29 my $server = IO::Socket::SSL->new(
30 LocalAddr => $SSL_SERVER_ADDR,
34 SSL_ca_file => "certs/test-ca.pem",
35 SSL_cert_file => "certs/server-wildcard.pem",
36 SSL_key_file => "certs/server-wildcard.pem",
38 warn "\$!=$!, \$\@=$@, S\$SSL_ERROR=$SSL_ERROR" if ! $server;
39 print "not ok\n", exit if !$server;
40 ok("Server Initialization");
41 my $SSL_SERVER_PORT = $server->sockport;
43 defined( my $pid = fork() ) || die $!;
46 my $csock = $server->accept || next;
47 print $csock "hallo\n";
56 bla.server.local www OK
57 www7.other.local www OK
58 www7.other.local ldap FAIL
59 bla.server.local ldap OK
62 for( my $i=0;$i<@tests;$i+=3 ) {
63 my ($name,$scheme,$result) = @tests[$i,$i+1,$i+2];
64 my $cl = IO::Socket::SSL->new(
65 SSL_ca_file => 'certs/test-ca.pem',
66 PeerAddr => "$SSL_SERVER_ADDR:$SSL_SERVER_PORT",
68 SSL_verifycn_scheme => $scheme,
69 SSL_verifycn_name => $name,
71 if ( $result eq 'FAIL' ) {
73 ok( "connection to $name/$scheme failed" );
76 ok( "connection to $name/$scheme succeeded" );
79 print "not " if <$cl> ne "hallo\n";
80 ok( "received hallo" );
83 for( my $i=0;$i<@tests;$i+=3 ) {
84 my ($name,$scheme,$result) = @tests[$i,$i+1,$i+2];
85 my $cl = IO::Socket::INET->new(
86 PeerAddr => "$SSL_SERVER_ADDR:$SSL_SERVER_PORT",
89 $cl = IO::Socket::SSL->start_SSL( $cl,
90 SSL_ca_file => 'certs/test-ca.pem',
92 SSL_verifycn_scheme => $scheme,
93 SSL_verifycn_name => $name,
95 if ( $result eq 'FAIL' ) {
97 ok( "ssl upgrade of connection to $name/$scheme failed" );
100 ok( "ssl upgrade of connection to $name/$scheme succeeded" );
103 print "not " if <$cl> ne "hallo\n";
104 ok( "received hallo" );
110 sub ok { print "ok #$_[0]\n"; }