mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge 67cd78dbc2 into merged_master (Elements PR #1451)
This commit is contained in:
commit
bd65b886f1
6 changed files with 15 additions and 7 deletions
|
|
@ -80,6 +80,8 @@ static fs::path GetAuthCookieFile(bool temp=false)
|
|||
return AbsPathForConfigVal(gArgs, arg);
|
||||
}
|
||||
|
||||
static bool g_generated_cookie = false;
|
||||
|
||||
bool GenerateAuthCookie(std::string *cookie_out)
|
||||
{
|
||||
const size_t COOKIE_SIZE = 32;
|
||||
|
|
@ -105,6 +107,7 @@ bool GenerateAuthCookie(std::string *cookie_out)
|
|||
LogPrintf("Unable to rename cookie authentication file %s to %s\n", fs::PathToString(filepath_tmp), fs::PathToString(filepath));
|
||||
return false;
|
||||
}
|
||||
g_generated_cookie = true;
|
||||
LogPrintf("Generated RPC authentication cookie %s\n", fs::PathToString(filepath));
|
||||
|
||||
if (cookie_out)
|
||||
|
|
@ -170,7 +173,10 @@ bool GetMainchainAuthCookie(std::string *cookie_out)
|
|||
void DeleteAuthCookie()
|
||||
{
|
||||
try {
|
||||
fs::remove(GetAuthCookieFile());
|
||||
if (g_generated_cookie) {
|
||||
// Delete the cookie file if it was generated by this process
|
||||
fs::remove(GetAuthCookieFile());
|
||||
}
|
||||
} catch (const fs::filesystem_error& e) {
|
||||
LogPrintf("%s: Unable to remove random auth cookie file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue