Skip to content

Commit 182c898

Browse files
authored
Merge pull request Pennyw0rth#1057 from Pennyw0rth/neff-fix-nfs-ls
Fix ls arg in nfs
2 parents a3d4216 + 440ecb5 commit 182c898

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

nxc/protocols/nfs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,20 +645,22 @@ def ls(self):
645645
self.logger.fail("No root escape possible, please specify a share")
646646
return
647647

648-
# Update UID and GID for the share
649-
self.update_auth(mount_fh)
650-
651648
# We got a path to look up
652649
curr_fh = mount_fh
653650
is_file = False # If the last path is a file
654651

655652
# If ls is "" or "/" without filter we would get one item with [""]
656653
for sub_path in list(filter(None, self.args.ls.split("/"))):
654+
# Update UID and GID for the path
655+
self.update_auth(curr_fh)
657656
res = self.nfs3.lookup(curr_fh, sub_path, auth=self.auth)
658657

659658
if "resfail" in res and res["status"] == NFS3ERR_NOENT:
660659
self.logger.fail(f"Unknown path: {self.args.ls!r}")
661660
return
661+
elif "resfail" in res:
662+
self.logger.fail(f"Error on looking up path '{sub_path}': {NFSSTAT3[res['status']]}")
663+
return
662664
# If file then break and only display file
663665
if res["resok"]["obj_attributes"]["attributes"]["type"] == NF3REG:
664666
is_file = True

0 commit comments

Comments
 (0)