[jcifs] NullPointerException in
NtlmPasswordAuthentication.getNTLMv2Response(..)
Michael B Allen
ioplex at gmail.com
Fri Nov 28 20:01:19 GMT 2008
So you're using jcifs.smb.NtlmContext.initSecContext() to do NTLMSSP
manually with another protocol other than CIFS?
Mike
On Fri, Nov 28, 2008 at 2:28 PM, SD <jcifs at sderman.com> wrote:
> One is my internal self-signed testing MS Exchange server.
>
> The other is https://exchange.1and1.com
>
> Thank you.
>
> SD
>
> ______________________________________________________________________
> Previous message on 11/28/08 at 12:43 PM -0500
> **********************************************************************
>>
>> On Fri, Nov 28, 2008 at 4:59 AM, SD <jcifs at sderman.com> wrote:
>>>
>>> I had a problem using NTLM authentication. Servers with NTLMv2 worked
>>> fine,
>>> servers with NTLM pre v2 got a null pointer error.
>>
>> The problem isn't "servers with NTLM pre v2". It's simply that they
>> are not returning the target info. That's a negotiated option.
>>
>>> targetInfo is null in these cases, below is the updated function from
>>> NtlmPasswordAuthentication.java that has null checks.
>>
>> Ok. That seems logical. I'll apply these changes. Just out of
>> curiosity, what are these servers that do not return targetInfo?
>>
>> Mike
>>
>>>
>>> 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);
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Michael B Allen
>> PHP Active Directory SPNEGO SSO
>> http://www.ioplex.com/
>
>
> --
>
> -------------------------------------------------------------
> From,
> Shaun Derman
> shaun at derman.com (604) 614-4094
> (604) 614-8447
> Bus. (604) 637-4894
> http://www.derman.com
>
> ****
> There are two ways to spread the light... to be the candle or the mirror
> which reflects it.
> -- unknown
>
--
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/
More information about the jcifs
mailing list