Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mssql script fixes #2784

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions nselib/mssql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3098,7 +3098,7 @@ Helper =

rows = {}

while(true) do
while(true and pos < data:len()) do
local rowtag
rowtag, pos = string.unpack("B", data, pos )

Expand Down Expand Up @@ -3203,8 +3203,8 @@ Helper =
Helper.Discover( host )

if ( port ) then
local status, instances = Helper.GetDiscoveredInstances(host, port)
if status then
local instances = Helper.GetDiscoveredInstances(host, port)
if instances then
return true, instances
else
return false, "No SQL Server instance detected on this port"
Expand Down Expand Up @@ -3331,10 +3331,12 @@ Helper =
return nil
end
local output = {}
local count = 0
for _, instance in ipairs(instances) do
output[instance:GetName()] = process_instance(instance)
count = count + 1
end
if #output > 0 then
if count > 0 then
return outlib.sorted_by_key(output)
end
return nil
Expand Down