[jcifs] NullPointerException in
NtlmPasswordAuthentication.getNTLMv2Response(..)
SD
jcifs at sderman.com
Fri Nov 28 09:59:30 GMT 2008
I had a problem using NTLM authentication. Servers with NTLMv2 worked fine,
servers with NTLM pre v2 got a null pointer error.
targetInfo is null in these cases, below is the updated function from
NtlmPasswordAuthentication.java that has null checks.
public static byte[] getNTLMv2Response(
byte[] responseKeyNT,
byte[] serverChallenge,
byte[] clientChallenge,
long time,
byte[] targetInfo)
{
byte[] temp = new byte[28 + (targetInfo == null ? 0 :
targetInfo.length)];
Encdec.enc_uint32le(0x00000101, temp, 0); // Header
Encdec.enc_uint32le(0x00000000, temp, 4); // Reserved
Encdec.enc_uint64le((time +
SmbConstants.MILLISECONDS_BETWEEN_1970_AND_1601)
* 10000L, temp, 8);
System.arraycopy(clientChallenge, 0, temp, 16, 8);
Encdec.enc_uint32le(0x00000000, temp, 24); // Unknown
if(targetInfo != null)
System.arraycopy(targetInfo, 0, temp, 28, targetInfo.length);
return NtlmPasswordAuthentication.computeResponse(responseKeyNT,
serverChallenge,
temp,
0,
temp.length);
}
More information about the jcifs
mailing list