[Cmake-commits] CMake branch, next, updated. v3.6.2-1987-g579af61
Brad King
brad.king at kitware.com
Tue Sep 13 13:52:58 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 579af61dae6e3346891f1b53f806d7889335364a (commit)
via e5ba1041be862212a3ad66bd51930fc7beeb8140 (commit)
from 8f2476403501201d548e1225351cd1bcbe69beb0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=579af61dae6e3346891f1b53f806d7889335364a
commit 579af61dae6e3346891f1b53f806d7889335364a
Merge: 8f24764 e5ba104
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 13 13:52:57 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 13 13:52:57 2016 -0400
Merge topic 'file-curl-userpw' into next
e5ba1041 file(DOWNLOAD|UPLOAD): Add 'USERPWD' suboption
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e5ba1041be862212a3ad66bd51930fc7beeb8140
commit e5ba1041be862212a3ad66bd51930fc7beeb8140
Author: Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Tue Sep 13 20:24:12 2016 +0300
Commit: Ruslan Baratov <ruslan_baratov at yahoo.com>
CommitDate: Tue Sep 13 20:24:12 2016 +0300
file(DOWNLOAD|UPLOAD): Add 'USERPWD' suboption
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 256d16d..f8727f0 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -222,6 +222,9 @@ Options to both ``DOWNLOAD`` and ``UPLOAD`` are:
``TIMEOUT <seconds>``
Terminate the operation after a given total time has elapsed.
+``USERPWD <username>:<password>``
+ Set username and password for operation.
+
Additional options to ``DOWNLOAD`` are:
``EXPECTED_HASH ALGO=<value>``
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index ae7a511..2c226cd 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2481,6 +2481,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
std::string hashMatchMSG;
CM_AUTO_PTR<cmCryptoHash> hash;
bool showProgress = false;
+ std::string userpwd;
while (i != args.end()) {
if (*i == "TIMEOUT") {
@@ -2564,6 +2565,13 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
return false;
}
hashMatchMSG = algo + " hash";
+ } else if (*i == "USERPWD") {
+ ++i;
+ if (i == args.end()) {
+ this->SetError("DOWNLOAD missing string for USERPWD.");
+ return false;
+ }
+ userpwd = *i;
} else {
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
@@ -2703,6 +2711,11 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
check_curl_result(res, "DOWNLOAD cannot set progress data: ");
}
+ if (!userpwd.empty()) {
+ res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str());
+ check_curl_result(res, "DOWNLOAD cannot set user password: ");
+ }
+
res = ::curl_easy_perform(curl);
/* always cleanup */
@@ -2783,6 +2796,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
std::string logVar;
std::string statusVar;
bool showProgress = false;
+ std::string userpwd;
while (i != args.end()) {
if (*i == "TIMEOUT") {
@@ -2817,6 +2831,13 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
statusVar = *i;
} else if (*i == "SHOW_PROGRESS") {
showProgress = true;
+ } else if (*i == "USERPWD") {
+ ++i;
+ if (i == args.end()) {
+ this->SetError("UPLOAD missing string for USERPWD.");
+ return false;
+ }
+ userpwd = *i;
} else {
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
@@ -2930,6 +2951,11 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(file_size));
check_curl_result(res, "UPLOAD cannot set input file size: ");
+ if (!userpwd.empty()) {
+ res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str());
+ check_curl_result(res, "UPLOAD cannot set user password: ");
+ }
+
res = ::curl_easy_perform(curl);
/* always cleanup */
diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt
new file mode 100644
index 0000000..2fa2731
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at DOWNLOAD-pass-not-set.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing string for USERPWD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake
new file mode 100644
index 0000000..61eff6d
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake
@@ -0,0 +1 @@
+file(DOWNLOAD "" "" USERPWD)
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 4c05f24..d8e9ce0 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -2,7 +2,9 @@ include(RunCMake)
run_cmake(DOWNLOAD-hash-mismatch)
run_cmake(DOWNLOAD-unused-argument)
+run_cmake(DOWNLOAD-pass-not-set)
run_cmake(UPLOAD-unused-argument)
+run_cmake(UPLOAD-pass-not-set)
run_cmake(INSTALL-DIRECTORY)
run_cmake(INSTALL-MESSAGE-bad)
run_cmake(FileOpenFailRead)
diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt
new file mode 100644
index 0000000..089c0ad
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at UPLOAD-pass-not-set.cmake:[0-9]+ \(file\):
+ file UPLOAD missing string for USERPWD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake
new file mode 100644
index 0000000..4f3d86c
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake
@@ -0,0 +1 @@
+file(UPLOAD "" "" USERPWD)
-----------------------------------------------------------------------
Summary of changes:
Help/command/file.rst | 3 +++
Source/cmFileCommand.cxx | 26 ++++++++++++++++++++
.../DOWNLOAD-pass-not-set-result.txt} | 0
.../RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt | 4 +++
Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake | 1 +
Tests/RunCMake/file/RunCMakeTest.cmake | 2 ++
.../UPLOAD-pass-not-set-result.txt} | 0
Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt | 4 +++
Tests/RunCMake/file/UPLOAD-pass-not-set.cmake | 1 +
9 files changed, 41 insertions(+)
copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/DOWNLOAD-pass-not-set-result.txt} (100%)
create mode 100644 Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt
create mode 100644 Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake
copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/UPLOAD-pass-not-set-result.txt} (100%)
create mode 100644 Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt
create mode 100644 Tests/RunCMake/file/UPLOAD-pass-not-set.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list