C:/Web/smbrelay3/src/ntlm.h File Reference

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>

Include dependency graph for ntlm.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tSmbStrItem
struct  NtlmV2Packet
struct  tSmbStrHeader
struct  tSmbNtlmAuthRequest
struct  tSmbNtlmAuthChallenge
struct  tSmbNtlmAuthResponse

Defines

#define _strdup   strdup
#define SERVERNAMEITEM   0x01
#define DOMAINNAMEITEM   0x02
#define DNSITEM   0x03
#define FQDNITEM   0x04
#define NtlmChallengeSize(Challenge)   ( sizeof(tSmbNtlmAuthChallenge) - sizeof(Challenge->buffer) +Challenge->uDomain.maxlen + Challenge->emptyString.maxlen)
#define SmbLength(ptr)   (((ptr)->buffer - (uint8*)(ptr)) + (ptr)->bufIndex)

Typedefs

typedef unsigned short uint16
typedef unsigned int uint32
typedef unsigned long long int uint64
typedef unsigned char uint8

Functions

void BuildAuthRequest (tSmbNtlmAuthRequest *request, long flags, char *host, char *domain)
void BuildAuthChallenge (tSmbNtlmAuthChallenge *pChallenge, char *DomainName, char *ServerName, char *DNS, char *FQDN, uint8 flags, uint8 *SpoofedChallenge)
void buildAuthResponse (tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, long flags, char *user, char *password, char *domainname, char *host, tSmbNtlmAuthResponse *OptionalNtlmPacket3)
__inline void SetChallengeKey (tSmbNtlmAuthChallenge *challenge, uint8 *SpoofedChallenge)
int from64tobits (char *out, const char *in)
void to64frombits (unsigned char *out, const unsigned char *in, int inlen)
void dumpAuthRequest (FILE *fp, tSmbNtlmAuthRequest *request)
void dumpAuthChallenge (FILE *fp, tSmbNtlmAuthChallenge *challenge)
void dumpAuthResponse (FILE *fp, tSmbNtlmAuthResponse *response)
void GetNTLMPacketInfo (tSmbNtlmAuthResponse *NtlmAuthResponse, char *UserName, char *DomainName, char *WorkstationName, int verbose)
void chartoWide (char *destination, char *source, int len)
void Widetochar (char *destination, char *source, int len)


Define Documentation

#define _strdup   strdup

Definition at line 90 of file ntlm.h.

#define DNSITEM   0x03

Definition at line 104 of file ntlm.h.

Referenced by BuildAuthChallenge().

#define DOMAINNAMEITEM   0x02

Definition at line 103 of file ntlm.h.

Referenced by BuildAuthChallenge().

#define FQDNITEM   0x04

Definition at line 105 of file ntlm.h.

Referenced by BuildAuthChallenge().

#define NtlmChallengeSize ( Challenge   )     ( sizeof(tSmbNtlmAuthChallenge) - sizeof(Challenge->buffer) +Challenge->uDomain.maxlen + Challenge->emptyString.maxlen)

Definition at line 196 of file ntlm.h.

#define SERVERNAMEITEM   0x01

Definition at line 102 of file ntlm.h.

Referenced by BuildAuthChallenge().

#define SmbLength ( ptr   )     (((ptr)->buffer - (uint8*)(ptr)) + (ptr)->bufIndex)

Definition at line 215 of file ntlm.h.

Referenced by BuildSmbPacket1(), GetSmbPacket3(), HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().


Typedef Documentation

typedef unsigned short uint16

Definition at line 95 of file ntlm.h.

typedef unsigned int uint32

Definition at line 96 of file ntlm.h.

typedef unsigned long long int uint64

Definition at line 97 of file ntlm.h.

typedef unsigned char uint8

Definition at line 98 of file ntlm.h.


Function Documentation

void BuildAuthChallenge ( tSmbNtlmAuthChallenge pChallenge,
char *  DomainName,
char *  ServerName,
char *  DNS,
char *  FQDN,
uint8  flags,
uint8 SpoofedChallenge 
)

Definition at line 1437 of file ntlm.cpp.

References tSmbStrItem::buffer, tSmbNtlmAuthChallenge::buffer, tSmbNtlmAuthChallenge::challengeData, chartoWide(), DNSITEM, DOMAINNAMEITEM, tSmbNtlmAuthChallenge::emptyString, tSmbNtlmAuthChallenge::flags, FQDNITEM, tSmbNtlmAuthChallenge::ident, tSmbStrItem::ItemLength, tSmbStrItem::ItemType, tSmbStrHeader::len, tSmbStrHeader::maxlen, tSmbNtlmAuthChallenge::msgType, tSmbStrHeader::offset, tSmbNtlmAuthChallenge::reserved, SERVERNAMEITEM, and tSmbNtlmAuthChallenge::uDomain.

Here is the call graph for this function:

void BuildAuthRequest ( tSmbNtlmAuthRequest request,
long  flags,
char *  host,
char *  domain 
)

Definition at line 1224 of file ntlm.cpp.

Referenced by BuildSmbPacket1().

void buildAuthResponse ( tSmbNtlmAuthChallenge challenge,
tSmbNtlmAuthResponse response,
long  flags,
char *  user,
char *  password,
char *  domainname,
char *  host,
tSmbNtlmAuthResponse OptionalNtlmPacket3 
)

Definition at line 1298 of file ntlm.cpp.

Referenced by GetSmbPacket3(), HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().

void chartoWide ( char *  destination,
char *  source,
int  len 
)

Definition at line 1417 of file ntlm.cpp.

Referenced by BuildAuthChallenge(), BuildSmbPacket(), BuildTreeConnectAndXStub(), ChangeServiceConfigWStub(), InitDataBlock(), and OpenScManagerWStub().

void dumpAuthChallenge ( FILE *  fp,
tSmbNtlmAuthChallenge challenge 
)

Definition at line 1511 of file ntlm.cpp.

Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), HandleIncommingSmbRequest(), HandleIncommingSMTPRequest(), and StablishNTLMSession().

void dumpAuthRequest ( FILE *  fp,
tSmbNtlmAuthRequest request 
)

Definition at line 1391 of file ntlm.cpp.

References tSmbNtlmAuthRequest::ident, IVAL, and tSmbNtlmAuthRequest::msgType.

Referenced by HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().

void dumpAuthResponse ( FILE *  fp,
tSmbNtlmAuthResponse response 
)

Definition at line 1591 of file ntlm.cpp.

Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().

int from64tobits ( char *  out,
const char *  in 
)

Definition at line 1695 of file ntlm.cpp.

Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().

void GetNTLMPacketInfo ( tSmbNtlmAuthResponse NtlmAuthResponse,
char *  UserName,
char *  DomainName,
char *  WorkstationName,
int  verbose 
)

Definition at line 1622 of file ntlm.cpp.

Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), HandleIncommingSMTPRequest(), and WriteDataToReportFile().

__inline void SetChallengeKey ( tSmbNtlmAuthChallenge challenge,
uint8 SpoofedChallenge 
)

Definition at line 1427 of file ntlm.cpp.

void to64frombits ( unsigned char *  out,
const unsigned char *  in,
int  inlen 
)

Definition at line 1669 of file ntlm.cpp.

Referenced by HandleIncommingHTTPRequest(), HandleIncommingIMAPRequest(), HandleIncommingPOP3Request(), and HandleIncommingSMTPRequest().

void Widetochar ( char *  destination,
char *  source,
int  len 
)

Definition at line 1405 of file ntlm.cpp.

Referenced by HandleIncommingSmbRequest().


Generated on Wed Nov 12 22:04:28 2008 for Smbrelay version 3 by  doxygen 1.5.4