diff --git a/src/util/fs_helpers.cpp b/src/util/fs_helpers.cpp index 42bdd8de30..33ab5b43ee 100644 --- a/src/util/fs_helpers.cpp +++ b/src/util/fs_helpers.cpp @@ -342,8 +342,7 @@ static std::optional StringToOctal(const std::string& str) static auto ConvertPermsToOctal(const std::string& str) noexcept -> std::optional { - // Don't permit setting special bits as they're not relevant to cookie files - if (str.length() == 3) return StringToOctal(str); + if ((str.length() == 3) || (str.length() == 4)) return StringToOctal(str); return std::nullopt; } diff --git a/test/functional/rpc_users.py b/test/functional/rpc_users.py index 5b721a77de..08584637ae 100755 --- a/test/functional/rpc_users.py +++ b/test/functional/rpc_users.py @@ -127,8 +127,9 @@ class HTTPBasicsTest(BitcoinTestFramework): "group": 0o640, "all": 0o644, "440": 0o440, - "640": 0o640, + "0640": 0o640, "444": 0o444, + "1660": 0o1660, } if os.name == 'nt': @@ -137,7 +138,7 @@ class HTTPBasicsTest(BitcoinTestFramework): self.log.info('Check cookie file permissions can be set using -rpccookieperms') cookie_file_path = self.nodes[1].chain_path / '.cookie' - PERM_BITS_UMASK = 0o777 + PERM_BITS_UMASK = 0o7777 def test_perm(perm: Optional[str]): if not perm: