|
10 | 10 | from threading import Thread
|
11 | 11 | import os
|
12 | 12 | import shutil
|
| 13 | +import stat |
13 | 14 | import time
|
14 | 15 |
|
15 | 16 | from test_framework.authproxy import JSONRPCException
|
@@ -78,6 +79,11 @@ def wallet_file(name):
|
78 | 79 | os.mkdir(wallet_dir('w7'))
|
79 | 80 | os.symlink('w7', wallet_dir('w7_symlink'))
|
80 | 81 |
|
| 82 | + os.symlink('..', wallet_dir('recursive_dir_symlink')) |
| 83 | + |
| 84 | + os.mkdir(wallet_dir('self_walletdat_symlink')) |
| 85 | + os.symlink('wallet.dat', wallet_dir('self_walletdat_symlink/wallet.dat')) |
| 86 | + |
81 | 87 | # rename wallet.dat to make sure plain wallet file paths (as opposed to
|
82 | 88 | # directory paths) can be loaded
|
83 | 89 | # create another dummy wallet for use in testing backups later
|
@@ -117,7 +123,16 @@ def wallet_file(name):
|
117 | 123 | self.nodes[0].createwallet(wallet_name)
|
118 | 124 | for wallet_name in to_load:
|
119 | 125 | self.nodes[0].loadwallet(wallet_name)
|
120 |
| - assert_equal(sorted(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), sorted(in_wallet_dir)) |
| 126 | + |
| 127 | + os.mkdir(wallet_dir('no_access')) |
| 128 | + os.chmod(wallet_dir('no_access'), 0) |
| 129 | + try: |
| 130 | + with self.nodes[0].assert_debug_log(expected_msgs=['Too many levels of symbolic links', 'Error scanning']): |
| 131 | + walletlist = self.nodes[0].listwalletdir()['wallets'] |
| 132 | + finally: |
| 133 | + # Need to ensure access is restored for cleanup |
| 134 | + os.chmod(wallet_dir('no_access'), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) |
| 135 | + assert_equal(sorted(map(lambda w: w['name'], walletlist)), sorted(in_wallet_dir)) |
121 | 136 |
|
122 | 137 | assert_equal(set(node.listwallets()), set(wallet_names))
|
123 | 138 |
|
|
0 commit comments