33#define MAX_SERVICE_NAME_LENGTH 1024
67#if defined(DEBUG_ERROR_LOG) && defined(NDEBUG)
68#define ERROR_LOG(Level, Msg) \
72#define ERROR_LOG(Level, Msg) error_log_print<error_log_level::Level> Msg
78template <error_log_level::type Level>
101#define DBUG_PRINT_DO(Keyword, Msg) \
103 if (4 > get_log_level()) break; \
104 fprintf(stderr, "winauth: %s: ", Keyword); \
111 vfprintf(stderr, fmt, args);
118#define DBUG_PRINT_DO(K, M) \
123#ifndef WINAUTH_USE_DBUG_LIB
126#define DBUG_PRINT(Keyword, Msg) DBUG_PRINT_DO(Keyword, Msg)
134#define DBUG_ENTER(X) \
139#define DBUG_RETURN(X) return (X)
142#define DBUG_DUMP(A, B, C) \
179 static byte out_of_range = 0;
180 return pos <
len() ?
m_ptr[pos] : out_of_range;
223 explicit Sid(
const wchar_t *);
230 return m_type == SidTypeGroup ||
m_type == SidTypeWellKnownGroup ||
238 operator PSID()
const {
return (PSID)
m_data->User.Sid; }
Class representing a region of memory (e.g., a string or binary buffer).
Definition: common.h:159
byte & operator[](unsigned pos) const
Definition: common.h:178
void trim(size_t l)
Definition: common.h:185
Blob()
Definition: common.h:164
bool is_null() const
Definition: common.h:183
size_t m_len
Length of the memory region.
Definition: common.h:161
byte * ptr() const
Definition: common.h:174
size_t len() const
Definition: common.h:176
byte * m_ptr
Pointer to the first byte of the memory region.
Definition: common.h:160
Blob(const byte *ptr, const size_t len)
Definition: common.h:166
Blob(const char *str)
Definition: common.h:169
Connection class.
Definition: common.h:195
int m_error
If non-zero, indicates that connection is broken.
Definition: common.h:202
Blob read()
Read data from connection.
Definition: common.cc:99
int error() const
Definition: common.h:209
MYSQL_PLUGIN_VIO * m_vio
Pointer to MYSQL_PLUGIN_VIO structure.
Definition: common.h:196
Connection(MYSQL_PLUGIN_VIO *vio)
Connection class.
Definition: common.cc:64
int write(const Blob &)
Write data to the connection.
Definition: common.cc:79
Sid class.
Definition: common.h:218
SID_NAME_USE m_type
Type of identified entity.
Definition: common.h:220
~Sid()
Definition: common.cc:229
bool is_group(void) const
Definition: common.h:229
bool is_valid(void) const
Check if Sid object is valid.
Definition: common.cc:237
bool is_user(void) const
Definition: common.h:234
Sid(const wchar_t *)
Sid class.
Definition: common.cc:125
char * m_as_string
Cached string representation of the SID.
Definition: common.h:243
TOKEN_USER * m_data
Pointer to structure holding identifier's data.
Definition: common.h:219
const char * as_string()
Produces string representation of the SID.
Definition: common.cc:252
bool operator==(const Sid &)
Definition: common.cc:275
UPN class.
Definition: common.h:257
char * m_buf
Pointer to UPN in utf8 representation.
Definition: common.h:258
bool is_valid() const
Definition: common.h:265
const Blob as_blob() const
Definition: common.h:267
~UPN()
Definition: common.cc:326
const char * as_string() const
Definition: common.h:271
UPN()
Generating User Principal Name.
Definition: common.cc:288
size_t m_len
Length of the name.
Definition: common.h:259
const char * get_last_error_message(Error_message_buf)
Error handling.
Definition: common.cc:466
void set_log_level(unsigned int)
Definition: log_client.cc:58
unsigned char byte
Blob class.
Definition: common.h:150
void debug_msg(const char *fmt,...)
Definition: common.h:108
char * wchar_to_utf8(const wchar_t *, size_t *)
Convert a wide-char string to utf8 representation.
Definition: common.cc:346
char Error_message_buf[1024]
Definition: common.h:86
void error_log_print(const char *fmt,...)
Definition: common.h:79
unsigned int get_log_level(void)
Definition: log_client.cc:60
int opt_auth_win_log_level
Definition: common.h:50
void error_log_vprint(error_log_level::type level, const char *fmt, va_list args)
Definition: log_client.cc:30
wchar_t * utf8_to_wchar(const char *, size_t *)
Convert an utf8 string to a wide-char string.
Definition: common.cc:410
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1063
borrowable::binary::Blob< true > Blob
Definition: classic_protocol_binary.h:326
This file defines constants and data structures that are the same for both client- and server-side au...
Provides plugin access to communication channel.
Definition: plugin_auth_common.h:145
Debugging and error reporting infrastructure.
Definition: common.h:46
type
Definition: common.h:47
@ INFO
Definition: common.h:47
@ WARNING
Definition: common.h:47
@ ERROR
Definition: common.h:47
#define NULL
Definition: types.h:54
#define HANDLE
Definition: violite.h:158