FreeRDP
TestNTLM.c File Reference
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/sspi.h>
#include <winpr/print.h>
#include <winpr/wlog.h>

Macros

#define TEST_SSPI_INTERFACE   SSPI_INTERFACE_WINPR
 
#define NTLM_PACKAGE_NAME   NTLM_SSP_NAME
 

Functions

static int test_ntlm_client_init (TEST_NTLM_CLIENT *ntlm, const char *user, const char *domain, const char *password)
 
static void test_ntlm_client_uninit (TEST_NTLM_CLIENT *ntlm)
 
static int test_ntlm_client_authenticate (TEST_NTLM_CLIENT *ntlm)
 
static TEST_NTLM_CLIENT * test_ntlm_client_new (void)
 
static void test_ntlm_client_free (TEST_NTLM_CLIENT *ntlm)
 
static int test_ntlm_server_init (TEST_NTLM_SERVER *ntlm)
 
static void test_ntlm_server_uninit (TEST_NTLM_SERVER *ntlm)
 
static int test_ntlm_server_authenticate (TEST_NTLM_SERVER *ntlm)
 
static TEST_NTLM_SERVER * test_ntlm_server_new (void)
 
static void test_ntlm_server_free (TEST_NTLM_SERVER *ntlm)
 
static BOOL test_default (void)
 
int TestNTLM (int argc, char *argv[])
 

Variables

static BYTE TEST_NTLM_TIMESTAMP [8] = { 0x33, 0x57, 0xbd, 0xb1, 0x07, 0x8b, 0xcf, 0x01 }
 
static BYTE TEST_NTLM_CLIENT_CHALLENGE [8] = { 0x20, 0xc0, 0x2b, 0x3d, 0xc0, 0x61, 0xa7, 0x73 }
 
static BYTE TEST_NTLM_SERVER_CHALLENGE [8] = { 0xa4, 0xf1, 0xba, 0xa6, 0x7c, 0xdc, 0x1a, 0x12 }
 
static BYTE TEST_NTLM_NEGOTIATE []
 
static BYTE TEST_NTLM_CHALLENGE []
 
static BYTE TEST_NTLM_AUTHENTICATE []
 
static const char * TEST_NTLM_USER = "Username"
 
static const char * TEST_NTLM_DOMAIN = "Domain"
 
static const char * TEST_NTLM_PASSWORD = "P4ss123!"
 
static const BYTE TEST_NTLM_HASH [16]
 
static const BYTE TEST_NTLM_V2_HASH [16]
 

Macro Definition Documentation

◆ NTLM_PACKAGE_NAME

#define NTLM_PACKAGE_NAME   NTLM_SSP_NAME

◆ TEST_SSPI_INTERFACE

#define TEST_SSPI_INTERFACE   SSPI_INTERFACE_WINPR

Function Documentation

◆ test_default()

static BOOL test_default ( void  )
static

Client Initialization

Server Initialization

Client -> Negotiate Message

Server <- Negotiate Message Server -> Challenge Message

Client <- Challenge Message Client -> Authenticate Message

Server <- Authenticate Message

Cleanup & Termination

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_ntlm_client_authenticate()

static int test_ntlm_client_authenticate ( TEST_NTLM_CLIENT *  ntlm)
static
                                SSPI Client Ceremony

                                   --------------
                                  ( Client Begin )
                                   --------------
                                         |
                                         |
                                        \|/
                              -----------+--------------
                             | AcquireCredentialsHandle |
                              --------------------------
                                         |
                                         |
                                        \|/
                            -------------+--------------
         +---------------> / InitializeSecurityContext /
         |                 ----------------------------
         |                               |
         |                               |
         |                              \|/

------------------------— ------—+----------— -------------------— / Receive blob from server / < Received security blob? > –Yes-> / Send blob to server / ----------—+----------— --------------------— -------------------— /|\ | | | No | Yes |/ | | ---------—+--------— |

+-------------— < Received Continue Needed > <--------------—+

| No |/ ---—+----—

( Client End )

Here is the caller graph for this function:

◆ test_ntlm_client_free()

static void test_ntlm_client_free ( TEST_NTLM_CLIENT *  ntlm)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_ntlm_client_init()

static int test_ntlm_client_init ( TEST_NTLM_CLIENT *  ntlm,
const char *  user,
const char *  domain,
const char *  password 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_ntlm_client_new()

static TEST_NTLM_CLIENT* test_ntlm_client_new ( void  )
static
Here is the caller graph for this function:

◆ test_ntlm_client_uninit()

static void test_ntlm_client_uninit ( TEST_NTLM_CLIENT *  ntlm)
static
Here is the caller graph for this function:

◆ test_ntlm_server_authenticate()

static int test_ntlm_server_authenticate ( TEST_NTLM_SERVER *  ntlm)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_ntlm_server_free()

static void test_ntlm_server_free ( TEST_NTLM_SERVER *  ntlm)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_ntlm_server_init()

static int test_ntlm_server_init ( TEST_NTLM_SERVER *  ntlm)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_ntlm_server_new()

static TEST_NTLM_SERVER* test_ntlm_server_new ( void  )
static
Here is the caller graph for this function:

◆ test_ntlm_server_uninit()

static void test_ntlm_server_uninit ( TEST_NTLM_SERVER *  ntlm)
static
Here is the caller graph for this function:

◆ TestNTLM()

int TestNTLM ( int  argc,
char *  argv[] 
)
Here is the call graph for this function:

Variable Documentation

◆ TEST_NTLM_AUTHENTICATE

BYTE TEST_NTLM_AUTHENTICATE[]
static
Initial value:
=
"\x4e\x54\x4c\x4d\x53\x53\x50\x00\x03\x00\x00\x00\x18\x00\x18\x00"
"\x82\x00\x00\x00\x08\x01\x08\x01\x9a\x00\x00\x00\x0c\x00\x0c\x00"
"\x58\x00\x00\x00\x10\x00\x10\x00\x64\x00\x00\x00\x0e\x00\x0e\x00"
"\x74\x00\x00\x00\x00\x00\x00\x00\xa2\x01\x00\x00\x05\x82\x88\xa2"
"\x06\x03\x80\x25\x00\x00\x00\x0f\x12\xe5\x5a\xf5\x80\xee\x3f\x29"
"\xe1\xde\x90\x4d\x73\x77\x06\x25\x44\x00\x6f\x00\x6d\x00\x61\x00"
"\x69\x00\x6e\x00\x55\x00\x73\x00\x65\x00\x72\x00\x6e\x00\x61\x00"
"\x6d\x00\x65\x00\x4e\x00\x45\x00\x57\x00\x59\x00\x45\x00\x41\x00"
"\x52\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x62\x14\x68\xc8\x98\x12"
"\xe7\x39\xd8\x76\x1b\xe9\xf7\x54\xb5\xe3\x01\x01\x00\x00\x00\x00"
"\x00\x00\x33\x57\xbd\xb1\x07\x8b\xcf\x01\x20\xc0\x2b\x3d\xc0\x61"
"\xa7\x73\x00\x00\x00\x00\x02\x00\x0e\x00\x4e\x00\x45\x00\x57\x00"
"\x59\x00\x45\x00\x41\x00\x52\x00\x01\x00\x0e\x00\x4e\x00\x45\x00"
"\x57\x00\x59\x00\x45\x00\x41\x00\x52\x00\x04\x00\x1c\x00\x6c\x00"
"\x61\x00\x62\x00\x2e\x00\x77\x00\x61\x00\x79\x00\x6b\x00\x2e\x00"
"\x6c\x00\x6f\x00\x63\x00\x61\x00\x6c\x00\x03\x00\x0e\x00\x6e\x00"
"\x65\x00\x77\x00\x79\x00\x65\x00\x61\x00\x72\x00\x07\x00\x08\x00"
"\x33\x57\xbd\xb1\x07\x8b\xcf\x01\x06\x00\x04\x00\x02\x00\x00\x00"
"\x08\x00\x30\x00\x30\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
"\x00\x20\x00\x00\x1e\x10\xf5\x2c\x54\x2f\x2e\x77\x1c\x13\xbf\xc3"
"\x3f\xe1\x7b\x28\x7e\x0b\x93\x5a\x39\xd2\xce\x12\xd7\xbd\x8c\x4e"
"\x2b\xb5\x0b\xf5\x0a\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x09\x00\x1a\x00\x48\x00\x54\x00"
"\x54\x00\x50\x00\x2f\x00\x72\x00\x77\x00\x2e\x00\x6c\x00\x6f\x00"
"\x63\x00\x61\x00\x6c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00"

◆ TEST_NTLM_CHALLENGE

BYTE TEST_NTLM_CHALLENGE[]
static
Initial value:
=
"\x4e\x54\x4c\x4d\x53\x53\x50\x00\x02\x00\x00\x00\x00\x00\x00\x00"
"\x38\x00\x00\x00\x07\x82\x88\xa2\xa4\xf1\xba\xa6\x7c\xdc\x1a\x12"
"\x00\x00\x00\x00\x00\x00\x00\x00\x66\x00\x66\x00\x38\x00\x00\x00"
"\x06\x03\x80\x25\x00\x00\x00\x0f\x02\x00\x0e\x00\x4e\x00\x45\x00"
"\x57\x00\x59\x00\x45\x00\x41\x00\x52\x00\x01\x00\x0e\x00\x4e\x00"
"\x45\x00\x57\x00\x59\x00\x45\x00\x41\x00\x52\x00\x04\x00\x1c\x00"
"\x6c\x00\x61\x00\x62\x00\x2e\x00\x77\x00\x61\x00\x79\x00\x6b\x00"
"\x2e\x00\x6c\x00\x6f\x00\x63\x00\x61\x00\x6c\x00\x03\x00\x0e\x00"
"\x6e\x00\x65\x00\x77\x00\x79\x00\x65\x00\x61\x00\x72\x00\x07\x00"
"\x08\x00\x33\x57\xbd\xb1\x07\x8b\xcf\x01\x00\x00\x00\x00"

◆ TEST_NTLM_CLIENT_CHALLENGE

BYTE TEST_NTLM_CLIENT_CHALLENGE[8] = { 0x20, 0xc0, 0x2b, 0x3d, 0xc0, 0x61, 0xa7, 0x73 }
static

◆ TEST_NTLM_DOMAIN

const char* TEST_NTLM_DOMAIN = "Domain"
static

◆ TEST_NTLM_HASH

const BYTE TEST_NTLM_HASH[16]
static
Initial value:
= { 0xd5, 0x92, 0x2a, 0x65, 0xc4, 0xd5, 0xc0, 0x82,
0xca, 0x44, 0x4a, 0xf1, 0xbe, 0x00, 0x01, 0xdb }

◆ TEST_NTLM_NEGOTIATE

BYTE TEST_NTLM_NEGOTIATE[]
static
Initial value:
=
"\x4e\x54\x4c\x4d\x53\x53\x50\x00\x01\x00\x00\x00\x07\x82\x08\xa2"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x06\x03\x80\x25\x00\x00\x00\x0f"

◆ TEST_NTLM_PASSWORD

const char* TEST_NTLM_PASSWORD = "P4ss123!"
static

◆ TEST_NTLM_SERVER_CHALLENGE

BYTE TEST_NTLM_SERVER_CHALLENGE[8] = { 0xa4, 0xf1, 0xba, 0xa6, 0x7c, 0xdc, 0x1a, 0x12 }
static

◆ TEST_NTLM_TIMESTAMP

BYTE TEST_NTLM_TIMESTAMP[8] = { 0x33, 0x57, 0xbd, 0xb1, 0x07, 0x8b, 0xcf, 0x01 }
static

◆ TEST_NTLM_USER

const char* TEST_NTLM_USER = "Username"
static

◆ TEST_NTLM_V2_HASH

const BYTE TEST_NTLM_V2_HASH[16]
static
Initial value:
= { 0x4c, 0x7f, 0x70, 0x6f, 0x7d, 0xde, 0x05, 0xa9,
0xd1, 0xa0, 0xf4, 0xe7, 0xff, 0xe3, 0xbf, 0xb8 }