use strict;
use warnings;
-use File::Spec;
-
-#***************************************************************************
-# Global symbols allowed without explicit package name
-#
-use vars qw(
- @EXPORT_OK
- $sshdexe
- $sshexe
- $sftpsrvexe
- $sftpexe
- $sshkeygenexe
- $httptlssrvexe
- $sshdconfig
- $sshconfig
- $sftpconfig
- $knownhosts
- $sshdlog
- $sshlog
- $sftplog
- $sftpcmds
- $hstprvkeyf
- $hstpubkeyf
- $hstpubmd5f
- $hstpubsha256f
- $cliprvkeyf
- $clipubkeyf
- @sftppath
- @httptlssrvpath
+BEGIN {
+ use base qw(Exporter);
+
+ our @EXPORT_OK = qw(
+ $sshdexe
+ $sshexe
+ $sftpsrvexe
+ $sftpexe
+ $sshkeygenexe
+ $sshdconfig
+ $sshconfig
+ $sftpconfig
+ $knownhosts
+ $sshdlog
+ $sshlog
+ $sftplog
+ $sftpcmds
+ $hstprvkeyf
+ $hstpubkeyf
+ $hstpubmd5f
+ $hstpubsha256f
+ $cliprvkeyf
+ $clipubkeyf
+ display_sshdconfig
+ display_sshconfig
+ display_sftpconfig
+ display_sshdlog
+ display_sshlog
+ display_sftplog
+ dump_array
+ find_sshd
+ find_ssh
+ find_sftpsrv
+ find_sftp
+ find_sshkeygen
+ find_httptlssrv
+ logmsg
+ sshversioninfo
);
+}
+use File::Spec;
-#***************************************************************************
-# Inherit Exporter's capabilities
-#
-use base qw(Exporter);
-
-
-#***************************************************************************
-# Global symbols this module will export upon request
-#
-@EXPORT_OK = qw(
- $sshdexe
- $sshexe
- $sftpsrvexe
- $sftpexe
- $sshkeygenexe
- $sshdconfig
- $sshconfig
- $sftpconfig
- $knownhosts
- $sshdlog
- $sshlog
- $sftplog
- $sftpcmds
- $hstprvkeyf
- $hstpubkeyf
- $hstpubmd5f
- $hstpubsha256f
- $cliprvkeyf
- $clipubkeyf
- display_sshdconfig
- display_sshconfig
- display_sftpconfig
- display_sshdlog
- display_sshlog
- display_sftplog
- dump_array
+use pathhelp qw(
exe_ext
- find_sshd
- find_ssh
- find_sftpsrv
- find_sftp
- find_sshkeygen
- find_httptlssrv
- logmsg
- sshversioninfo
);
-
#***************************************************************************
# Global variables initialization
#
-$sshdexe = 'sshd' .exe_ext('SSH'); # base name and ext of ssh daemon
-$sshexe = 'ssh' .exe_ext('SSH'); # base name and ext of ssh client
-$sftpsrvexe = 'sftp-server' .exe_ext('SSH'); # base name and ext of sftp-server
-$sftpexe = 'sftp' .exe_ext('SSH'); # base name and ext of sftp client
-$sshkeygenexe = 'ssh-keygen' .exe_ext('SSH'); # base name and ext of ssh-keygen
-$httptlssrvexe = 'gnutls-serv' .exe_ext('SSH'); # 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_rsa_key'; # host private key file
-$hstpubkeyf = 'curl_host_rsa_key.pub'; # host public key file
-$hstpubmd5f = 'curl_host_rsa_key.pub_md5'; # md5 hash of host public key
-$hstpubsha256f = 'curl_host_rsa_key.pub_sha256'; # sha256 hash of host public key
-$cliprvkeyf = 'curl_client_key'; # client private key file
-$clipubkeyf = 'curl_client_key.pub'; # client public key file
+our $sshdexe = 'sshd' .exe_ext('SSH'); # base name and ext of ssh daemon
+our $sshexe = 'ssh' .exe_ext('SSH'); # base name and ext of ssh client
+our $sftpsrvexe = 'sftp-server' .exe_ext('SSH'); # base name and ext of sftp-server
+our $sftpexe = 'sftp' .exe_ext('SSH'); # base name and ext of sftp client
+our $sshkeygenexe = 'ssh-keygen' .exe_ext('SSH'); # base name and ext of ssh-keygen
+our $httptlssrvexe = 'gnutls-serv' .exe_ext('SSH'); # base name and ext of gnutls-serv
+our $sshdconfig = 'curl_sshd_config'; # ssh daemon config file
+our $sshconfig = 'curl_ssh_config'; # ssh client config file
+our $sftpconfig = 'curl_sftp_config'; # sftp client config file
+our $sshdlog = undef; # ssh daemon log file
+our $sshlog = undef; # ssh client log file
+our $sftplog = undef; # sftp client log file
+our $sftpcmds = 'curl_sftp_cmds'; # sftp client commands batch file
+our $knownhosts = 'curl_client_knownhosts'; # ssh knownhosts file
+our $hstprvkeyf = 'curl_host_rsa_key'; # host private key file
+our $hstpubkeyf = 'curl_host_rsa_key.pub'; # host public key file
+our $hstpubmd5f = 'curl_host_rsa_key.pub_md5'; # md5 hash of host public key
+our $hstpubsha256f = 'curl_host_rsa_key.pub_sha256'; # sha256 hash of host public key
+our $cliprvkeyf = 'curl_client_key'; # client private key file
+our $clipubkeyf = 'curl_client_key.pub'; # client public key file
#***************************************************************************
# Absolute paths where to look for sftp-server plugin, when not in PATH
#
-@sftppath = qw(
+our @sftppath = qw(
/usr/lib/openssh
/usr/libexec/openssh
/usr/libexec
#***************************************************************************
# Absolute paths where to look for httptlssrv (gnutls-serv), when not in PATH
#
-@httptlssrvpath = qw(
+our @httptlssrvpath = qw(
/usr/sbin
/usr/libexec
/usr/lib
);
-#***************************************************************************
-# Return file extension for executable files on this operating system
-#
-sub exe_ext {
- my ($component, @arr) = @_;
- if ($ENV{'CURL_TEST_EXE_EXT'}) {
- return $ENV{'CURL_TEST_EXE_EXT'};
- }
- if ($ENV{'CURL_TEST_EXE_EXT_'.$component}) {
- return $ENV{'CURL_TEST_EXE_EXT_'.$component};
- }
- if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' ||
- $^O eq 'dos' || $^O eq 'os2') {
- return '.exe';
- }
-}
-
-
#***************************************************************************
# Create or overwrite the given file with lines from an array of strings
#