ntlm_smb_lm_auth.cc File Reference
#include "squid.h"
#include "base64.h"
#include "compat/debug.h"
#include "helper/protocol_defines.h"
#include "ntlmauth/ntlmauth.h"
#include "ntlmauth/support_bits.cci"
#include "rfcnb/rfcnb.h"
#include "smblib/smblib.h"
#include <cassert>
#include <cctype>
#include <cerrno>
#include <csignal>
#include <cstdlib>
#include <cstring>
#include <ctime>
Include dependency graph for ntlm_smb_lm_auth.cc:

Go to the source code of this file.

Classes

struct  _dc
 

Macros

#define DEAD_DC_RETRY_INTERVAL   30
 
#define SEND(X)   debug("sending '%s' to squid\n",X); printf(X "\n");
 
#define SEND2   printf
 
#define SEND3   printf
 
#define ENCODED_PASS_LEN   24
 
#define MAX_USERNAME_LEN   255
 
#define MAX_DOMAIN_LEN   255
 
#define MAX_PASSWD_LEN   31
 

Typedefs

typedef struct _dc dc
 

Functions

const char * make_challenge (char *domain, char *controller)
 
char * ntlm_check_auth (ntlm_authenticate *auth, int auth_length)
 
void dc_disconnect (void)
 
int connectedp (void)
 
int is_dc_ok (char *domain, char *domain_controller)
 
void usage (void)
 
void process_options (int argc, char *argv[])
 
const char * obtain_challenge (void)
 
void manage_request (void)
 
static int init_challenge (char *domain, char *domain_controller)
 
void timeout_during_auth (int signum)
 
int main (int argc, char *argv[])
 

Variables

static unsigned char challenge [NTLM_NONCE_LEN]
 
static unsigned char lmencoded_empty_pass [ENCODED_PASS_LEN]
 
static unsigned char ntencoded_empty_pass [ENCODED_PASS_LEN]
 
SMB_Handle_Type handle = nullptr
 
int ntlm_errno
 
static char credentials [MAX_USERNAME_LEN+MAX_DOMAIN_LEN+2]
 
static char my_domain [100]
 
static char my_domain_controller [100]
 
static char errstr [1001]
 
char load_balance = 0
 
char protocol_pedantic = 0
 
dccontrollers = nullptr
 
int numcontrollers = 0
 
dccurrent_dc
 
char smb_error_buffer [1000]
 
static char got_timeout = 0
 
char * my_program_name = nullptr
 

Macro Definition Documentation

◆ DEAD_DC_RETRY_INTERVAL

#define DEAD_DC_RETRY_INTERVAL   30

Definition at line 52 of file ntlm_smb_lm_auth.cc.

◆ ENCODED_PASS_LEN

#define ENCODED_PASS_LEN   24

Definition at line 87 of file ntlm_smb_lm_auth.cc.

◆ MAX_DOMAIN_LEN

#define MAX_DOMAIN_LEN   255

Definition at line 89 of file ntlm_smb_lm_auth.cc.

◆ MAX_PASSWD_LEN

#define MAX_PASSWD_LEN   31

Definition at line 90 of file ntlm_smb_lm_auth.cc.

◆ MAX_USERNAME_LEN

#define MAX_USERNAME_LEN   255

Definition at line 88 of file ntlm_smb_lm_auth.cc.

◆ SEND

#define SEND (   X)    debug("sending '%s' to squid\n",X); printf(X "\n");

Definition at line 57 of file ntlm_smb_lm_auth.cc.

◆ SEND2

#define SEND2   printf

Definition at line 63 of file ntlm_smb_lm_auth.cc.

◆ SEND3

#define SEND3   printf

Definition at line 64 of file ntlm_smb_lm_auth.cc.

Typedef Documentation

◆ dc

typedef struct _dc dc

Definition at line 73 of file ntlm_smb_lm_auth.cc.

Function Documentation

◆ connectedp()

int connectedp ( void  )

Definition at line 120 of file ntlm_smb_lm_auth.cc.

References handle, and NULL.

◆ dc_disconnect()

void dc_disconnect ( void  )

Definition at line 112 of file ntlm_smb_lm_auth.cc.

References handle, NULL, and SMB_Discon().

Referenced by manage_request(), and timeout_during_auth().

◆ init_challenge()

◆ is_dc_ok()

int is_dc_ok ( char *  domain,
char *  domain_controller 
)

Definition at line 127 of file ntlm_smb_lm_auth.cc.

References NULL, SMB_Connect_Server(), and SMB_Discon().

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ make_challenge()

◆ manage_request()

◆ ntlm_check_auth()

◆ obtain_challenge()

const char * obtain_challenge ( void  )

tries connecting to the domain controllers in the "controllers" ring, with failover if the adequate option is specified.

Definition at line 459 of file ntlm_smb_lm_auth.cc.

References _dc::controller, current_dc, _dc::dead, DEAD_DC_RETRY_INTERVAL, debug(), _dc::domain, make_challenge(), _dc::next, NULL, and numcontrollers.

Referenced by manage_request().

◆ process_options()

void process_options ( int  argc,
char *  argv[] 
)

◆ timeout_during_auth()

void timeout_during_auth ( int  )

signal handler to be invoked when the authentication operation times out

Definition at line 347 of file ntlm_smb_lm_auth.cc.

References dc_disconnect().

Referenced by manage_request().

◆ usage()

void usage ( void  )

Definition at line 363 of file ntlm_smb_lm_auth.cc.

References my_program_name.

Referenced by process_options().

Variable Documentation

◆ challenge

unsigned char challenge[NTLM_NONCE_LEN]
static

Definition at line 92 of file ntlm_smb_lm_auth.cc.

Referenced by init_challenge(), and make_challenge().

◆ controllers

dc* controllers = nullptr

Definition at line 104 of file ntlm_smb_lm_auth.cc.

Referenced by main(), and process_options().

◆ credentials

char credentials[MAX_USERNAME_LEN+MAX_DOMAIN_LEN+2]
static

Definition at line 97 of file ntlm_smb_lm_auth.cc.

Referenced by GenServerContext(), and ntlm_check_auth().

◆ current_dc

dc* current_dc

Definition at line 106 of file ntlm_smb_lm_auth.cc.

Referenced by main(), and obtain_challenge().

◆ errstr

char errstr[1001]
static

Definition at line 99 of file ntlm_smb_lm_auth.cc.

Referenced by checkForPortOnly(), init_challenge(), and main().

◆ got_timeout

char got_timeout = 0
static

Definition at line 343 of file ntlm_smb_lm_auth.cc.

Referenced by manage_request().

◆ handle

SMB_Handle_Type handle = nullptr

◆ lmencoded_empty_pass

unsigned char lmencoded_empty_pass[ENCODED_PASS_LEN]
static

Definition at line 93 of file ntlm_smb_lm_auth.cc.

Referenced by init_challenge(), and ntlm_check_auth().

◆ load_balance

char load_balance = 0

Definition at line 103 of file ntlm_smb_lm_auth.cc.

Referenced by main(), and process_options().

◆ my_domain

char my_domain[100]
static

Definition at line 98 of file ntlm_smb_lm_auth.cc.

Referenced by make_challenge().

◆ my_domain_controller

char my_domain_controller[100]
static

Definition at line 98 of file ntlm_smb_lm_auth.cc.

Referenced by make_challenge().

◆ my_program_name

char* my_program_name = nullptr

Definition at line 360 of file ntlm_smb_lm_auth.cc.

Referenced by main(), and usage().

◆ ntencoded_empty_pass

unsigned char ntencoded_empty_pass[ENCODED_PASS_LEN]
static

Definition at line 94 of file ntlm_smb_lm_auth.cc.

Referenced by init_challenge(), and ntlm_check_auth().

◆ ntlm_errno

int ntlm_errno

Definition at line 96 of file ntlm_smb_lm_auth.cc.

Referenced by manage_request(), and ntlm_check_auth().

◆ numcontrollers

int numcontrollers = 0

Definition at line 105 of file ntlm_smb_lm_auth.cc.

Referenced by main(), obtain_challenge(), and process_options().

◆ protocol_pedantic

char protocol_pedantic = 0

Definition at line 103 of file ntlm_smb_lm_auth.cc.

◆ smb_error_buffer

char smb_error_buffer[1000]

Definition at line 107 of file ntlm_smb_lm_auth.cc.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors