]> Pileus Git - ~andy/fetchmail/blob - ntlm.h
Minor bug fixes for socket.c
[~andy/fetchmail] / ntlm.h
1 /* ntlm.h  -- interface declarations for SMB authentication code */
2
3 #include "smbtypes.h"
4
5 /* 
6  * These structures are byte-order dependant, and should not
7  * be manipulated except by the use of the routines provided
8  */
9
10 typedef struct
11 {
12 uint16  len;
13 uint16  maxlen;
14 uint32  offset;
15 }tSmbStrHeader;
16
17 typedef struct
18 {
19 char          ident[8];
20 uint32        msgType;
21 uint32        flags;
22 tSmbStrHeader    user;
23 tSmbStrHeader    domain;
24 uint8         buffer[1024];
25 uint32        bufIndex;
26 }tSmbNtlmAuthRequest;
27
28 typedef struct
29 {
30 char          ident[8];
31 uint32        msgType;
32 tSmbStrHeader    uDomain;
33 uint32        flags;
34 uint8         challengeData[8];
35 uint32        context[2];
36 tSmbStrHeader    targetInfo;
37 uint8         buffer[1024];
38 uint32        bufIndex;
39 }tSmbNtlmAuthChallenge;
40
41
42 typedef struct
43 {
44 char          ident[8];
45 uint32        msgType;
46 tSmbStrHeader    lmResponse;
47 tSmbStrHeader    ntResponse;
48 tSmbStrHeader    uDomain;
49 tSmbStrHeader    uUser;
50 tSmbStrHeader    uWks;
51 tSmbStrHeader    sessionKey;
52 uint32        flags;
53 uint8         buffer[1024];
54 uint32        bufIndex;
55 }tSmbNtlmAuthResponse;
56
57 /* public: */
58
59 #define SmbLength(ptr) (((ptr)->buffer - (uint8*)(ptr)) + (ptr)->bufIndex)
60
61 extern void dumpSmbNtlmAuthRequest(FILE *fp, tSmbNtlmAuthRequest *request);
62 extern void dumpSmbNtlmAuthChallenge(FILE *fp, tSmbNtlmAuthChallenge *challenge);
63 extern void dumpSmbNtlmAuthResponse(FILE *fp, tSmbNtlmAuthResponse *response);
64
65 extern void buildSmbNtlmAuthRequest(tSmbNtlmAuthRequest *request, char *user, char *domain);
66 extern void buildSmbNtlmAuthResponse(tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, char *user, char *password);
67
68 /* ntlm.h ends here */