MySQL 8.0.40
Source Code Documentation
Handshake Class Referenceabstract

Common base for Handshake_{server,client}. More...

#include <handshake.h>

Inheritance diagram for Handshake:
[legend]

Public Types

enum  side_t { CLIENT , SERVER }
 

Public Member Functions

 Handshake (const char *ssp, side_t side)
 Handshake class implementation. More...
 
virtual ~Handshake ()
 
int packet_processing_loop ()
 Read and process data packets from the other end of a connection. More...
 
virtual bool is_complete () const
 
int error () const
 
const char * ssp_name ()
 Get name of the security package which was used in authentication. More...
 

Protected Member Functions

bool process_result (int)
 Process result of {Initialize,Accept}SecurityContext() function. More...
 
virtual Blob process_data (const Blob &data)=0
 This method is used inside packet_processing_loop to process data packets received from the other end. More...
 
virtual Blob read_packet ()=0
 Read packet from the other end. More...
 
virtual int write_packet (Blob &data)=0
 Write packet to the other end. More...
 

Protected Attributes

CtxtHandle m_sctx
 Security context object created during the handshake. More...
 
CredHandle m_cred
 Credentials of the principal performing this handshake. More...
 
TimeStamp m_expire
 Stores expiry date of the created security context. More...
 
ULONG m_atts
 Stores attributes of the created security context. More...
 
unsigned int m_round
 Round of the handshake (starting from round 1). More...
 
int m_error
 If non-zero, stores error code of the last failed operation. More...
 
bool m_complete
 true when handshake is complete. More...
 
bool m_have_credentials
 true when the principal credentials has been determined. More...
 
bool m_have_sec_context
 true when the security context has been created. More...
 
Security_buffer m_output
 Buffer for data to be send to the other side. More...
 

Private Attributes

SecPkgInfo * m_ssp_info
 

Detailed Description

Common base for Handshake_{server,client}.

Member Enumeration Documentation

◆ side_t

Enumerator
CLIENT 
SERVER 

Constructor & Destructor Documentation

◆ Handshake()

Handshake::Handshake ( const char *  ssp,
side_t  side 
)

Handshake class implementation.

Create common part of handshake context.

Parameters
[in]sspname of the SSP (Security Service Provider) to be used for authentication
[in]sideis this handshake object used for server- or client-side handshake

Prepare for handshake using the ssp security module. We use "Negotiate" which picks best available module. Parameter side tells if this is preparing for server or client side authentication and is used to prepare appropriate credentials.

◆ ~Handshake()

Handshake::~Handshake ( )
virtual

Member Function Documentation

◆ error()

int Handshake::error ( ) const
inline

◆ is_complete()

virtual bool Handshake::is_complete ( ) const
inlinevirtual

◆ packet_processing_loop()

int Handshake::packet_processing_loop ( )

Read and process data packets from the other end of a connection.

Packets are read and processed until authentication handshake is complete. It is assumed that the peer will send at least one packet. Packets are processed with process_data() method. If new data is generated during packet processing, this data is sent to the peer and another round of packet exchange starts.

Return values
0on success.
Note
In case of error, appropriate error message is logged.

◆ process_data()

virtual Blob Handshake::process_data ( const Blob data)
protectedpure virtual

This method is used inside packet_processing_loop to process data packets received from the other end.

Parameters
datadata to be processed
Returns
A blob with data to be sent to the other end or null blob if no more data needs to be exchanged.

Implemented in Handshake_client.

◆ process_result()

bool Handshake::process_result ( int  ret)
protected

Process result of {Initialize,Accept}SecurityContext() function.

Parameters
[in]retreturn code from {Initialize,Accept}SecurityContext() function

This function analyses return value of Windows {Initialize,Accept}SecurityContext() function. A call to CompleteAuthToken() is done if requested. If authentication is complete, this fact is marked in the internal state of the Handshake object. If errors are detected the object is moved to error state.

Returns
True if error has been detected.

◆ read_packet()

virtual Blob Handshake::read_packet ( )
protectedpure virtual

Read packet from the other end.

Implemented in Handshake_client.

◆ ssp_name()

const char * Handshake::ssp_name ( )

Get name of the security package which was used in authentication.

This method should be called only after handshake was completed. It is available only in debug builds.

Returns
Name of security package or NULL if it can not be obtained.

◆ write_packet()

virtual int Handshake::write_packet ( Blob data)
protectedpure virtual

Write packet to the other end.

Implemented in Handshake_client.

Member Data Documentation

◆ m_atts

ULONG Handshake::m_atts
protected

Stores attributes of the created security context.

◆ m_complete

bool Handshake::m_complete
protected

true when handshake is complete.

◆ m_cred

CredHandle Handshake::m_cred
protected

Credentials of the principal performing this handshake.

◆ m_error

int Handshake::m_error
protected

If non-zero, stores error code of the last failed operation.

◆ m_expire

TimeStamp Handshake::m_expire
protected

Stores expiry date of the created security context.

◆ m_have_credentials

bool Handshake::m_have_credentials
protected

true when the principal credentials has been determined.

◆ m_have_sec_context

bool Handshake::m_have_sec_context
protected

true when the security context has been created.

◆ m_output

Security_buffer Handshake::m_output
protected

Buffer for data to be send to the other side.

◆ m_round

unsigned int Handshake::m_round
protected

Round of the handshake (starting from round 1).

One round consist of reading packet from the other side, processing it and optionally sending a reply (see packet_processing_loop()).

◆ m_sctx

CtxtHandle Handshake::m_sctx
protected

Security context object created during the handshake.

◆ m_ssp_info

SecPkgInfo* Handshake::m_ssp_info
private

The documentation for this class was generated from the following files: