libntlm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Example program/docs


From: Simon Josefsson
Subject: Re: Example program/docs
Date: Thu, 08 May 2008 13:39:08 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux)

"Duncan Berriman" <address@hidden> writes:

> Hi Simon,
>
> Trying libntlm and having issues. Taken from README and adapted for my C
> test code.
>
> Example
>
> buildSmbNtlmAuthRequest(&ntlm_request,authuser,"test");               // ???
> memcpy(message,&ntlm_request, SmbLength(&ntlm_request));
> message[SmbLength(&ntlm_request)]='\0';
> reportlog(message);
>
> Output is
>
> NTLMSSP
>
> Or in base64 TlRMTVNTUA==
>
> This is what is expected but too short. The username and domain ("test") do
> not appear to have been applied. I guess SmbLength might not be returning
> the length in characters, what does it return and if its not the length in
> characters of the Auth Request how do I get it?
>
> Also a type 1 ntlm message which I think this is should have the domain and
> workstation in. There should not be the username. So libntlm appears at odds
> with the specification. The username appears in the final (type 3) packet.
>
> I must be doing something wrong.

Yes, the message buffer contains binary data and will contain \0's
before the end of the string.  The length of the string is
SmbLength(&ntlm_request), not strlen (&ntlm_request).  You need to print
SmbLength(&ntlm_request) characters (preferrably as hex to avoid control
characters...) from the message buffer to see all data.

Btw, you can check out how GNU SASL uses libntlm, see
gsasl-*/lib/ntlm/ntlm.c.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]