From 8bdcb90818b4e5720ce98d37cdf51f19d684cc49 Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Sat, 1 Jan 2022 20:00:04 +0530 Subject: [PATCH] Make aria2 secret a random value Apps using this service will not have a default aria secret (previously 'kiwixariarpc') --- src/aria2.cpp | 11 ++++++++++- src/aria2.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/aria2.cpp b/src/aria2.cpp index 2bc163d83..1ee015ff4 100644 --- a/src/aria2.cpp +++ b/src/aria2.cpp @@ -3,12 +3,14 @@ #include "aria2.h" #include "xmlrpc.h" #include +#include #include #include #include #include "tools.h" #include "tools/pathTools.h" #include "tools/stringTools.h" +#include "tools/otherTools.h" #include "downloader.h" // For AriaError #ifdef _WIN32 @@ -30,7 +32,7 @@ namespace kiwix { Aria2::Aria2(): mp_aria(nullptr), m_port(42042), - m_secret("kiwixariarpc"), + m_secret(getNewRpcSecret()), m_curlErrorBuffer(new char[CURL_ERROR_SIZE]), mp_curl(nullptr) { @@ -195,6 +197,13 @@ std::string Aria2::tellStatus(const std::string& gid, const std::vector Aria2::tellActive() { MethodCall methodCall("aria2.tellActive", m_secret); diff --git a/src/aria2.h b/src/aria2.h index b07018f00..47a3f826a 100644 --- a/src/aria2.h +++ b/src/aria2.h @@ -37,6 +37,7 @@ class Aria2 std::string addUri(const std::vector& uri, const std::vector>& options = {}); std::string tellStatus(const std::string& gid, const std::vector& statusKey); + static std::string getNewRpcSecret(); std::vector tellActive(); std::vector tellWaiting(); void saveSession();