# Authentication
[LibTDS API]

Functions for handling authentication. More...

## Classes

struct | names_blob_prefix_t
struct | tds_answer
struct | tds_ntlm_auth

## Typedefs

typedef tds_answer | TDSANSWER
typedef tds_ntlm_auth | TDSNTLMAUTH

## Functions

static void | convert_to_upper (char *buf, int len)
static int | convert_to_usc2le_string (TDSSOCKET *tds, const char *s, int len, char *out)
static void | fill_names_blob_prefix (names_blob_prefix_t *prefix)
static void | generate_random_buffer (unsigned char *out, int len)
static unsigned char * | make_lm_v2_response (const unsigned char ntlm_v2_hash[16], const unsigned char *client_data, TDS_INT client_data_len, const unsigned char challenge[8])
static int | make_ntlm_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_hash[16])
static int | make_ntlm_v2_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_v2_hash[16])
static int | tds7_send_auth (TDSSOCKET *tds, const unsigned char *challenge, TDS_UINT flags, const unsigned char *names_blob, TDS_INT names_blob_len)
static int | tds_answer_challenge (TDSSOCKET *tds, TDSCONNECTION *connection, const unsigned char *challenge, TDS_UINT *flags, const unsigned char *names_blob, TDS_INT names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
| Crypt a given password using schema required for NTLMv1 or NTLM2 authentication.
static void | tds_convert_key (const unsigned char *key_56, DES_KEY *ks)
static void | tds_encrypt_answer (const unsigned char *hash, const unsigned char *challenge, unsigned char *answer)
static int | tds_ntlm_free (TDSSOCKET *tds, TDSAUTHENTICATION *tds_auth)
TDSAUTHENTICATION * | tds_ntlm_get_auth (TDSSOCKET *tds)
| Build a NTLMSPP packet to send to server.
static int | tds_ntlm_handle_next (TDSSOCKET *tds, struct tds_authentication *auth, size_t len)
static void | unix_to_nt_time (TDS_UINT8 *nt, time_t t)
| put a 8 byte filetime from a time_t This takes GMT as input

## Variables

static const unsigned char | ntlm_id [] = "NTLMSSP"

## Detailed Description

Functions for handling authentication.

## Function Documentation

static int tds_answer_challenge | ( | TDSSOCKET * | tds,
|  | TDSCONNECTION * | connection,
|  | const unsigned char * | challenge,
|  | TDS_UINT * | flags,
|  | const unsigned char * | names_blob,
|  | TDS_INT | names_blob_len,
|  | TDSANSWER * | answer,
|  | unsigned char ** | ntlm_v2_response
| ) | `[static]`

Crypt a given password using schema required for NTLMv1 or NTLM2 authentication.

Parameters:

  | passwd | clear text domain password
  | challenge | challenge data given by server
  | flags | NTLM flags from server side
  | answer | buffer where to store crypted password

TDSAUTHENTICATION* tds_ntlm_get_auth | ( | TDSSOCKET * | tds | ) |

Build a NTLMSPP packet to send to server.

Parameters:

  | tds | A pointer to the TDSSOCKET structure managing a client/server operation.

Returns:
  authentication info