tests: move server config files under the pid dir

These files are generated by the test servers and must therefore be
found in the log directory to make them available to only those servers
once multiple test runners are executing in parallel. They must also not
be deleted with the log files, so they are stored in the pidfile
directory.

Ref: #10818
Closes #10875
This commit is contained in:
Dan Fandrich 2023-03-30 21:32:17 -07:00
parent 1cffced9c5
commit 70d2fca2f6
56 changed files with 158 additions and 125 deletions

View File

@ -24,7 +24,7 @@ perl %SRCDIR/libtest/test613.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP with --remote-time
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/rofile.txt --insecure --remote-time
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/rofile.txt --insecure --remote-time
</command>
<postcheck>
perl %SRCDIR/libtest/test613.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir && \

View File

@ -30,7 +30,7 @@ sftp
TFTP RRQ followed by SFTP retrieval followed by FILE followed by SCP retrieval then again in reverse order
</name>
<command option="no-include">
--key curl_client_key --pubkey curl_client_key.pub -u %USER: tftp://%HOSTIP:%TFTPPORT//%TESTNUMBER sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.txt file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.txt file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.txt tftp://%HOSTIP:%TFTPPORT//%TESTNUMBER --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: tftp://%HOSTIP:%TFTPPORT//%TESTNUMBER sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.txt file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.txt file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.txt tftp://%HOSTIP:%TFTPPORT//%TESTNUMBER --insecure
</command>
<file name="%LOGDIR/test%TESTNUMBER.txt">
This is test data

View File

@ -28,7 +28,7 @@ sftp
SFTP correct sha256 host key
</name>
<command>
--hostpubsha256 %SSHSRVSHA256 --key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
--hostpubsha256 %SSHSRVSHA256 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
</command>
<setenv>
# Needed for MSYS2 to not treat the argument as a POSIX path list

View File

@ -28,7 +28,7 @@ scp
SCP correct sha256 host key
</name>
<command>
--hostpubsha256 %SSHSRVSHA256 --key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
--hostpubsha256 %SSHSRVSHA256 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
</command>
<setenv>
# Needed for MSYS2 to not treat the argument as a POSIX path list

View File

@ -24,7 +24,7 @@ lib%TESTNUMBER
SFTP upload using multi interface
</name>
<command>
Sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload%TESTNUMBER.txt %PWD/%LOGDIR/file%TESTNUMBER.txt %USER:
Sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload%TESTNUMBER.txt %PWD/%LOGDIR/file%TESTNUMBER.txt %USER: %LOGDIR/server/curl_client_key.pub %LOGDIR/server/curl_client_key
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Moooooooooooo

View File

@ -29,7 +29,7 @@ SFTP with multi interface, remove handle early
# name resolve will cause it to return rather quickly and thus we could trigger
# the problem we're looking to verify.
<command>
sftp://localhost:%SSHPORT%SSH_PWD/%LOGDIR/upload%TESTNUMBER.txt %USER:
sftp://localhost:%SSHPORT%SSH_PWD/%LOGDIR/upload%TESTNUMBER.txt %USER: %LOGDIR/server/curl_client_key.pub %LOGDIR/server/curl_client_key
</command>
</client>

View File

@ -24,7 +24,7 @@ sftp
SFTP retrieval
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -24,7 +24,7 @@ scp
SCP retrieval
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -21,7 +21,7 @@ sftp
SFTP put
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload.%TESTNUMBER --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload.%TESTNUMBER --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -21,7 +21,7 @@ scp
SCP upload
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload.%TESTNUMBER --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload.%TESTNUMBER --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -16,7 +16,7 @@ sftp
SFTP retrieval of nonexistent file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
</command>
</client>

View File

@ -16,7 +16,7 @@ scp
SCP retrieval of nonexistent file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
</command>
</client>

View File

@ -16,7 +16,7 @@ sftp
SFTP invalid user login
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u not-a-valid-user: sftp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u not-a-valid-user: sftp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
</command>
</client>

View File

@ -16,7 +16,7 @@ scp
SCP invalid user login
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u not-a-valid-user: scp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u not-a-valid-user: scp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure
</command>
</client>

View File

@ -24,7 +24,7 @@ sftp
SFTP post-quote rename
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "-rename %PWD/%LOGDIR/file%TESTNUMBER.txt %PWD/%LOGDIR/file%TESTNUMBER-renamed.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "-rename %PWD/%LOGDIR/file%TESTNUMBER.txt %PWD/%LOGDIR/file%TESTNUMBER-renamed.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
# Verify that the file was renamed properly, then rename the file back to what
# it was so the verify section works and the file can be cleaned up.

View File

@ -25,7 +25,7 @@ sftp
SFTP post-quote mkdir failure
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "-mkdir %PWD/%LOGDIR/file%TESTNUMBER.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "-mkdir %PWD/%LOGDIR/file%TESTNUMBER.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test file for mkdir test

View File

@ -27,7 +27,7 @@ perl %SRCDIR/libtest/test%TESTNUMBER.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rmdir
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "-rmdir %PWD/%LOGDIR/test%TESTNUMBER.dir" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "-rmdir %PWD/%LOGDIR/test%TESTNUMBER.dir" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test%TESTNUMBER.pl gone %PWD/%LOGDIR/test%TESTNUMBER.dir

View File

@ -27,7 +27,7 @@ perl %SRCDIR/libtest/test610.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rename
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "-rename %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/test%TESTNUMBER.new" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "-rename %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/test%TESTNUMBER.new" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl rmdir %PWD/%LOGDIR/test%TESTNUMBER.new

View File

@ -24,7 +24,7 @@ sftp
SFTP post-quote remove file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt -Q "-rm %PWD/%LOGDIR/file%TESTNUMBER.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload.%TESTNUMBER --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt -Q "-rm %PWD/%LOGDIR/file%TESTNUMBER.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/upload.%TESTNUMBER --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl gone %PWD/%LOGDIR/test%TESTNUMBER.txt

View File

@ -29,7 +29,7 @@ perl %SRCDIR/libtest/test%TESTNUMBER.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP directory retrieval
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/ --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/ --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test%TESTNUMBER.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/curl%TESTNUMBER.out

View File

@ -30,7 +30,7 @@ perl %SRCDIR/libtest/test613.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP pre-quote chmod
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "chmod 444 %PWD/%LOGDIR/test%TESTNUMBER.dir/plainfile.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/ --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "chmod 444 %PWD/%LOGDIR/test%TESTNUMBER.dir/plainfile.txt" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/ --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test613.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/curl%TESTNUMBER.out

View File

@ -20,7 +20,7 @@ perl %SRCDIR/libtest/test613.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP put remote failure
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/rofile.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/rofile.txt --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test613.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir

View File

@ -23,7 +23,7 @@ sftp
SFTP retrieval of empty file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
</file>

View File

@ -23,7 +23,7 @@ scp
SCP retrieval of empty file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
</file>

View File

@ -15,7 +15,7 @@ sftp
SFTP retrieval of two files
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -15,7 +15,7 @@ scp
SCP retrieval of two files
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -16,7 +16,7 @@ sftp
SFTP retrieval of missing file followed by good file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/not-a-valid-file-moooo sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/not-a-valid-file-moooo sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -16,7 +16,7 @@ scp
SCP retrieval of missing file followed by good file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/not-a-valid-file-moooo scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/not-a-valid-file-moooo scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -22,7 +22,7 @@ sftp
SFTP put failure
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/nonexistent-directory/nonexistent-file --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/nonexistent-directory/nonexistent-file --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -22,7 +22,7 @@ scp
SCP upload failure
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/nonexistent-directory/nonexistent-file --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/nonexistent-directory/nonexistent-file --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -22,7 +22,7 @@ sftp
SFTP put with --ftp-create-dirs
</name>
<command>
--ftp-create-dirs --key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/upload.%TESTNUMBER --insecure
--ftp-create-dirs --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.dir/upload.%TESTNUMBER --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl move %PWD/%LOGDIR/test%TESTNUMBER.dir/upload.%TESTNUMBER %PWD/%LOGDIR/upload.%TESTNUMBER rmdir %PWD/%LOGDIR/test%TESTNUMBER.dir

View File

@ -22,7 +22,7 @@ sftp
SFTP put with --ftp-create-dirs twice
</name>
<command>
--ftp-create-dirs --key curl_client_key --pubkey curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.a/upload.%TESTNUMBER -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.b/upload.%TESTNUMBER --insecure
--ftp-create-dirs --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.a/upload.%TESTNUMBER -T %LOGDIR/file%TESTNUMBER.txt sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/test%TESTNUMBER.b/upload.%TESTNUMBER --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl move %PWD/%LOGDIR/test%TESTNUMBER.a/upload.%TESTNUMBER %PWD/%LOGDIR/upload.%TESTNUMBER rmdir %PWD/%LOGDIR/test%TESTNUMBER.a rm %PWD/%LOGDIR/test%TESTNUMBER.b/upload.%TESTNUMBER rmdir %PWD/%LOGDIR/test%TESTNUMBER.b

View File

@ -22,7 +22,7 @@ sftp
SFTP invalid quote command
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "invalid-command foo bar" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "invalid-command foo bar" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test file for rename test

View File

@ -24,7 +24,7 @@ sftp
SFTP quote remove file with NOBODY
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -I -Q "rm %PWD/%LOGDIR/file%TESTNUMBER.txt" sftp://%HOSTIP:%SSHPORT --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -I -Q "rm %PWD/%LOGDIR/file%TESTNUMBER.txt" sftp://%HOSTIP:%SSHPORT --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl gone %PWD/%LOGDIR/test%TESTNUMBER.txt

View File

@ -17,7 +17,7 @@ sftp
SFTP incorrect host key
</name>
<command>
--hostpubmd5 00000000000000000000000000000000 --key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/irrelevant-file --insecure
--hostpubmd5 00000000000000000000000000000000 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/irrelevant-file --insecure
</command>
</client>

View File

@ -17,7 +17,7 @@ scp
SCP incorrect host key
</name>
<command>
--hostpubmd5 00000000000000000000000000000000 --key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/irrelevant-file --insecure
--hostpubmd5 00000000000000000000000000000000 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/irrelevant-file --insecure
</command>
</client>

View File

@ -20,7 +20,7 @@ sftp
SFTP syntactically invalid host key
</name>
<command>
--hostpubmd5 00 --key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%NOLISTENPORT%SSH_PWD/%LOGDIR/irrelevant-file --insecure
--hostpubmd5 00 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%NOLISTENPORT%SSH_PWD/%LOGDIR/irrelevant-file --insecure
</command>
</client>

View File

@ -24,7 +24,7 @@ sftp
SFTP retrieval with byte range
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 5-9 --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 5-9 --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -25,7 +25,7 @@ sftp
SFTP retrieval with byte range past end of file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 5-99 --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 5-99 --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -24,7 +24,7 @@ sftp
SFTP retrieval with byte range relative to end of file
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r -9 --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r -9 --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -25,7 +25,7 @@ sftp
SFTP retrieval with X- byte range
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 5- --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 5- --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -23,7 +23,7 @@ sftp
SFTP retrieval with invalid X- range
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 99- --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt -r 99- --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -29,7 +29,7 @@ perl %SRCDIR/libtest/test610.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rename * asterisk accept-fail
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "-*rename %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/test%TESTNUMBER.new" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "-*rename %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/test%TESTNUMBER.new" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl rmdir %PWD/%LOGDIR/test%TESTNUMBER.new

View File

@ -29,7 +29,7 @@ perl %SRCDIR/libtest/test610.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rename * asterisk accept-fail
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: -Q "-*rename %PWD/%LOGDIR/test%TESTNUMBER-not-exists-dir %PWD/%LOGDIR/test%TESTNUMBER.new" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: -Q "-*rename %PWD/%LOGDIR/test%TESTNUMBER-not-exists-dir %PWD/%LOGDIR/test%TESTNUMBER.new" sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<postcheck>
perl %SRCDIR/libtest/test610.pl rmdir %PWD/%LOGDIR/test%TESTNUMBER.dir

View File

@ -23,7 +23,7 @@ sftp
SFTP --head retrieval
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure --head
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure --head
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -23,7 +23,7 @@ scp
SCP --head retrieval
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure --head
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure --head
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -24,7 +24,7 @@ sftp
SFTP retrieval
</name>
<command>
--key curl_client_key --pubkey curl_client_key.pub -u %USER: --compressed-ssh sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
--key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: --compressed-ssh sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt --insecure
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
Test data

View File

@ -16,7 +16,7 @@ sftp
SFTP retrieval with nonexistent private key file
</name>
<command>
--key DOES_NOT_EXIST --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure --connect-timeout 8
--key DOES_NOT_EXIST --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/not-a-valid-file-moooo --insecure --connect-timeout 8
</command>
</client>

View File

@ -24,7 +24,7 @@ sftp
SFTP correct host key
</name>
<command>
--hostpubmd5 %SSHSRVMD5 --key curl_client_key --pubkey curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
--hostpubmd5 %SSHSRVMD5 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: sftp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
test

View File

@ -24,7 +24,7 @@ scp
SCP correct host key
</name>
<command>
--hostpubmd5 %SSHSRVMD5 --key curl_client_key --pubkey curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
--hostpubmd5 %SSHSRVMD5 --key %LOGDIR/server/curl_client_key --pubkey %LOGDIR/server/curl_client_key.pub -u %USER: scp://%HOSTIP:%SSHPORT%SSH_PWD/%LOGDIR/file%TESTNUMBER.txt
</command>
<file name="%LOGDIR/file%TESTNUMBER.txt">
test

View File

@ -238,6 +238,8 @@ int test(char *URL)
struct timeval timeout = {-1, 0};
int success = 0;
assert(test_argc >= 5);
start_test_timing();
if(!libtest_arg3) {
@ -286,8 +288,8 @@ int test(char *URL)
easy_setopt(curl, CURLOPT_READDATA, hd_src);
easy_setopt(curl, CURLOPT_USERPWD, libtest_arg3);
easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, "curl_client_key.pub");
easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, "curl_client_key");
easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, test_argv[4]);
easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, test_argv[5]);
easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);

View File

@ -40,6 +40,8 @@ int test(char *URL)
CURLcode res = CURLE_OK;
CURLMcode mres;
assert(test_argc >= 4);
global_init(CURL_GLOBAL_ALL);
multi_init(multiHandle);
@ -47,8 +49,8 @@ int test(char *URL)
easy_init(curl);
easy_setopt(curl, CURLOPT_USERPWD, libtest_arg2);
easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, "curl_client_key.pub");
easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, "curl_client_key");
easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, test_argv[3]);
easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, test_argv[4]);
easy_setopt(curl, CURLOPT_UPLOAD, 1L);
easy_setopt(curl, CURLOPT_VERBOSE, 1L);

View File

@ -1098,7 +1098,7 @@ sub verifysftp {
}
# Connect to sftp server, authenticate and run a remote pwd
# command using our generated configuration and key files
my $cmd = "\"$sftp\" -b $sftpcmds -F $sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1";
my $cmd = "\"$sftp\" -b $PIDDIR/$sftpcmds -F $PIDDIR/$sftpconfig -S \"$ssh\" $ip > $sftplog 2>&1";
my $res = runclient($cmd);
# Search for pwd command response in log file
if(open(my $sftplogfile, "<", "$sftplog")) {
@ -2212,12 +2212,12 @@ sub runsshserver {
if(!$wport) {
logmsg "RUN: couldn't start $srvrname. Tried these ports:";
logmsg "RUN: ".join(", ", @tports);
logmsg "RUN: ".join(", ", @tports)."\n";
return (0,0,0);
}
my $hostfile;
if(!open($hostfile, "<", $hstpubmd5f) ||
if(!open($hostfile, "<", $PIDDIR . "/" . $hstpubmd5f) ||
(read($hostfile, $SSHSRVMD5, 32) != 32) ||
!close($hostfile) ||
($SSHSRVMD5 !~ /^[a-f0-9]{32}$/i))
@ -2228,7 +2228,7 @@ sub runsshserver {
die $msg;
}
if(!open($hostfile, "<", $hstpubsha256f) ||
if(!open($hostfile, "<", $PIDDIR . "/" . $hstpubsha256f) ||
(read($hostfile, $SSHSRVSHA256, 48) == 0) ||
!close($hostfile))
{

View File

@ -37,6 +37,7 @@ BEGIN {
use Cwd;
use Cwd 'abs_path';
use File::Basename;
use serverhelp qw(
server_pidfilename
@ -78,6 +79,7 @@ my $certfile; # certificate chain PEM file
my $path = getcwd();
my $srcdir = $path;
my $logdir = $path .'/log';
my $piddir;
#***************************************************************************
# Signal handler to remove our stunnel 4.00 and newer configuration file.
@ -183,14 +185,20 @@ while(@ARGV) {
#***************************************************************************
# Initialize command line option dependent variables
#
if(!$pidfile) {
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
if($pidfile) {
# Use our pidfile directory to store the conf files
$piddir = dirname($pidfile);
}
else {
# Use the current directory to store the conf files
$piddir = $path;
$pidfile = server_pidfilename($piddir, $proto, $ipvnum, $idnum);
}
if(!$logfile) {
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
}
$conffile = "$logdir/${proto}_stunnel.conf";
$conffile = "$piddir/${proto}_stunnel.conf";
$capath = abs_path($path);
$certfile = "$srcdir/". ($stuncert?"certs/$stuncert":"stunnel.pem");

View File

@ -210,7 +210,7 @@ sub dump_array {
if(!$filename) {
$error = 'Error: Missing argument 1 for dump_array()';
}
elsif(open(my $textfh, ">", "$filename")) {
elsif(open(my $textfh, ">", $filename)) {
foreach my $line (@arr) {
$line .= "\n" if($line !~ /\n$/);
print $textfh $line;

View File

@ -35,6 +35,7 @@ use Digest::MD5 'md5_hex';
use Digest::SHA;
use Digest::SHA 'sha256_base64';
use MIME::Base64;
use File::Basename;
#***************************************************************************
# Variables and subs imported from sshhelp module
@ -96,6 +97,7 @@ my $idnum = 1; # default ssh daemon instance number
my $proto = 'ssh'; # protocol the ssh daemon speaks
my $path = getcwd(); # current working directory
my $logdir = $path .'/log'; # directory for log files
my $piddir; # directory for server config files
my $username = $ENV{USER}; # default user
my $pidfile; # ssh daemon pid file
my $identity = 'curl_client_key'; # default identity file
@ -103,6 +105,14 @@ my $identity = 'curl_client_key'; # default identity file
my $error;
my @cfgarr;
#***************************************************************************
# Returns a path of the given file name in the log directory (PiddirPath)
#
sub pp {
my $file = $_[0];
return "$piddir/$file";
# TODO: do Windows path conversion here
}
#***************************************************************************
# Parse command line options
@ -181,12 +191,17 @@ while(@ARGV) {
# Initialize command line option dependent variables
#
#***************************************************************************
# Default ssh daemon pid file name
# Default ssh daemon pid file name & directory
#
if(!$pidfile) {
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
if($pidfile) {
# Use our pidfile directory to store server config files
$piddir = dirname($pidfile);
}
else {
# Use the current directory to store server config files
$piddir = $path;
$pidfile = server_pidfilename($piddir, $proto, $ipvnum, $idnum);
}
#***************************************************************************
@ -373,47 +388,47 @@ if((($sshid =~ /OpenSSH/) && ($sshvernum < 299)) ||
#***************************************************************************
# Generate host and client key files for curl's tests
#
if((! -e $hstprvkeyf) || (! -s $hstprvkeyf) ||
(! -e $hstpubkeyf) || (! -s $hstpubkeyf) ||
(! -e $hstpubmd5f) || (! -s $hstpubmd5f) ||
(! -e $hstpubsha256f) || (! -s $hstpubsha256f) ||
(! -e $cliprvkeyf) || (! -s $cliprvkeyf) ||
(! -e $clipubkeyf) || (! -s $clipubkeyf)) {
if((! -e pp($hstprvkeyf)) || (! -s pp($hstprvkeyf)) ||
(! -e pp($hstpubkeyf)) || (! -s pp($hstpubkeyf)) ||
(! -e pp($hstpubmd5f)) || (! -s pp($hstpubmd5f)) ||
(! -e pp($hstpubsha256f)) || (! -s pp($hstpubsha256f)) ||
(! -e pp($cliprvkeyf)) || (! -s pp($cliprvkeyf)) ||
(! -e pp($clipubkeyf)) || (! -s pp($clipubkeyf))) {
# Make sure all files are gone so ssh-keygen doesn't complain
unlink($hstprvkeyf, $hstpubkeyf, $hstpubmd5f, $hstpubsha256f,
$cliprvkeyf, $clipubkeyf);
unlink(pp($hstprvkeyf), pp($hstpubkeyf), pp($hstpubmd5f),
pp($hstpubsha256f), pp($cliprvkeyf), pp($clipubkeyf));
logmsg 'generating host keys...' if($verbose);
if(system "\"$sshkeygen\" -q -t rsa -f $hstprvkeyf -C 'curl test server' -N ''") {
if(system "\"$sshkeygen\" -q -t rsa -f " . pp($hstprvkeyf) . " -C 'curl test server' -N ''") {
logmsg 'Could not generate host key';
exit 1;
}
logmsg 'generating client keys...' if($verbose);
if(system "\"$sshkeygen\" -q -t rsa -f $cliprvkeyf -C 'curl test client' -N ''") {
if(system "\"$sshkeygen\" -q -t rsa -f " . pp($cliprvkeyf) . " -C 'curl test client' -N ''") {
logmsg 'Could not generate client key';
exit 1;
}
# Make sure that permissions are restricted so openssh doesn't complain
system "chmod 600 $hstprvkeyf";
system "chmod 600 $cliprvkeyf";
system "chmod 600 " . pp($hstprvkeyf);
system "chmod 600 " . pp($cliprvkeyf);
# Save md5 and sha256 hashes of public host key
open(my $rsakeyfile, "<", "$hstpubkeyf");
open(my $rsakeyfile, "<", pp($hstpubkeyf));
my @rsahostkey = do { local $/ = ' '; <$rsakeyfile> };
close($rsakeyfile);
if(!$rsahostkey[1]) {
logmsg 'Failed parsing base64 encoded RSA host key';
exit 1;
}
open(my $pubmd5file, ">", "$hstpubmd5f");
open(my $pubmd5file, ">", pp($hstpubmd5f));
print $pubmd5file md5_hex(decode_base64($rsahostkey[1]));
close($pubmd5file);
if((! -e $hstpubmd5f) || (! -s $hstpubmd5f)) {
if((! -e pp($hstpubmd5f)) || (! -s pp($hstpubmd5f))) {
logmsg 'Failed writing md5 hash of RSA host key';
exit 1;
}
open(my $pubsha256file, ">", "$hstpubsha256f");
open(my $pubsha256file, ">", pp($hstpubsha256f));
print $pubsha256file sha256_base64(decode_base64($rsahostkey[1]));
close($pubsha256file);
if((! -e $hstpubsha256f) || (! -s $hstpubsha256f)) {
if((! -e pp($hstpubsha256f)) || (! -s pp($hstpubsha256f))) {
logmsg 'Failed writing sha256 hash of RSA host key';
exit 1;
}
@ -423,29 +438,31 @@ if((! -e $hstprvkeyf) || (! -s $hstprvkeyf) ||
#***************************************************************************
# Convert paths for curl's tests running on Windows with Cygwin/Msys OpenSSH
#
my $clipubkeyf_config = abs_path("$path/$clipubkeyf");
my $hstprvkeyf_config = abs_path("$path/$hstprvkeyf");
my $pidfile_config = $pidfile;
my $sftpsrv_config = $sftpsrv;
if (pathhelp::os_is_win()) {
my $clipubkeyf_config;
my $hstprvkeyf_config;
my $pidfile_config;
my $sftpsrv_config;
if ($sshdid =~ /OpenSSH-Windows/) {
# Ensure to use native Windows paths with OpenSSH for Windows
$clipubkeyf_config = pathhelp::sys_native_abs_path(pp($clipubkeyf));
$hstprvkeyf_config = pathhelp::sys_native_abs_path(pp($hstprvkeyf));
$pidfile_config = pathhelp::sys_native_abs_path($pidfile);
$sftpsrv_config = pathhelp::sys_native_abs_path($sftpsrv);
}
elsif (pathhelp::os_is_win()) {
# Ensure to use MinGW/Cygwin paths
$clipubkeyf_config = pathhelp::build_sys_abs_path($clipubkeyf_config);
$hstprvkeyf_config = pathhelp::build_sys_abs_path($hstprvkeyf_config);
$pidfile_config = pathhelp::build_sys_abs_path($pidfile_config);
$sftpsrv_config = "internal-sftp";
}
if ($sshdid =~ /OpenSSH-Windows/) {
# Ensure to use native Windows paths with OpenSSH for Windows
$clipubkeyf_config = pathhelp::sys_native_abs_path($clipubkeyf);
$hstprvkeyf_config = pathhelp::sys_native_abs_path($hstprvkeyf);
$pidfile_config = pathhelp::sys_native_abs_path($pidfile);
$sftpsrv_config = pathhelp::sys_native_abs_path($sftpsrv);
$sshdconfig = pathhelp::sys_native_abs_path($sshdconfig);
$sshconfig = pathhelp::sys_native_abs_path($sshconfig);
$sftpconfig = pathhelp::sys_native_abs_path($sftpconfig);
else {
$clipubkeyf_config = abs_path(pp($clipubkeyf));
$hstprvkeyf_config = abs_path(pp($hstprvkeyf));
$pidfile_config = $pidfile;
$sftpsrv_config = $sftpsrv;
}
my $sshdconfig_abs = pathhelp::sys_native_abs_path(pp($sshdconfig));
#***************************************************************************
# ssh daemon configuration file options we might use and version support
@ -603,7 +620,7 @@ push @cfgarr, '#';
#***************************************************************************
# Write out initial sshd configuration file for curl's tests
#
$error = dump_array($sshdconfig, @cfgarr);
$error = dump_array(pp($sshdconfig), @cfgarr);
if($error) {
logmsg $error;
exit 1;
@ -621,19 +638,19 @@ sub sshd_supports_opt {
($sshdid =~ /SunSSH/)) {
# ssh daemon supports command line options -t -f and -o
$err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/,
qx("$sshd" -t -f $sshdconfig -o "$option=$value" 2>&1);
`\"$sshd\" -t -f $sshdconfig_abs -o \"$option=$value\" 2>&1`;
return !$err;
}
if(($sshdid =~ /OpenSSH/) && ($sshdvernum >= 299)) {
# ssh daemon supports command line options -t and -f
$err = dump_array($sshdconfig, (@cfgarr, "$option $value"));
$err = dump_array(pp($sshdconfig), (@cfgarr, "$option $value"));
if($err) {
logmsg $err;
return 0;
}
$err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/,
qx("$sshd" -t -f $sshdconfig 2>&1);
unlink $sshdconfig;
`\"$sshd\" -t -f $sshdconfig_abs 2>&1`;
unlink pp($sshdconfig);
return !$err;
}
return 0;
@ -765,7 +782,7 @@ push @cfgarr, '#';
#***************************************************************************
# Write out resulting sshd configuration file for curl's tests
#
$error = dump_array($sshdconfig, @cfgarr);
$error = dump_array(pp($sshdconfig), @cfgarr);
if($error) {
logmsg $error;
exit 1;
@ -775,7 +792,7 @@ if($error) {
#***************************************************************************
# Verify that sshd actually supports our generated configuration file
#
if(system "\"$sshd\" -t -f $sshdconfig > $sshdlog 2>&1") {
if(system "\"$sshd\" -t -f $sshdconfig_abs > $sshdlog 2>&1") {
logmsg "sshd configuration file $sshdconfig failed verification";
display_sshdlog();
display_sshdconfig();
@ -786,13 +803,13 @@ if(system "\"$sshd\" -t -f $sshdconfig > $sshdlog 2>&1") {
#***************************************************************************
# Generate ssh client host key database file for curl's tests
#
if((! -e $knownhosts) || (! -s $knownhosts)) {
if((! -e pp($knownhosts)) || (! -s pp($knownhosts))) {
logmsg 'generating ssh client known hosts file...' if($verbose);
unlink($knownhosts);
if(open(my $rsakeyfile, "<", "$hstpubkeyf")) {
unlink(pp($knownhosts));
if(open(my $rsakeyfile, "<", pp($hstpubkeyf))) {
my @rsahostkey = do { local $/ = ' '; <$rsakeyfile> };
if(close($rsakeyfile)) {
if(open(my $knownhostsh, ">", "$knownhosts")) {
if(open(my $knownhostsh, ">", pp($knownhosts))) {
print $knownhostsh "$listenaddr ssh-rsa $rsahostkey[1]\n";
if(!close($knownhostsh)) {
$error = "Error: cannot close file $knownhosts";
@ -819,20 +836,24 @@ if((! -e $knownhosts) || (! -s $knownhosts)) {
#***************************************************************************
# Convert paths for curl's tests running on Windows using Cygwin OpenSSH
#
my $identity_config = abs_path("$path/$identity");
my $knownhosts_config = abs_path("$path/$knownhosts");
if (pathhelp::os_is_win()) {
my $identity_config;
my $knownhosts_config;
if ($sshdid =~ /OpenSSH-Windows/) {
# Ensure to use native Windows paths with OpenSSH for Windows
$identity_config = pathhelp::sys_native_abs_path(pp($identity));
$knownhosts_config = pathhelp::sys_native_abs_path(pp($knownhosts));
}
elsif (pathhelp::os_is_win()) {
# Ensure to use MinGW/Cygwin paths
$identity_config = pathhelp::build_sys_abs_path($identity_config);
$knownhosts_config = pathhelp::build_sys_abs_path($knownhosts_config);
}
if ($sshdid =~ /OpenSSH-Windows/) {
# Ensure to use native Windows paths with OpenSSH for Windows
$identity_config = pathhelp::sys_native_abs_path($identity);
$knownhosts_config = pathhelp::sys_native_abs_path($knownhosts);
else {
$identity_config = abs_path(pp($identity));
$knownhosts_config = abs_path(pp($knownhosts));
}
#***************************************************************************
# ssh client configuration file options we might use and version support
#
@ -1069,7 +1090,7 @@ push @cfgarr, '#';
#***************************************************************************
# Write out resulting ssh client configuration file for curl's tests
#
$error = dump_array($sshconfig, @cfgarr);
$error = dump_array(pp($sshconfig), @cfgarr);
if($error) {
logmsg $error;
exit 1;
@ -1097,7 +1118,7 @@ for(my $i = scalar(@cfgarr) - 1; $i > 0; $i--) {
#***************************************************************************
# Write out resulting sftp client configuration file for curl's tests
#
$error = dump_array($sftpconfig, @cfgarr);
$error = dump_array(pp($sftpconfig), @cfgarr);
if($error) {
logmsg $error;
exit 1;
@ -1111,7 +1132,7 @@ if($error) {
logmsg 'generating sftp client commands file...' if($verbose);
push @cfgarr, 'pwd';
push @cfgarr, 'quit';
$error = dump_array($sftpcmds, @cfgarr);
$error = dump_array(pp($sftpcmds), @cfgarr);
if($error) {
logmsg $error;
exit 1;
@ -1121,7 +1142,7 @@ if($error) {
#***************************************************************************
# Prepare command line of ssh server daemon
#
my $cmd = "\"$sshd\" -e -D -f $sshdconfig > $sshdlog 2>&1";
my $cmd = "\"$sshd\" -e -D -f $sshdconfig_abs > $sshdlog 2>&1";
logmsg "SCP/SFTP server listening on port $port" if($verbose);
logmsg "RUN: $cmd" if($verbose);
@ -1168,8 +1189,8 @@ elsif($verbose && ($rc >> 8)) {
#***************************************************************************
# Clean up once the server has stopped
#
unlink($hstprvkeyf, $hstpubkeyf, $hstpubmd5f, $hstpubsha256f,
$cliprvkeyf, $clipubkeyf, $knownhosts,
$sshdconfig, $sshconfig, $sftpconfig);
unlink(pp($hstprvkeyf), pp($hstpubkeyf), pp($hstpubmd5f), pp($hstpubsha256f),
pp($cliprvkeyf), pp($clipubkeyf), pp($knownhosts),
pp($sshdconfig), pp($sshconfig), pp($sftpconfig));
exit 0;