From 2a704c39163894e01f377cbabf366a465dd5c6e3 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 25 Jan 2024 18:14:44 +0000 Subject: [PATCH] Allow -rpccookieperms on Windows --- src/httprpc.cpp | 5 ----- src/init.cpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/httprpc.cpp b/src/httprpc.cpp index ea202277b6..f8517320cd 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -265,17 +265,12 @@ static bool InitRPCAuthentication() fs::perms cookie_perms{DEFAULT_COOKIE_PERMS}; auto cookie_perms_arg{gArgs.GetArg("-rpccookieperms")}; if (cookie_perms_arg) { -#ifdef WIN32 - LogPrintf("Unable to set unix-style file permissions on cookie via -rpccookieperms using Windows systems\n"); - return false; -#else auto perms{ConvertPermsToOctal(*cookie_perms_arg)}; if (!perms) { LogPrintf("Invalid -rpccookieperms=%s; must be a 3 digit octal number (e.g. 400, 440 or 444).\n", *cookie_perms_arg); return false; } cookie_perms = static_cast(*perms); -#endif } if (!GenerateAuthCookie(&strRPCUserColonPass, cookie_perms)) { diff --git a/src/init.cpp b/src/init.cpp index 959782d466..e145a2c177 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -618,7 +618,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-rpcbind=[:port]", "Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC); argsman.AddArg("-rpcdoccheck", strprintf("Throw a non-fatal error at runtime if the documentation for an RPC is incorrect (default: %u)", DEFAULT_RPC_DOC_CHECK), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC); argsman.AddArg("-rpccookiefile=", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", ArgsManager::ALLOW_ANY, OptionsCategory::RPC); - argsman.AddArg("-rpccookieperms=", strprintf("Set the permissions on the RPC auth cookie file to the specified octal value on unix systems only (default: %u)", PermsToOctalString(DEFAULT_COOKIE_PERMS).c_str()), ArgsManager::ALLOW_ANY, OptionsCategory::RPC); + argsman.AddArg("-rpccookieperms=", strprintf("Set the permissions on the RPC auth cookie file to the specified octal value (default: %u)", PermsToOctalString(DEFAULT_COOKIE_PERMS).c_str()), ArgsManager::ALLOW_ANY, OptionsCategory::RPC); argsman.AddArg("-rpcpassword=", "Password for JSON-RPC connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC); argsman.AddArg("-rpcport=", strprintf("Listen for JSON-RPC connections on (default: %u, testnet: %u, signet: %u, regtest: %u)", defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort(), signetBaseParams->RPCPort(), regtestBaseParams->RPCPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC); argsman.AddArg("-rpcserialversion", strprintf("Sets the serialization of raw transaction or block hex returned in non-verbose mode, non-segwit(0) (DEPRECATED) or segwit(1) (default: %d)", DEFAULT_RPC_SERIALIZE_VERSION), ArgsManager::ALLOW_ANY, OptionsCategory::RPC);