Skip to content

Commit d493070

Browse files
committed
Fix NFS get_file and put_file auth using wrong handle during path traversal
get_file() and put_file() called update_auth(mount_fh) in their traversal loops, always setting credentials based on the root/mount handle (uid=0). With root_squash, this gets squashed to nobody, causing lookups to fail on non-world-traversable directories. Changed to update_auth(curr_fh) to match the correct behavior already used in ls().
1 parent 07447a0 commit d493070

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

nxc/protocols/nfs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def get_file(self):
366366
curr_fh = mount_fh
367367
for sub_path in remote_file_path.lstrip("/").split("/"):
368368
# Update the UID for the next object and get the handle
369-
self.update_auth(mount_fh)
369+
self.update_auth(curr_fh)
370370
res = self.nfs3.lookup(curr_fh, sub_path, auth=self.auth)
371371

372372
# Check for a bad path
@@ -448,7 +448,7 @@ def put_file(self):
448448
curr_fh = mount_fh
449449
# If target dir is "" or "/" without filter we would get one item with [""]
450450
for sub_path in list(filter(None, remote_dir_path.lstrip("/").split("/"))):
451-
self.update_auth(mount_fh)
451+
self.update_auth(curr_fh)
452452
res = self.nfs3.lookup(curr_fh, sub_path, auth=self.auth)
453453

454454
# If the path does not exist, create it

0 commit comments

Comments
 (0)