|
|
@ -192,27 +192,27 @@ do {
|
|
|
|
($RecID, $serial, $root, $type, $variant, $date) = $sth->fetchrow_array();
|
|
|
|
($RecID, $serial, $root, $type, $variant, $date) = $sth->fetchrow_array();
|
|
|
|
|
|
|
|
|
|
|
|
if ($DoClose) {
|
|
|
|
if ($DoClose) {
|
|
|
|
socket (S, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!";
|
|
|
|
socket (S, &AF_INET, &SOCK_STREAM, 0) or die "socket: $!";
|
|
|
|
connect (S, $dest_serv_params) or die "connect: $!";
|
|
|
|
connect (S, $dest_serv_params) or die "connect: $!";
|
|
|
|
select (S); $| = 1; select (STDOUT); # Eliminate STDIO buffering
|
|
|
|
select (S); $| = 1; select (STDOUT); # Eliminate STDIO buffering
|
|
|
|
|
|
|
|
|
|
|
|
# The network connection is now open, lets fire up SSL
|
|
|
|
# The network connection is now open, lets fire up SSL
|
|
|
|
|
|
|
|
|
|
|
|
$ctx = Net::SSLeay::CTX_new() or die_now("Failed to create SSL_CTX $!");
|
|
|
|
$ctx = Net::SSLeay::CTX_new() or die_now("Failed to create SSL_CTX $!");
|
|
|
|
Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
|
|
|
|
Net::SSLeay::CTX_set_options($ctx, &Net::SSLeay::OP_ALL)
|
|
|
|
and die_if_ssl_error("ssl ctx set options");
|
|
|
|
and die_if_ssl_error("ssl ctx set options");
|
|
|
|
|
|
|
|
|
|
|
|
# Set accepted CAs
|
|
|
|
# Set accepted CAs
|
|
|
|
Net::SSLeay::CTX_load_verify_locations($ctx, $CAfile, 0);
|
|
|
|
Net::SSLeay::CTX_load_verify_locations($ctx, $CAfile, 0);
|
|
|
|
|
|
|
|
|
|
|
|
# Add client vertificate
|
|
|
|
# Add client vertificate
|
|
|
|
Net::SSLeay::set_cert_and_key($ctx, $CertFile, $KeyFile);
|
|
|
|
Net::SSLeay::set_cert_and_key($ctx, $CertFile, $KeyFile);
|
|
|
|
|
|
|
|
|
|
|
|
$ssl = Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!");
|
|
|
|
$ssl = Net::SSLeay::new($ctx) or die_now("Failed to create SSL $!");
|
|
|
|
Net::SSLeay::set_fd($ssl, fileno(S)); # Must use fileno
|
|
|
|
Net::SSLeay::set_fd($ssl, fileno(S)); # Must use fileno
|
|
|
|
$res = Net::SSLeay::connect($ssl) and die_if_ssl_error("ssl connect");
|
|
|
|
$res = Net::SSLeay::connect($ssl) and die_if_ssl_error("ssl connect");
|
|
|
|
#print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
|
|
|
|
#print "Cipher `" . Net::SSLeay::get_cipher($ssl) . "'\n";
|
|
|
|
# Still to do here. CRL/OCSP-Checking
|
|
|
|
# Still to do here. CRL/OCSP-Checking
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($RecID) {
|
|
|
|
if ($RecID) {
|
|
|
@ -227,21 +227,21 @@ do {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$RowNum += 1;
|
|
|
|
$RowNum += 1;
|
|
|
|
|
|
|
|
|
|
|
|
if ($DoClose) {
|
|
|
|
if ($DoClose) {
|
|
|
|
# Server requested closing of connection
|
|
|
|
# Server requested closing of connection
|
|
|
|
CORE::shutdown S, 1; # Half close --> No more output, sends EOF to server
|
|
|
|
CORE::shutdown S, 1; # Half close --> No more output, sends EOF to server
|
|
|
|
Net::SSLeay::free ($ssl); # Tear down connection
|
|
|
|
Net::SSLeay::free ($ssl); # Tear down connection
|
|
|
|
Net::SSLeay::CTX_free ($ctx);
|
|
|
|
Net::SSLeay::CTX_free ($ctx);
|
|
|
|
close S;
|
|
|
|
close S;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while($RecID && ($got ne "BREAK"));
|
|
|
|
} while($RecID && ($got ne "BREAK"));
|
|
|
|
|
|
|
|
|
|
|
|
if (!$DoClose) {
|
|
|
|
if (!$DoClose) {
|
|
|
|
CORE::shutdown S, 1; # Half close --> No more output, sends EOF to server
|
|
|
|
CORE::shutdown S, 1; # Half close --> No more output, sends EOF to server
|
|
|
|
Net::SSLeay::free ($ssl); # Tear down connection
|
|
|
|
Net::SSLeay::free ($ssl); # Tear down connection
|
|
|
|
Net::SSLeay::CTX_free ($ctx);
|
|
|
|
Net::SSLeay::CTX_free ($ctx);
|
|
|
|
close S;
|
|
|
|
close S;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$sth = $dbh->prepare("UPDATE `learnprogress` SET `uploaded`=1 WHERE `lp_id`=?");
|
|
|
|
$sth = $dbh->prepare("UPDATE `learnprogress` SET `uploaded`=1 WHERE `lp_id`=?");
|
|
|
|