From 65a8490539f592f54ada9305c0cbce00f5c51910 Mon Sep 17 00:00:00 2001 From: kroosec Date: Sat, 14 Jul 2012 17:29:00 +0000 Subject: [PATCH] Small formatting change int creds.lua to adapt output when no state is provided. --- nselib/creds.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nselib/creds.lua b/nselib/creds.lua index de74971a6..ef75896c2 100644 --- a/nselib/creds.lua +++ b/nselib/creds.lua @@ -332,9 +332,17 @@ Credentials = { local svc = ("%s/%s"):format(v.port,v.service) local c if ( v.user and #v.user > 0 ) then - c = ("%s:%s - %s"):format(v.user, v.pass, StateMsg[v.state] or "Unknown state") + if StateMsg[v.state] then + c = ("%s:%s - %s"):format(v.user, v.pass, StateMsg[v.state]) + else + c = ("%s:%s"):format(v.user, v.pass) + end else - c = ("%s - %s"):format(v.pass, StateMsg[v.state] or "Unknown state") + if StateMsg[v.state] then + c = ("%s - %s"):format(v.pass, StateMsg[v.state]) + else + c = ("%s"):format(v.pass) + end end local script = v.scriptname assert(type(h)=="string", "Could not determine a valid host")