Skip to content

Commit 1b495cd

Browse files
committed
Use the status codes defined in the rfc when we have an error with mounting shares
1 parent 9e6ba5a commit 1b495cd

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

nxc/protocols/nfs.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ def shares(self):
170170
for share, network in zip(shares, networks):
171171
try:
172172
mnt_info = self.mount.mnt(share, self.auth)
173+
self.logger.debug(f"Mounted {share} - {mnt_info}")
174+
if mnt_info["status"] != 0:
175+
self.logger.fail(f"Error mounting share {share}: {NFSSTAT3[mnt_info['status']]}")
176+
continue
173177
file_handle = mnt_info["mountinfo"]["fhandle"]
174178

175179
info = self.nfs3.fsstat(file_handle, self.auth)
@@ -225,12 +229,10 @@ def enum_shares(self):
225229
try:
226230
mount_info = self.mount.mnt(share, self.auth)
227231
self.logger.debug(f"Mounted {share} - {mount_info}")
228-
if mount_info["status"] != 0: # noqa: SIM102
229-
if mount_info["status"] == 13:
230-
self.logger.fail(f"{share} - Permission Denied")
231-
continue
232-
# check for other error codes here
233-
232+
if mount_info["status"] != 0:
233+
self.logger.fail(f"Error mounting share {share}: {NFSSTAT3[mount_info['status']]}")
234+
continue
235+
234236
fhandle = mount_info["mountinfo"]["fhandle"]
235237
contents = self.list_dir(fhandle, share, self.args.enum_shares)
236238

0 commit comments

Comments
 (0)