Skip to content

Commit d307da8

Browse files
committed
rpccookieperms: Allow setting setxid/sticky bits
Simply for backward compatibility
1 parent 0a4e77a commit d307da8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/util/fs_helpers.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ static std::optional<unsigned> StringToOctal(const std::string& str)
306306

307307
static auto ConvertPermsToOctal(const std::string& str) noexcept -> std::optional<unsigned>
308308
{
309-
// Don't permit setting special bits as they're not relevant to cookie files
310-
if (str.length() == 3) return StringToOctal(str);
309+
if ((str.length() == 3) || (str.length() == 4)) return StringToOctal(str);
311310
return std::nullopt;
312311
}
313312

test/functional/rpc_users.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def test_rpccookieperms(self):
9393
"group": 0o640,
9494
"all": 0o644,
9595
"440": 0o440,
96-
"640": 0o640,
96+
"0640": 0o640,
9797
"444": 0o444,
98+
"1660": 0o1660,
9899
}
99100

100101
if platform.system() == 'Windows':
@@ -104,7 +105,7 @@ def test_rpccookieperms(self):
104105
self.log.info('Check cookie file permissions can be set using -rpccookieperms')
105106

106107
cookie_file_path = self.nodes[1].chain_path / '.cookie'
107-
PERM_BITS_UMASK = 0o777
108+
PERM_BITS_UMASK = 0o7777
108109

109110
def test_perm(perm: Optional[str]):
110111
if not perm:

0 commit comments

Comments
 (0)