NCBI C++ ToolKit
|
#include <config.h>
#include <ctype.h>
#include <freetds/time.h>
#include <freetds/tds.h>
#include <freetds/bytes.h>
#include <freetds/utils/string.h>
#include <freetds/iconv.h>
#include <freetds/utils.h>
#include <freetds/utils/md4.h>
#include <freetds/utils/md5.h>
#include <freetds/utils/hmac_md5.h>
#include <freetds/utils/des.h>
#include <freetds/replacements.h>
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | tds_answer |
struct | names_blob_prefix_t |
struct | tds_ntlm_auth |
Macros | |
#define | MAX_PW_SZ 14 |
#define | TIME_FIXUP_CONSTANT (((uint64_t) 134774U) * 86400U) |
Typedefs | |
typedef struct tds_answer | TDSANSWER |
typedef struct tds_ntlm_auth | TDSNTLMAUTH |
Functions | |
static TDSRET | tds_answer_challenge (TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response) |
Crypt a given password using schema required for NTLMv1 or NTLM2 authentication. More... | |
static void | tds_encrypt_answer (const unsigned char *hash, const unsigned char *challenge, unsigned char *answer) |
static void | tds_convert_key (const unsigned char *key_56, DES_KEY *ks) |
static void | convert_to_upper (char *buf, size_t len) |
static size_t | convert_to_usc2le_string (TDSSOCKET *tds, const char *s, size_t len, char *out) |
static TDSRET | make_ntlm_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_hash[16]) |
static TDSRET | make_ntlm_v2_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_v2_hash[16]) |
static unsigned char * | make_lm_v2_response (const unsigned char ntlm_v2_hash[16], const unsigned char *client_data, int client_data_len, const unsigned char challenge[8]) |
static TDSRET | tds_answer_challenge_ntlmv2 (TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response) |
static TDSRET | tds7_send_auth (TDSSOCKET *tds, const unsigned char *challenge, uint32_t flags, const unsigned char *names_blob, int names_blob_len) |
static TDSRET | tds_ntlm_free (TDSCONNECTION *conn, TDSAUTHENTICATION *tds_auth) |
static void | unix_to_nt_time (uint64_t *nt, struct timeval *tv) |
put a 8 byte filetime from a time_t This takes GMT as input More... | |
static void | fill_names_blob_prefix (names_blob_prefix_t *prefix) |
static TDSRET | tds_ntlm_handle_next (TDSSOCKET *tds, struct tds_authentication *auth, size_t len) |
TDSAUTHENTICATION * | tds_ntlm_get_auth (TDSSOCKET *tds) |
Build a NTLMSPP packet to send to server. More... | |
Variables | |
static const unsigned char | ntlm_id [] = "NTLMSSP" |
#define MAX_PW_SZ 14 |
|
static |
Definition at line 94 of file challenge.c.
References buf, i, len, and toupper().
Referenced by make_ntlm_v2_hash().
|
static |
Definition at line 103 of file challenge.c.
References tds_connection::char_convs, client2ucs2, tds_socket::conn, tdsiconvinfo::flags, if(), len, out(), tdsiconvinfo::suppress, tds, TDS_ENCODING_MEMCPY, tds_iconv, and to_server.
Referenced by make_ntlm_hash(), make_ntlm_v2_hash(), and tds7_send_auth().
|
static |
Definition at line 607 of file challenge.c.
References names_blob_prefix_t::challenge, names_blob_prefix_t::max_response_type, NULL, names_blob_prefix_t::reserved1, names_blob_prefix_t::reserved2, names_blob_prefix_t::response_type, tds_random_buffer, tds_swap_bytes, names_blob_prefix_t::timestamp, unix_to_nt_time(), and names_blob_prefix_t::unknown.
Referenced by tds_ntlm_handle_next().
|
static |
Definition at line 132 of file challenge.c.
References context, convert_to_usc2le_string(), MD4Final, MD4Init, MD4Update, tds, TDS_FAIL, and TDS_SUCCESS.
Referenced by make_ntlm_v2_hash(), and tds_answer_challenge().
|
static |
Definition at line 163 of file challenge.c.
References buf, convert_to_upper(), convert_to_usc2le_string(), hmac_md5, len, tds_socket::login, make_ntlm_hash(), NULL, tds, tds_dstr_cstr(), TDS_FAIL, and tds_login::user_name.
Referenced by tds_answer_challenge_ntlmv2().
Definition at line 400 of file challenge.c.
References ncbi::grid::netcache::search::fields::key, tds_des_set_key, and tds_des_set_odd_parity.
Referenced by tds_answer_challenge(), and tds_encrypt_answer().
|
static |
Definition at line 378 of file challenge.c.
References tds_convert_key(), and tds_des_ecb_encrypt.
Referenced by tds_answer_challenge().
|
static |
Definition at line 574 of file challenge.c.
References free(), tds_authentication::packet, tds_ntlm_auth::tds_auth, and TDS_SUCCESS.
Referenced by tds_ntlm_get_auth().
|
static |
Definition at line 629 of file challenge.c.
References fill_names_blob_prefix(), flags, free(), int, len, ntlm_id, NULL, tds, tds7_send_auth(), TDS_DBG_INFO1, TDS_FAIL, tds_get_int, tds_get_n, tds_get_smallint, tds_new0, TDS_OFFSET, tdsdump_dump_buf, and tdsdump_log.
Referenced by tds_ntlm_get_auth().