mirror of
https://github.com/OldUnreal/curl.git
synced 2026-04-02 21:39:41 -07:00
test harness: non-stunnel https server integration overhaul
This commit is contained in:
@@ -158,7 +158,8 @@ rtsp-ipv6
|
||||
imap
|
||||
pop3
|
||||
smtp
|
||||
http+tls-srp
|
||||
httptls+srp
|
||||
httptls+srp-ipv6
|
||||
|
||||
Give only one per line. This subsection is mandatory.
|
||||
</server>
|
||||
@@ -183,6 +184,7 @@ SSL
|
||||
socks
|
||||
unittest
|
||||
debug
|
||||
TLS-SRP
|
||||
|
||||
as well as each protocol that curl supports. A protocol only needs to be
|
||||
specified if it is different from the server (useful when the server
|
||||
|
||||
@@ -41,7 +41,7 @@ Accept: */*
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http+tls-srp
|
||||
httptls+srp
|
||||
</server>
|
||||
<features>
|
||||
TLS-SRP
|
||||
|
||||
@@ -10,7 +10,7 @@ FAILURE
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http+tls-srp
|
||||
httptls+srp
|
||||
</server>
|
||||
<features>
|
||||
TLS-SRP
|
||||
|
||||
@@ -10,7 +10,7 @@ FAILURE
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http+tls-srp
|
||||
httptls+srp
|
||||
</server>
|
||||
<features>
|
||||
TLS-SRP
|
||||
|
||||
@@ -10,7 +10,7 @@ FAILURE
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http+tls-srp
|
||||
httptls+srp
|
||||
</server>
|
||||
<features>
|
||||
TLS-SRP
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@@ -62,6 +62,13 @@ use vars qw(
|
||||
);
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Just for convenience, test harness uses 'https' and 'httptls' literals as
|
||||
# values for 'proto' variable in order to differentiate different servers.
|
||||
# 'https' literal is used for stunnel based https test servers, and 'httptls'
|
||||
# is used for non-stunnel https test servers.
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Return server characterization factors given a server id string.
|
||||
#
|
||||
@@ -71,18 +78,20 @@ sub serverfactors {
|
||||
my $ipvnum;
|
||||
my $idnum;
|
||||
|
||||
if($server =~ /^((ftp|http|imap|pop3|smtp)s?)(\d*)(-ipv6|)$/) {
|
||||
if($server =~
|
||||
/^((ftp|http|imap|pop3|smtp)s?)(\d*)(-ipv6|)$/) {
|
||||
$proto = $1;
|
||||
$idnum = ($3 && ($3 > 1)) ? $3 : 1;
|
||||
$ipvnum = ($4 && ($4 =~ /6$/)) ? 6 : 4;
|
||||
}
|
||||
elsif($server =~ /^(tftp|sftp|socks|ssh|rtsp)(\d*)(-ipv6|)$/) {
|
||||
elsif($server =~
|
||||
/^(tftp|sftp|socks|ssh|rtsp|gopher|httptls)(\d*)(-ipv6|)$/) {
|
||||
$proto = $1;
|
||||
$idnum = ($2 && ($2 > 1)) ? $2 : 1;
|
||||
$ipvnum = ($3 && ($3 =~ /6$/)) ? 6 : 4;
|
||||
}
|
||||
else {
|
||||
die "invalid server id: $server"
|
||||
die "invalid server id: '$server'"
|
||||
}
|
||||
return($proto, $ipvnum, $idnum);
|
||||
}
|
||||
@@ -95,16 +104,16 @@ sub servername_str {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
|
||||
$proto = uc($proto) if($proto);
|
||||
die "unsupported protocol: $proto" unless($proto &&
|
||||
($proto =~ /^(((FTP|HTTP|IMAP|POP3|SMTP)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|GOPHER|HTTP\+TLS-SRP))$/));
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
($proto =~ /^(((FTP|HTTP|IMAP|POP3|SMTP)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|GOPHER|HTTPTLS))$/));
|
||||
|
||||
$ipver = (not $ipver) ? 'ipv4' : lc($ipver);
|
||||
die "unsupported IP version: $ipver" unless($ipver &&
|
||||
die "unsupported IP version: '$ipver'" unless($ipver &&
|
||||
($ipver =~ /^(4|6|ipv4|ipv6|-ipv4|-ipv6)$/));
|
||||
$ipver = ($ipver =~ /6$/) ? '-IPv6' : '';
|
||||
|
||||
$idnum = 1 if(not $idnum);
|
||||
die "unsupported ID number: $idnum" unless($idnum &&
|
||||
die "unsupported ID number: '$idnum'" unless($idnum &&
|
||||
($idnum =~ /^(\d+)$/));
|
||||
$idnum = '' unless($idnum > 1);
|
||||
|
||||
@@ -188,7 +197,7 @@ sub server_outputfilename {
|
||||
#
|
||||
sub mainsockf_pidfilename {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
die "unsupported protocol: $proto" unless($proto &&
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
|
||||
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid':'_sockfilt.pid';
|
||||
return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
@@ -200,7 +209,7 @@ sub mainsockf_pidfilename {
|
||||
#
|
||||
sub mainsockf_logfilename {
|
||||
my ($logdir, $proto, $ipver, $idnum) = @_;
|
||||
die "unsupported protocol: $proto" unless($proto &&
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
(lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
|
||||
my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log':'_sockfilt.log';
|
||||
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
@@ -212,7 +221,7 @@ sub mainsockf_logfilename {
|
||||
#
|
||||
sub datasockf_pidfilename {
|
||||
my ($proto, $ipver, $idnum) = @_;
|
||||
die "unsupported protocol: $proto" unless($proto &&
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
(lc($proto) =~ /^ftps?$/));
|
||||
my $trailer = '_sockdata.pid';
|
||||
return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
@@ -224,7 +233,7 @@ sub datasockf_pidfilename {
|
||||
#
|
||||
sub datasockf_logfilename {
|
||||
my ($logdir, $proto, $ipver, $idnum) = @_;
|
||||
die "unsupported protocol: $proto" unless($proto &&
|
||||
die "unsupported protocol: '$proto'" unless($proto &&
|
||||
(lc($proto) =~ /^ftps?$/));
|
||||
my $trailer = '_sockdata.log';
|
||||
return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
|
||||
|
||||
117
tests/sshhelp.pm
117
tests/sshhelp.pm
@@ -39,6 +39,7 @@ use vars qw(
|
||||
$sftpsrvexe
|
||||
$sftpexe
|
||||
$sshkeygenexe
|
||||
$httptlssrvexe
|
||||
$sshdconfig
|
||||
$sshconfig
|
||||
$sftpconfig
|
||||
@@ -52,6 +53,7 @@ use vars qw(
|
||||
$cliprvkeyf
|
||||
$clipubkeyf
|
||||
@sftppath
|
||||
@httptlssrvpath
|
||||
);
|
||||
|
||||
|
||||
@@ -95,7 +97,7 @@ use vars qw(
|
||||
find_sftpsrv
|
||||
find_sftp
|
||||
find_sshkeygen
|
||||
find_gnutls_serv
|
||||
find_httptlssrv
|
||||
logmsg
|
||||
sshversioninfo
|
||||
);
|
||||
@@ -104,27 +106,28 @@ use vars qw(
|
||||
#***************************************************************************
|
||||
# Global variables initialization
|
||||
#
|
||||
$sshdexe = 'sshd' .exe_ext(); # base name and ext of ssh daemon
|
||||
$sshexe = 'ssh' .exe_ext(); # base name and ext of ssh client
|
||||
$sftpsrvexe = 'sftp-server' .exe_ext(); # base name and ext of sftp-server
|
||||
$sftpexe = 'sftp' .exe_ext(); # base name and ext of sftp client
|
||||
$sshkeygenexe = 'ssh-keygen' .exe_ext(); # base name and ext of ssh-keygen
|
||||
$sshdconfig = 'curl_sshd_config'; # ssh daemon config file
|
||||
$sshconfig = 'curl_ssh_config'; # ssh client config file
|
||||
$sftpconfig = 'curl_sftp_config'; # sftp client config file
|
||||
$sshdlog = undef; # ssh daemon log file
|
||||
$sshlog = undef; # ssh client log file
|
||||
$sftplog = undef; # sftp client log file
|
||||
$sftpcmds = 'curl_sftp_cmds'; # sftp client commands batch file
|
||||
$knownhosts = 'curl_client_knownhosts'; # ssh knownhosts file
|
||||
$hstprvkeyf = 'curl_host_dsa_key'; # host private key file
|
||||
$hstpubkeyf = 'curl_host_dsa_key.pub'; # host public key file
|
||||
$cliprvkeyf = 'curl_client_key'; # client private key file
|
||||
$clipubkeyf = 'curl_client_key.pub'; # client public key file
|
||||
$sshdexe = 'sshd' .exe_ext(); # base name and ext of ssh daemon
|
||||
$sshexe = 'ssh' .exe_ext(); # base name and ext of ssh client
|
||||
$sftpsrvexe = 'sftp-server' .exe_ext(); # base name and ext of sftp-server
|
||||
$sftpexe = 'sftp' .exe_ext(); # base name and ext of sftp client
|
||||
$sshkeygenexe = 'ssh-keygen' .exe_ext(); # base name and ext of ssh-keygen
|
||||
$httptlssrvexe = 'gnutls-serv' .exe_ext(); # base name and ext of gnutls-serv
|
||||
$sshdconfig = 'curl_sshd_config'; # ssh daemon config file
|
||||
$sshconfig = 'curl_ssh_config'; # ssh client config file
|
||||
$sftpconfig = 'curl_sftp_config'; # sftp client config file
|
||||
$sshdlog = undef; # ssh daemon log file
|
||||
$sshlog = undef; # ssh client log file
|
||||
$sftplog = undef; # sftp client log file
|
||||
$sftpcmds = 'curl_sftp_cmds'; # sftp client commands batch file
|
||||
$knownhosts = 'curl_client_knownhosts'; # ssh knownhosts file
|
||||
$hstprvkeyf = 'curl_host_dsa_key'; # host private key file
|
||||
$hstpubkeyf = 'curl_host_dsa_key.pub'; # host public key file
|
||||
$cliprvkeyf = 'curl_client_key'; # client private key file
|
||||
$clipubkeyf = 'curl_client_key.pub'; # client public key file
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Absolute paths where to look for sftp-server plugin
|
||||
# Absolute paths where to look for sftp-server plugin, when not in PATH
|
||||
#
|
||||
@sftppath = qw(
|
||||
/usr/lib/openssh
|
||||
@@ -149,6 +152,30 @@ $clipubkeyf = 'curl_client_key.pub'; # client public key file
|
||||
);
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Absolute paths where to look for httptlssrv (gnutls-serv), when not in PATH
|
||||
#
|
||||
@httptlssrvpath = qw(
|
||||
/usr/sbin
|
||||
/usr/libexec
|
||||
/usr/lib
|
||||
/usr/lib/misc
|
||||
/usr/lib64/misc
|
||||
/usr/local/bin
|
||||
/usr/local/sbin
|
||||
/usr/local/libexec
|
||||
/opt/local/bin
|
||||
/opt/local/sbin
|
||||
/opt/local/libexec
|
||||
/usr/freeware/bin
|
||||
/usr/freeware/sbin
|
||||
/usr/freeware/libexec
|
||||
/opt/gnutls/bin
|
||||
/opt/gnutls/sbin
|
||||
/opt/gnutls/libexec
|
||||
);
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Return file extension for executable files on this operating system
|
||||
#
|
||||
@@ -273,17 +300,35 @@ sub find_file {
|
||||
my @path = @_;
|
||||
foreach (@path) {
|
||||
my $file = File::Spec->catfile($_, $fn);
|
||||
if(-e $file) {
|
||||
if(-e $file && ! -d $file) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Find an executable file somewhere in the given path
|
||||
#
|
||||
sub find_exe_file {
|
||||
my $fn = $_[0];
|
||||
shift;
|
||||
my @path = @_;
|
||||
my $xext = exe_ext();
|
||||
foreach (@path) {
|
||||
my $file = File::Spec->catfile($_, $fn);
|
||||
if(-e $file && ! -d $file) {
|
||||
return $file if(-x $file);
|
||||
return $file if(($xext) && (lc($file) =~ /\Q$xext\E$/));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Find a file in environment path or in our sftppath
|
||||
#
|
||||
sub find_sfile {
|
||||
sub find_file_spath {
|
||||
my $filename = $_[0];
|
||||
my @spath;
|
||||
push(@spath, File::Spec->path());
|
||||
@@ -291,18 +336,24 @@ sub find_sfile {
|
||||
return find_file($filename, @spath);
|
||||
}
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Find gnutls-serv and return canonical filename
|
||||
# Find an executable file in environment path or in our httptlssrvpath
|
||||
#
|
||||
sub find_gnutls_serv {
|
||||
return find_file("gnutls-serv", split(':', $ENV{PATH}));
|
||||
sub find_exe_file_hpath {
|
||||
my $filename = $_[0];
|
||||
my @hpath;
|
||||
push(@hpath, File::Spec->path());
|
||||
push(@hpath, @httptlssrvpath);
|
||||
return find_exe_file($filename, @hpath);
|
||||
}
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Find ssh daemon and return canonical filename
|
||||
#
|
||||
sub find_sshd {
|
||||
return find_sfile($sshdexe);
|
||||
return find_file_spath($sshdexe);
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +361,7 @@ sub find_sshd {
|
||||
# Find ssh client and return canonical filename
|
||||
#
|
||||
sub find_ssh {
|
||||
return find_sfile($sshexe);
|
||||
return find_file_spath($sshexe);
|
||||
}
|
||||
|
||||
|
||||
@@ -318,7 +369,7 @@ sub find_ssh {
|
||||
# Find sftp-server plugin and return canonical filename
|
||||
#
|
||||
sub find_sftpsrv {
|
||||
return find_sfile($sftpsrvexe);
|
||||
return find_file_spath($sftpsrvexe);
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +377,7 @@ sub find_sftpsrv {
|
||||
# Find sftp client and return canonical filename
|
||||
#
|
||||
sub find_sftp {
|
||||
return find_sfile($sftpexe);
|
||||
return find_file_spath($sftpexe);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +385,15 @@ sub find_sftp {
|
||||
# Find ssh-keygen and return canonical filename
|
||||
#
|
||||
sub find_sshkeygen {
|
||||
return find_sfile($sshkeygenexe);
|
||||
return find_file_spath($sshkeygenexe);
|
||||
}
|
||||
|
||||
|
||||
#***************************************************************************
|
||||
# Find httptlssrv (gnutls-serv) and return canonical filename
|
||||
#
|
||||
sub find_httptlssrv {
|
||||
return find_exe_file_hpath($httptlssrvexe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user