1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 08:29:04 +00:00

NSE: ldap-rootdse.nse improve error handling

This commit is contained in:
tomsellers
2016-04-11 18:04:53 +00:00
parent f9bf251368
commit 0699edbe05

View File

@@ -135,6 +135,11 @@ function action(host,port)
req = { baseObject = "", scope = ldap.SCOPE.base, derefPolicy = ldap.DEREFPOLICY.default }
status, searchResEntries = ldap.searchRequest( socket, req )
if not status then
socket:close()
return stdnse.format_output(false, searchResEntries)
end
-- Check if we were served all the results or not?
if not ldap.extractAttribute( searchResEntries, "namingContexts" ) and
not ldap.extractAttribute( searchResEntries, "supportedLDAPVersion" ) then
@@ -159,7 +164,7 @@ function action(host,port)
status, searchResEntries = ldap.udpSearchRequest( host, port, req )
end
if not status or not searchResEntries then return end
if not status or not searchResEntries then return stdnse.format_output(false, searchResEntries) end
result = ldap.searchResultToTable( searchResEntries )
-- if taken a way and ldap returns a single result, it ain't shown....