From 8ff4e8901966e4f9e4083b1c1c6b2c2b07533570 Mon Sep 17 00:00:00 2001 From: patrik Date: Sun, 22 May 2011 14:43:08 +0000 Subject: [PATCH] Added new error messages for error codes Added the 8A tagdecoder Modified the output of error messages slightly [Patrik] --- nselib/ldap.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nselib/ldap.lua b/nselib/ldap.lua index 99a937c48..dfc4c91ca 100644 --- a/nselib/ldap.lua +++ b/nselib/ldap.lua @@ -20,7 +20,9 @@ local ldapMessageId = 1 ERROR_MSG = {} ERROR_MSG[1] = "Intialization of LDAP library failed." ERROR_MSG[4] = "Size limit exceeded." +ERROR_MSG[13] = "Confidentiality required" ERROR_MSG[32] = "No such object" +ERROR_MSG[34] = "Invalid DN" ERROR_MSG[49] = "The supplied credential is invalid." ERRORS = { @@ -129,6 +131,10 @@ tagDecoder["0A"] = function( self, encStr, elen, pos ) return self.decodeInt(encStr, elen, pos) end +tagDecoder["8A"] = function( self, encStr, elen, pos ) + return bin.unpack("A" .. elen, encStr, pos) +end + -- null decoder tagDecoder["31"] = function( self, encStr, elen, pos ) return pos, nil @@ -360,7 +366,9 @@ function bindRequest( socket, params ) pos, response.matchedDN = decode( packet, pos ) pos, response.errorMessage = decode( packet, pos ) error_msg = ERROR_MSG[response.resultCode] - return false, string.format("Error: %s\nDetails: %s", error_msg or "", response.errorMessage or "" ) + return false, string.format("\n Error: %s\n Details: %s", + error_msg or "Unknown error occured (code: " .. response.resultCode .. + ")", response.errorMessage or "" ) else return true, "Success" end