1 /* Proxytunnel - (C) 2001-2008 Jos Visser / Mark Janssen    */
2 /* Contact:                  josv@osp.nl / maniac@maniac.nl */
3 
4 /*
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 /* ntlm.h */
21 void build_type1();
22 int parse_type2(unsigned char *buf);
23 void build_type3_response();
24 
25 void build_ntlm2_response();
26 
27 extern int ntlm_challenge;
28 
29 extern char ntlm_type1_buf[160];
30 extern char ntlm_type3_buf[4096];
31 
32 
33 // Below are the flag definitions.
34 #define NEG_UNICODE		0x00000001
35 #define NEG_OEM			0x00000002
36 #define REQ_TARGET		0x00000004
37 #define NEG_NTLM		0x00000200
38 #define NEG_DOMAIN		0x00001000
39 #define NEG_WORK		0x00002000
40 #define NEG_LOCAL		0x00004000
41 #define NEG_ASIGN		0x00008000
42 #define TAR_DOMAIN		0x00010000
43 #define TAR_SERVER		0x00020000
44 #define TAR_SHARE		0x00040000
45 #define NEG_NTLM2		0x00080000
46 #define NEG_TARINFO		0x00800000
47 #define	IE_SETSTHIS		0x02000000
48 #define NEG_128			0x20000000
49 #define NEG_56			0x80000000
50 
51 // Below are the NTLM Message Types
52 #define NTLM_TYPE_1		0x00000001
53 #define NTLM_TYPE_2		0x00000002
54 #define NTLM_TYPE_3		0x00000003
55 
56 
57 typedef struct {
58 	unsigned short	length;
59 	unsigned short	space;
60 	unsigned long	offset;
61 } security_buf_t;
62 
63 typedef struct {
64 	unsigned char	signature[8];
65 	unsigned long	message_type;
66 	unsigned long	flags;
67 	security_buf_t	domain;
68 	security_buf_t	workstation;
69 } ntlm_type1;
70 
71 typedef struct {
72 	unsigned char	signature[8];
73 	unsigned long	message_type;
74 	security_buf_t	target_name;
75 	unsigned long	flags;
76 	unsigned char	challenge[8];
77 	unsigned long	context1;
78 	unsigned long	context2;
79 	security_buf_t	target_info;
80 	unsigned char	data_start;
81 } ntlm_type2;
82 
83 typedef struct {
84 	unsigned char	signature[8];
85 	unsigned long	message_type;
86 	security_buf_t	LM_response;
87 	security_buf_t	NTLM_response;
88 	security_buf_t	domain;
89 	security_buf_t	user;
90 	security_buf_t	workstation;
91 	unsigned char	session[8];
92 	unsigned long	flags;
93 	unsigned char	pad[8];
94 
95 } ntlm_type3;
96 
97 typedef struct {
98 	unsigned char	digest[16];
99 	unsigned long	signature;
100 	unsigned long	reserved;
101 	unsigned long long	timestamp;
102 	unsigned char	client_challenge[8];
103 	unsigned long	unknown;
104 	unsigned long	data_start;
105 } blob;
106 
107 // vim:noexpandtab:ts=4
108