diff --git a/tests/data/test1446 b/tests/data/test1446
index 189f0dfa6d..5e11f11b07 100644
--- a/tests/data/test1446
+++ b/tests/data/test1446
@@ -24,7 +24,7 @@ perl %SRCDIR/libtest/test613.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP with --remote-time
---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
perl %SRCDIR/libtest/test613.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir && \
diff --git a/tests/data/test2004 b/tests/data/test2004
index 9f41ce76c9..d747b8335c 100644
--- a/tests/data/test2004
+++ b/tests/data/test2004
@@ -30,7 +30,7 @@ sftp
TFTP RRQ followed by SFTP retrieval followed by FILE followed by SCP retrieval then again in reverse order
---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
This is test data
diff --git a/tests/data/test3021 b/tests/data/test3021
index b2dcfdc9ac..cc126773ee 100644
--- a/tests/data/test3021
+++ b/tests/data/test3021
@@ -28,7 +28,7 @@ sftp
SFTP correct sha256 host key
---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
# Needed for MSYS2 to not treat the argument as a POSIX path list
diff --git a/tests/data/test3022 b/tests/data/test3022
index fe558c3d51..45cdf87949 100644
--- a/tests/data/test3022
+++ b/tests/data/test3022
@@ -28,7 +28,7 @@ scp
SCP correct sha256 host key
---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
# Needed for MSYS2 to not treat the argument as a POSIX path list
diff --git a/tests/data/test582 b/tests/data/test582
index 86613e5fbf..f626d0bab8 100644
--- a/tests/data/test582
+++ b/tests/data/test582
@@ -24,7 +24,7 @@ lib%TESTNUMBER
SFTP upload using multi interface
-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
Moooooooooooo
diff --git a/tests/data/test583 b/tests/data/test583
index 4f6a91bc6e..51e435c005 100644
--- a/tests/data/test583
+++ b/tests/data/test583
@@ -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.
-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
diff --git a/tests/data/test600 b/tests/data/test600
index 9ff12faf02..d110ad15a5 100644
--- a/tests/data/test600
+++ b/tests/data/test600
@@ -24,7 +24,7 @@ sftp
SFTP retrieval
---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
Test data
diff --git a/tests/data/test601 b/tests/data/test601
index 6f995f19ed..73428decb6 100644
--- a/tests/data/test601
+++ b/tests/data/test601
@@ -24,7 +24,7 @@ scp
SCP retrieval
---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
Test data
diff --git a/tests/data/test602 b/tests/data/test602
index bf6bc3f7ad..2c89659789 100644
--- a/tests/data/test602
+++ b/tests/data/test602
@@ -21,7 +21,7 @@ sftp
SFTP put
---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
Test data
diff --git a/tests/data/test603 b/tests/data/test603
index 530ed9ca69..7aa20a999d 100644
--- a/tests/data/test603
+++ b/tests/data/test603
@@ -21,7 +21,7 @@ scp
SCP upload
---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
Test data
diff --git a/tests/data/test604 b/tests/data/test604
index f503e669e7..14d79335d7 100644
--- a/tests/data/test604
+++ b/tests/data/test604
@@ -16,7 +16,7 @@ sftp
SFTP retrieval of nonexistent file
---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
diff --git a/tests/data/test605 b/tests/data/test605
index 29555fa824..5c9a266748 100644
--- a/tests/data/test605
+++ b/tests/data/test605
@@ -16,7 +16,7 @@ scp
SCP retrieval of nonexistent file
---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
diff --git a/tests/data/test606 b/tests/data/test606
index c790bd685c..92764118db 100644
--- a/tests/data/test606
+++ b/tests/data/test606
@@ -16,7 +16,7 @@ sftp
SFTP invalid user login
---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
diff --git a/tests/data/test607 b/tests/data/test607
index 8c13e5844c..317f56b9cb 100644
--- a/tests/data/test607
+++ b/tests/data/test607
@@ -16,7 +16,7 @@ scp
SCP invalid user login
---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
diff --git a/tests/data/test608 b/tests/data/test608
index f909506186..5b0bf19009 100644
--- a/tests/data/test608
+++ b/tests/data/test608
@@ -24,7 +24,7 @@ sftp
SFTP post-quote rename
---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
# 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.
diff --git a/tests/data/test609 b/tests/data/test609
index bf1eff08fe..631aa62e0c 100644
--- a/tests/data/test609
+++ b/tests/data/test609
@@ -25,7 +25,7 @@ sftp
SFTP post-quote mkdir failure
---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
Test file for mkdir test
diff --git a/tests/data/test610 b/tests/data/test610
index a6d8a2354b..b3599a2f4f 100644
--- a/tests/data/test610
+++ b/tests/data/test610
@@ -27,7 +27,7 @@ perl %SRCDIR/libtest/test%TESTNUMBER.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rmdir
---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
perl %SRCDIR/libtest/test%TESTNUMBER.pl gone %PWD/%LOGDIR/test%TESTNUMBER.dir
diff --git a/tests/data/test611 b/tests/data/test611
index 14fa4f18b7..fd9f42fa0e 100644
--- a/tests/data/test611
+++ b/tests/data/test611
@@ -27,7 +27,7 @@ perl %SRCDIR/libtest/test610.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rename
---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
perl %SRCDIR/libtest/test610.pl rmdir %PWD/%LOGDIR/test%TESTNUMBER.new
diff --git a/tests/data/test612 b/tests/data/test612
index 04890c6c7e..37ffc5c6cd 100644
--- a/tests/data/test612
+++ b/tests/data/test612
@@ -24,7 +24,7 @@ sftp
SFTP post-quote remove file
---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
perl %SRCDIR/libtest/test610.pl gone %PWD/%LOGDIR/test%TESTNUMBER.txt
diff --git a/tests/data/test613 b/tests/data/test613
index 9bf30ad0d5..8a57ec663d 100644
--- a/tests/data/test613
+++ b/tests/data/test613
@@ -29,7 +29,7 @@ perl %SRCDIR/libtest/test%TESTNUMBER.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP directory retrieval
---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
perl %SRCDIR/libtest/test%TESTNUMBER.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/curl%TESTNUMBER.out
diff --git a/tests/data/test614 b/tests/data/test614
index 90e2e48035..d7b45a459a 100644
--- a/tests/data/test614
+++ b/tests/data/test614
@@ -30,7 +30,7 @@ perl %SRCDIR/libtest/test613.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP pre-quote chmod
---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
perl %SRCDIR/libtest/test613.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir %PWD/%LOGDIR/curl%TESTNUMBER.out
diff --git a/tests/data/test615 b/tests/data/test615
index 529bb2c3e6..d2ed914a69 100644
--- a/tests/data/test615
+++ b/tests/data/test615
@@ -20,7 +20,7 @@ perl %SRCDIR/libtest/test613.pl prepare %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP put remote failure
---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
perl %SRCDIR/libtest/test613.pl postprocess %PWD/%LOGDIR/test%TESTNUMBER.dir
diff --git a/tests/data/test616 b/tests/data/test616
index 0feb69e1a9..570f1fa11e 100644
--- a/tests/data/test616
+++ b/tests/data/test616
@@ -23,7 +23,7 @@ sftp
SFTP retrieval of empty file
---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
diff --git a/tests/data/test617 b/tests/data/test617
index c72379869b..05c2989b7e 100644
--- a/tests/data/test617
+++ b/tests/data/test617
@@ -23,7 +23,7 @@ scp
SCP retrieval of empty file
---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
diff --git a/tests/data/test618 b/tests/data/test618
index 5c083ac660..1ffe464483 100644
--- a/tests/data/test618
+++ b/tests/data/test618
@@ -15,7 +15,7 @@ sftp
SFTP retrieval of two files
---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
Test data
diff --git a/tests/data/test619 b/tests/data/test619
index 5dcebfd823..15309a2579 100644
--- a/tests/data/test619
+++ b/tests/data/test619
@@ -15,7 +15,7 @@ scp
SCP retrieval of two files
---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
Test data
diff --git a/tests/data/test620 b/tests/data/test620
index f33a4f0968..2dd3587346 100644
--- a/tests/data/test620
+++ b/tests/data/test620
@@ -16,7 +16,7 @@ sftp
SFTP retrieval of missing file followed by good file
---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
Test data
diff --git a/tests/data/test621 b/tests/data/test621
index b564812622..0c65b13d03 100644
--- a/tests/data/test621
+++ b/tests/data/test621
@@ -16,7 +16,7 @@ scp
SCP retrieval of missing file followed by good file
---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
Test data
diff --git a/tests/data/test622 b/tests/data/test622
index 02129f57fb..530bd2207a 100644
--- a/tests/data/test622
+++ b/tests/data/test622
@@ -22,7 +22,7 @@ sftp
SFTP put failure
---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
Test data
diff --git a/tests/data/test623 b/tests/data/test623
index ca2ba17a31..794a25118c 100644
--- a/tests/data/test623
+++ b/tests/data/test623
@@ -22,7 +22,7 @@ scp
SCP upload failure
---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
Test data
diff --git a/tests/data/test624 b/tests/data/test624
index 5ef6f85326..fa7225d68b 100644
--- a/tests/data/test624
+++ b/tests/data/test624
@@ -22,7 +22,7 @@ sftp
SFTP put with --ftp-create-dirs
---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
perl %SRCDIR/libtest/test610.pl move %PWD/%LOGDIR/test%TESTNUMBER.dir/upload.%TESTNUMBER %PWD/%LOGDIR/upload.%TESTNUMBER rmdir %PWD/%LOGDIR/test%TESTNUMBER.dir
diff --git a/tests/data/test625 b/tests/data/test625
index 600a3e64db..6ca9f4ea7e 100644
--- a/tests/data/test625
+++ b/tests/data/test625
@@ -22,7 +22,7 @@ sftp
SFTP put with --ftp-create-dirs twice
---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
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
diff --git a/tests/data/test626 b/tests/data/test626
index 1cc1a68776..87b7944edc 100644
--- a/tests/data/test626
+++ b/tests/data/test626
@@ -22,7 +22,7 @@ sftp
SFTP invalid quote 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
Test file for rename test
diff --git a/tests/data/test627 b/tests/data/test627
index af9111a74e..98b563fc7f 100644
--- a/tests/data/test627
+++ b/tests/data/test627
@@ -24,7 +24,7 @@ sftp
SFTP quote remove file with NOBODY
---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
perl %SRCDIR/libtest/test610.pl gone %PWD/%LOGDIR/test%TESTNUMBER.txt
diff --git a/tests/data/test630 b/tests/data/test630
index f23e28085d..0aed489aa9 100644
--- a/tests/data/test630
+++ b/tests/data/test630
@@ -17,7 +17,7 @@ sftp
SFTP incorrect host key
---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
diff --git a/tests/data/test631 b/tests/data/test631
index 72a361fc89..4e0630724f 100644
--- a/tests/data/test631
+++ b/tests/data/test631
@@ -17,7 +17,7 @@ scp
SCP incorrect host key
---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
diff --git a/tests/data/test632 b/tests/data/test632
index 57f4917fcc..8e3a913b04 100644
--- a/tests/data/test632
+++ b/tests/data/test632
@@ -20,7 +20,7 @@ sftp
SFTP syntactically invalid host key
---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
diff --git a/tests/data/test633 b/tests/data/test633
index 053fb7f7de..df3403cc80 100644
--- a/tests/data/test633
+++ b/tests/data/test633
@@ -24,7 +24,7 @@ sftp
SFTP retrieval with byte range
---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
Test data
diff --git a/tests/data/test634 b/tests/data/test634
index 32f5dafe57..3ba7fc6715 100644
--- a/tests/data/test634
+++ b/tests/data/test634
@@ -25,7 +25,7 @@ sftp
SFTP retrieval with byte range past end of file
---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
Test data
diff --git a/tests/data/test635 b/tests/data/test635
index a8ad622cf4..5cdf3420df 100644
--- a/tests/data/test635
+++ b/tests/data/test635
@@ -24,7 +24,7 @@ sftp
SFTP retrieval with byte range relative to end of file
---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
Test data
diff --git a/tests/data/test636 b/tests/data/test636
index 0ad308cc18..8afa222f7e 100644
--- a/tests/data/test636
+++ b/tests/data/test636
@@ -25,7 +25,7 @@ sftp
SFTP retrieval with X- byte range
---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
Test data
diff --git a/tests/data/test637 b/tests/data/test637
index 98c513b314..77d1ed9c6b 100644
--- a/tests/data/test637
+++ b/tests/data/test637
@@ -23,7 +23,7 @@ sftp
SFTP retrieval with invalid X- range
---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
Test data
diff --git a/tests/data/test638 b/tests/data/test638
index ecf89497e9..10b1b4ff97 100644
--- a/tests/data/test638
+++ b/tests/data/test638
@@ -29,7 +29,7 @@ perl %SRCDIR/libtest/test610.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rename * asterisk accept-fail
---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
perl %SRCDIR/libtest/test610.pl rmdir %PWD/%LOGDIR/test%TESTNUMBER.new
diff --git a/tests/data/test639 b/tests/data/test639
index 6df83af7b0..3c6f50bd71 100644
--- a/tests/data/test639
+++ b/tests/data/test639
@@ -29,7 +29,7 @@ perl %SRCDIR/libtest/test610.pl mkdir %PWD/%LOGDIR/test%TESTNUMBER.dir
SFTP post-quote rename * asterisk accept-fail
---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
perl %SRCDIR/libtest/test610.pl rmdir %PWD/%LOGDIR/test%TESTNUMBER.dir
diff --git a/tests/data/test640 b/tests/data/test640
index 3b6e6b62b7..816dfd537d 100644
--- a/tests/data/test640
+++ b/tests/data/test640
@@ -23,7 +23,7 @@ sftp
SFTP --head retrieval
---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
Test data
diff --git a/tests/data/test641 b/tests/data/test641
index 91e8cdb4ea..3487c90ce3 100644
--- a/tests/data/test641
+++ b/tests/data/test641
@@ -23,7 +23,7 @@ scp
SCP --head retrieval
---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
Test data
diff --git a/tests/data/test642 b/tests/data/test642
index dfbbdbadad..f63bbc6603 100644
--- a/tests/data/test642
+++ b/tests/data/test642
@@ -24,7 +24,7 @@ sftp
SFTP retrieval
---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
Test data
diff --git a/tests/data/test656 b/tests/data/test656
index fb0f27fb95..fff647ca39 100644
--- a/tests/data/test656
+++ b/tests/data/test656
@@ -16,7 +16,7 @@ sftp
SFTP retrieval with nonexistent private key file
---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
diff --git a/tests/data/test664 b/tests/data/test664
index 158d03cfad..69404ef4f4 100644
--- a/tests/data/test664
+++ b/tests/data/test664
@@ -24,7 +24,7 @@ sftp
SFTP correct host key
---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
test
diff --git a/tests/data/test665 b/tests/data/test665
index f1fb76c7c9..07aea62af7 100644
--- a/tests/data/test665
+++ b/tests/data/test665
@@ -24,7 +24,7 @@ scp
SCP correct host key
---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
test
diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c
index 34d7431a21..1f685669f5 100644
--- a/tests/libtest/lib582.c
+++ b/tests/libtest/lib582.c
@@ -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);
diff --git a/tests/libtest/lib583.c b/tests/libtest/lib583.c
index cd7ff85dae..ba44b5d25e 100644
--- a/tests/libtest/lib583.c
+++ b/tests/libtest/lib583.c
@@ -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);
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 700632f416..25a96c6e6a 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -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))
{
diff --git a/tests/secureserver.pl b/tests/secureserver.pl
index b6965b27cf..b84dd45e74 100755
--- a/tests/secureserver.pl
+++ b/tests/secureserver.pl
@@ -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");
diff --git a/tests/sshhelp.pm b/tests/sshhelp.pm
index c58d4cfc92..43e8dd5d25 100644
--- a/tests/sshhelp.pm
+++ b/tests/sshhelp.pm
@@ -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;
diff --git a/tests/sshserver.pl b/tests/sshserver.pl
index ec1950e766..705d876333 100755
--- a/tests/sshserver.pl
+++ b/tests/sshserver.pl
@@ -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;