mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 12:19:02 +00:00
o [NSE] Fix a bug reported by Daniel Miller that was causing the nfs-ls
script to ignore NFS mounts when the Mount version is 1.
This commit is contained in:
@@ -131,6 +131,12 @@ local function table_dirlist(nfs, mount, dirlist)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Unmount the NFS file system and close the connections
|
||||||
|
local function unmount_nfs(mount, mnt_obj, nfs_obj)
|
||||||
|
rpc.Helper.NfsClose(nfs_obj)
|
||||||
|
rpc.Helper.UnmountPath(mnt_obj, mount)
|
||||||
|
end
|
||||||
|
|
||||||
local function nfs_ls(nfs, mount, results, access)
|
local function nfs_ls(nfs, mount, results, access)
|
||||||
local dirs, attr, acs = {}, {}, {}
|
local dirs, attr, acs = {}, {}, {}
|
||||||
local nfsobj = rpc.NFS:new()
|
local nfsobj = rpc.NFS:new()
|
||||||
@@ -147,17 +153,21 @@ local function nfs_ls(nfs, mount, results, access)
|
|||||||
return false, status
|
return false, status
|
||||||
end
|
end
|
||||||
|
|
||||||
-- use simple chack since NFSv1 is not used anymore.
|
-- check if NFS and Mount versions are combatible
|
||||||
if (mnt_comm.version ~= nfs_comm.version) then
|
-- RPC library will check if the Mount and NFS versions are supported
|
||||||
rpc.Helper.UnmountPath(mnt_comm, mount)
|
if (nfs_comm.version == 1) then
|
||||||
return false, string.format("versions mismatch, nfs v%d - mount v%d",
|
unmount_nfs(mount, mnt_comm, nfs_comm)
|
||||||
|
return false, string.format("NFS v%d not supported", nfs_comm.version)
|
||||||
|
elseif ((nfs_comm.version == 2 and mnt_comm.version > 2) or
|
||||||
|
(nfs_comm.version == 3 and mnt_comm.version ~= 3)) then
|
||||||
|
unmount_nfs(mount, mnt_comm, nfs_comm)
|
||||||
|
return false, string.format("versions mismatch, NFS v%d - Mount v%d",
|
||||||
nfs_comm.version, mnt_comm.version)
|
nfs_comm.version, mnt_comm.version)
|
||||||
end
|
end
|
||||||
|
|
||||||
status, attr = nfsobj:GetAttr(nfs_comm, fhandle)
|
status, attr = nfsobj:GetAttr(nfs_comm, fhandle)
|
||||||
if not status then
|
if not status then
|
||||||
rpc.Helper.NfsClose(nfs_comm)
|
unmount_nfs(mount, mnt_comm, nfs_comm)
|
||||||
rpc.Helper.UnmountPath(mnt_comm, mount)
|
|
||||||
return status, attr
|
return status, attr
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -199,8 +209,7 @@ local function nfs_ls(nfs, mount, results, access)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
rpc.Helper.NfsClose(nfs_comm)
|
unmount_nfs(mount, mnt_comm, nfs_comm)
|
||||||
rpc.Helper.UnmountPath(mnt_comm, mount)
|
|
||||||
return status, dirs
|
return status, dirs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user