Comparing version 1.7.1 to 1.7.3
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
'use strict'; | ||
@@ -75,3 +75,4 @@ | ||
// parse type2 message from server: | ||
var type2msg = ntlm.parseType2Message(res.headers['www-authenticate']); | ||
var type2msg = ntlm.parseType2Message(res.headers['www-authenticate'], callback); //callback only happens on errors | ||
if(!type2msg) return; // if callback returned an error, the parse-function returns with null | ||
@@ -78,0 +79,0 @@ // create type3 message: |
20
ntlm.js
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
var crypto = require('crypto'); | ||
@@ -106,5 +106,7 @@ | ||
buf.write(workstation, pos, workstation.length, 'ascii'); pos += workstation.length; // workstation string | ||
buf.write(domain , pos, domain.length , 'ascii'); pos += domain.length; | ||
// length checks is to fix issue #46 and possibly #57 | ||
if(workstation.length !=0) buf.write(workstation, pos, workstation.length, 'ascii'); pos += workstation.length; // workstation string | ||
if(domain.length !=0) buf.write(domain , pos, domain.length , 'ascii'); pos += domain.length; // domain string | ||
return 'NTLM ' + buf.toString('base64'); | ||
@@ -115,4 +117,6 @@ } | ||
var match = rawmsg.match(/NTLM (.+)?/); | ||
if(!match || !match[1]) | ||
return callback(new Error("Couldn't find NTLM in the message type2 comming from the server")); | ||
if(!match || !match[1]) { | ||
callback(new Error("Couldn't find NTLM in the message type2 comming from the server")); | ||
return null; | ||
} | ||
@@ -126,4 +130,6 @@ var buf = new Buffer(match[1], 'base64'); | ||
if(msg.type != 2) | ||
return callback(new Error("Server didn't return a type 2 message")); | ||
if(msg.type != 2) { | ||
callback(new Error("Server didn't return a type 2 message")); | ||
return null; | ||
} | ||
@@ -130,0 +136,0 @@ msg.targetNameLen = buf.readInt16LE(12); |
{ | ||
"name": "httpntlm", | ||
"description": "httpntlm is a Node.js library to do HTTP NTLM authentication", | ||
"version": "1.7.1", | ||
"version": "1.7.3", | ||
"dependencies": { | ||
@@ -6,0 +6,0 @@ "httpreq": ">=0.4.22", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26593
419