[Scummvm-git-logs] scummvm master -> a68e8fcea88fdbe878fb1041015efc16dfa9d5ad
lephilousophe
noreply at scummvm.org
Sat Aug 12 20:17:57 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fde8a0b463 NETWORKING: Use a String for CA path
a68e8fcea8 ANDROID: Fix CA path retrieval
Commit: fde8a0b4630212026cbccfb32724df445e68d757
https://github.com/scummvm/scummvm/commit/fde8a0b4630212026cbccfb32724df445e68d757
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-08-12T22:12:58+02:00
Commit Message:
NETWORKING: Use a String for CA path
This allows to build the path inside the function and return it.
Changed paths:
backends/networking/curl/connectionmanager.cpp
backends/networking/curl/connectionmanager.h
backends/networking/curl/networkreadstream.cpp
backends/networking/curl/socket.cpp
diff --git a/backends/networking/curl/connectionmanager.cpp b/backends/networking/curl/connectionmanager.cpp
index 022bb6843b5..480c6087947 100644
--- a/backends/networking/curl/connectionmanager.cpp
+++ b/backends/networking/curl/connectionmanager.cpp
@@ -116,7 +116,7 @@ uint32 ConnectionManager::getCloudRequestsPeriodInMicroseconds() {
return TIMER_INTERVAL * CLOUD_PERIOD;
}
-const char *ConnectionManager::getCaCertPath() {
+Common::String ConnectionManager::getCaCertPath() {
#if defined(__ANDROID__)
Common::ArchiveMemberPtr member = SearchMan.getMember("cacert.pem");
Common::FSNode *node = dynamic_cast<Common::FSNode *>(member.get());
@@ -124,7 +124,7 @@ const char *ConnectionManager::getCaCertPath() {
return nullptr;
}
- return node->getPath().c_str();
+ return node->getPath();
#elif defined(DATA_PATH)
static enum {
kNotInitialized,
@@ -140,10 +140,10 @@ const char *ConnectionManager::getCaCertPath() {
if (state == kFileExists) {
return DATA_PATH"/cacert.pem";
} else {
- return nullptr;
+ return "";
}
#else
- return nullptr;
+ return "";
#endif
}
diff --git a/backends/networking/curl/connectionmanager.h b/backends/networking/curl/connectionmanager.h
index 47f5703eb1d..1fc608b2813 100644
--- a/backends/networking/curl/connectionmanager.h
+++ b/backends/networking/curl/connectionmanager.h
@@ -119,7 +119,7 @@ public:
static uint32 getCloudRequestsPeriodInMicroseconds();
/** Return the path to the CA certificates bundle. */
- static const char *getCaCertPath();
+ static Common::String getCaCertPath();
};
/** Shortcut for accessing the connection manager. */
diff --git a/backends/networking/curl/networkreadstream.cpp b/backends/networking/curl/networkreadstream.cpp
index 9b470787b56..7be7a8a5cf6 100644
--- a/backends/networking/curl/networkreadstream.cpp
+++ b/backends/networking/curl/networkreadstream.cpp
@@ -96,9 +96,9 @@ void NetworkReadStream::initCurl(const char *url, curl_slist *headersList) {
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
#endif
- const char *caCertPath = ConnMan.getCaCertPath();
- if (caCertPath) {
- curl_easy_setopt(_easy, CURLOPT_CAINFO, caCertPath);
+ Common::String caCertPath = ConnMan.getCaCertPath();
+ if (!caCertPath.empty()) {
+ curl_easy_setopt(_easy, CURLOPT_CAINFO, caCertPath.c_str());
}
#if LIBCURL_VERSION_NUM >= 0x072000
diff --git a/backends/networking/curl/socket.cpp b/backends/networking/curl/socket.cpp
index 6845905aeab..379158b8611 100644
--- a/backends/networking/curl/socket.cpp
+++ b/backends/networking/curl/socket.cpp
@@ -83,9 +83,9 @@ bool CurlSocket::connect(Common::String url) {
#if defined NINTENDO_SWITCH || defined PSP2
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
#endif
- const char *caCertPath = ConnMan.getCaCertPath();
- if (caCertPath) {
- curl_easy_setopt(_easy, CURLOPT_CAINFO, caCertPath);
+ Common::String caCertPath = ConnMan.getCaCertPath();
+ if (!caCertPath.empty()) {
+ curl_easy_setopt(_easy, CURLOPT_CAINFO, caCertPath.c_str());
}
CURLcode res = curl_easy_perform(_easy);
Commit: a68e8fcea88fdbe878fb1041015efc16dfa9d5ad
https://github.com/scummvm/scummvm/commit/a68e8fcea88fdbe878fb1041015efc16dfa9d5ad
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-08-12T22:12:59+02:00
Commit Message:
ANDROID: Fix CA path retrieval
The old way doesn't work anymore since directories are not FSNode.
The SearchMan could also return files which were not accessible through
filesystem.
Changed paths:
backends/networking/curl/connectionmanager.cpp
diff --git a/backends/networking/curl/connectionmanager.cpp b/backends/networking/curl/connectionmanager.cpp
index 480c6087947..ceb8f85dc9b 100644
--- a/backends/networking/curl/connectionmanager.cpp
+++ b/backends/networking/curl/connectionmanager.cpp
@@ -29,6 +29,10 @@
#include "common/system.h"
#include "common/timer.h"
+#if defined(__ANDROID__)
+#include "backends/platform/android/jni-android.h"
+#endif
+
namespace Common {
DECLARE_SINGLETON(Networking::ConnectionManager);
@@ -118,13 +122,10 @@ uint32 ConnectionManager::getCloudRequestsPeriodInMicroseconds() {
Common::String ConnectionManager::getCaCertPath() {
#if defined(__ANDROID__)
- Common::ArchiveMemberPtr member = SearchMan.getMember("cacert.pem");
- Common::FSNode *node = dynamic_cast<Common::FSNode *>(member.get());
- if (!node) {
- return nullptr;
- }
-
- return node->getPath();
+ // cacert path must exist on filesystem and be reachable by standard open syscall
+ // Lets use ScummVM internal directory
+ Common::String basePath = JNI::getScummVMBasePath();
+ return basePath + "/cacert.pem";
#elif defined(DATA_PATH)
static enum {
kNotInitialized,
More information about the Scummvm-git-logs
mailing list