MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Handshake Class Reference

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

#include <handshake.h>

Inheritance diagram for Handshake:
Collaboration diagram for Handshake:

Public Types

enum  side_t { CLIENT, SERVER }

Public Member Functions

 Handshake (const char *ssp, side_t side)
int packet_processing_loop ()
virtual bool is_complete () const
int error () const
const char * ssp_name ()

Protected Member Functions

bool process_result (int)
virtual Blob process_data (const Blob &data)=0
virtual Blob read_packet ()=0
 Read packet from the other end.
virtual int write_packet (Blob &data)=0
 Write packet to the other end.

Protected Attributes

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

Detailed Description

Common base for Handshake_{server,client}.

Definition at line 94 of file handshake.h.

Constructor & Destructor Documentation

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.

Definition at line 35 of file handshake.cc.

Member Function Documentation

int Handshake::packet_processing_loop ( )

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

Parameters
IN]con a connection to read packets from

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.

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

Definition at line 93 of file handshake.cc.

Here is the call graph for this function:

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
IN]data data 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.

Here is the caller graph for this function:

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.

Definition at line 216 of file handshake.cc.

Here is the caller graph for this function:

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.

Definition at line 177 of file handshake.cc.

Member Data Documentation

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()).

Definition at line 134 of file handshake.h.


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