/* $Id: ntlmauth.h,v 1.3 2003/07/25 15:00:07 thivillon Exp $ */ typedef unsigned char byte; typedef struct { byte protocol[8]; byte type; // 0x01 byte zero_1[3]; byte flags[2]; // 0xb203 byte zero_2[2]; byte dom_len[2]; // domain string length byte dom_len_2[2]; // domain string length byte dom_off[2]; // domain string offset byte zero_3[2]; byte host_len[2]; // host string length byte host_len_2[2]; // host string length byte host_off[2]; // host string offset (always 0x20) byte zero_4[2]; } mess_ntlm_1; typedef struct { byte protocol[8]; // 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' byte type; // 0x02 byte zero_1[7]; byte msg_len[2]; // 0x28 byte zero_2[2]; byte flags[2]; byte zero_3[2]; byte nonce[8]; // nonce byte zero_4[8]; } mess_ntlm_2; typedef struct { byte protocol[8]; // 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' byte type; // 0x03 byte zero_1[3]; byte lm_resp_len_1[2]; // LanManager response length (always 0x18) byte lm_resp_len_2[2]; // LanManager response length (always 0x18) byte lm_resp_off[2]; // LanManager response offset byte zero_2[2]; byte nt_resp_len_1[2]; // NT response length (always 0x18) byte nt_resp_len_2[2]; // NT response length (always 0x18) byte nt_resp_off[2]; // NT response offset byte zero_8[2]; byte dom_len_1[2]; // domain string length byte dom_len_2[2]; // domain string length byte dom_off[2]; // domain string offset (always 0x40) byte zero_3[2]; byte user_len_1[2]; // username string length byte user_len_2[2]; // username string length byte user_off[2]; // username string offset byte zero_4[2]; byte host_len_1[2]; // host string length byte host_len_2[2]; // host string length byte host_off[2]; // host string offset byte zero_5[6]; byte msg_len[2]; // message length byte zero_6[2]; byte flags[2]; // 0x8201 byte zero_7[2]; } mess_ntlm_3; #define NTLMSSP_HAS_DOMAIN 0x2000 #define NTLMSSP_HAS_WORKGROUP 0x1000 #define NTLMSSP_ALWAYS_SIGN 0x8000 #define NTLMSSP_WANT_NTLM 0x0200 #define NTLMSSP_WANT_LM 0x80 #define NTLMSSP_WANT_OEM 0x02 #define NTLMSSP_WANT_UNICODE 0x01 #define NTLMSSP_NEGOCIATE 0x01 #define NTLMSSP_CHALLENGE 0x02 #define NTLMSSP_AUTH 0x03 #define WWW_AUTH 0 #define PROXY_AUTH 1 extern int do_ntlm_auth (int sock, char *username , char *password, char *uri, char *host, char *useragent, int mode);