[jcifs] NullPointerException in NtlmPasswordAuthentication.getNTLMv2Response(..)

Michael B Allen ioplex at gmail.com
Fri Nov 28 17:43:18 GMT 2008


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/


More information about the jcifs mailing list