8 if ( grep { $^O =~m{$_} } qw( MacOS VOS vmesa riscos amigaos ) ) {
9 print "1..0 # Skipped: fork not implemented on this platform\n";
13 # subjectAltNames are not supported or buggy in older versions,
14 # so certificates cannot be checked
15 if ( $Net::SSLeay::VERSION < 1.33 ) {
16 print "1..0 # Skipped because of \$Net::SSLeay::VERSION= $Net::SSLeay::VERSION <1.33\n";
20 use vars qw( $SSL_SERVER_ADDR );
21 do "t/ssl_settings.req" || do "ssl_settings.req";
26 my $server = IO::Socket::SSL->new(
27 LocalAddr => $SSL_SERVER_ADDR,
31 SSL_ca_file => "certs/test-ca.pem",
32 SSL_cert_file => "certs/server-wildcard.pem",
33 SSL_key_file => "certs/server-wildcard.pem",
35 warn "\$!=$!, \$\@=$@, S\$SSL_ERROR=$SSL_ERROR" if ! $server;
36 print "not ok\n", exit if !$server;
37 ok("Server Initialization");
38 my $SSL_SERVER_PORT = $server->sockport;
40 defined( my $pid = fork() ) || die $!;
43 my $csock = $server->accept || next;
44 print $csock "hallo\n";
53 bla.server.local www OK
54 www7.other.local www OK
55 www7.other.local ldap FAIL
56 bla.server.local ldap OK
59 for( my $i=0;$i<@tests;$i+=3 ) {
60 my ($name,$scheme,$result) = @tests[$i,$i+1,$i+2];
61 my $cl = IO::Socket::SSL->new(
62 SSL_ca_file => 'certs/test-ca.pem',
63 PeerAddr => "$SSL_SERVER_ADDR:$SSL_SERVER_PORT",
65 SSL_verifycn_scheme => $scheme,
66 SSL_verifycn_name => $name,
68 if ( $result eq 'FAIL' ) {
70 ok( "connection to $name/$scheme failed" );
73 ok( "connection to $name/$scheme succeeded" );
76 print "not " if <$cl> ne "hallo\n";
77 ok( "received hallo" );
80 for( my $i=0;$i<@tests;$i+=3 ) {
81 my ($name,$scheme,$result) = @tests[$i,$i+1,$i+2];
82 my $cl = IO::Socket::INET->new(
83 PeerAddr => "$SSL_SERVER_ADDR:$SSL_SERVER_PORT",
86 $cl = IO::Socket::SSL->start_SSL( $cl,
87 SSL_ca_file => 'certs/test-ca.pem',
89 SSL_verifycn_scheme => $scheme,
90 SSL_verifycn_name => $name,
92 if ( $result eq 'FAIL' ) {
94 ok( "ssl upgrade of connection to $name/$scheme failed" );
97 ok( "ssl upgrade of connection to $name/$scheme succeeded" );
100 print "not " if <$cl> ne "hallo\n";
101 ok( "received hallo" );
107 sub ok { print "ok #$_[0]\n"; }