Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
99eeaee7
Commit
99eeaee7
authored
Sep 07, 2011
by
Chuck Bell
Browse files
Options
Browse Files
Download
Plain Diff
Merge with main prior to push for BUG#12929345.
parents
1e7f0637
cee822ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
33 deletions
+61
-33
libmysql/authentication_win/common.cc
libmysql/authentication_win/common.cc
+18
-0
libmysql/authentication_win/common.h
libmysql/authentication_win/common.h
+7
-7
libmysql/authentication_win/handshake_client.cc
libmysql/authentication_win/handshake_client.cc
+6
-6
libmysql/authentication_win/log_client.cc
libmysql/authentication_win/log_client.cc
+30
-20
No files found.
libmysql/authentication_win/common.cc
View file @
99eeaee7
...
...
@@ -22,6 +22,24 @@ template <> void error_log_print<error_log_level::INFO>(const char *fmt, ...);
template
<
>
void
error_log_print
<
error_log_level
::
WARNING
>
(
const
char
*
fmt
,
...);
template
<
>
void
error_log_print
<
error_log_level
::
ERROR
>
(
const
char
*
fmt
,
...);
/**
Option indicating desired level of logging. Values:
0 - no logging
1 - log only error messages
2 - additionally log warnings
3 - additionally log info notes
4 - also log debug messages
Value of this option should be taken into account in the
implementation of error_log_vprint() function (see
log_client.cc).
Note: No error or debug messages are logged in production code
(see logging macros in common.h).
*/
int
opt_auth_win_log_level
=
2
;
/** Connection class **************************************************/
...
...
libmysql/authentication_win/common.h
View file @
99eeaee7
...
...
@@ -41,13 +41,15 @@ struct error_log_level
typedef
enum
{
INFO
,
WARNING
,
ERROR
}
type
;
};
extern
"C"
int
opt_auth_win_log_level
;
unsigned
int
get_log_level
(
void
);
void
set_log_level
(
unsigned
int
);
/*
If DEBUG_ERROR_LOG is defined then error logging happens only
in debug-copiled code. Otherwise ERROR_LOG() expands to
error_log_print() even in production code. Note that in client
plugin, error_log_print() will print nothing if opt_auth_win_clinet_log
is 0.
error_log_print() even in production code.
Note: Macro ERROR_LOG() can use printf-like format string like this:
...
...
@@ -57,8 +59,6 @@ struct error_log_level
to fprintf() (see error_log_vprint() function).
*/
extern
"C"
int
opt_auth_win_client_log
;
#if defined(DEBUG_ERROR_LOG) && defined(DBUG_OFF)
#define ERROR_LOG(Level, Msg) do {} while (0)
#else
...
...
@@ -67,7 +67,7 @@ extern "C" int opt_auth_win_client_log;
void
error_log_vprint
(
error_log_level
::
type
level
,
const
char
*
fmt
,
va_list
args
);
const
char
*
fmt
,
va_list
args
);
template
<
error_log_level
::
type
Level
>
void
error_log_print
(
const
char
*
fmt
,
...)
...
...
@@ -96,7 +96,7 @@ const char* get_last_error_message(Error_message_buf);
#define DBUG_PRINT_DO(Keyword, Msg) \
do { \
if (
2 > opt_auth_win_client_log
) break; \
if (
4 > get_log_level()
) break; \
fprintf(stderr, "winauth: %s: ", Keyword); \
debug_msg Msg; \
} while (0)
...
...
libmysql/authentication_win/handshake_client.cc
View file @
99eeaee7
...
...
@@ -323,13 +323,13 @@ int win_auth_handshake_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
int
opt_val
=
opt
?
atoi
(
opt
)
:
0
;
if
(
opt
&&
!
opt_val
)
{
if
(
!
strncasecmp
(
"on"
,
opt
,
2
))
opt_val
=
1
;
if
(
!
strncasecmp
(
"yes"
,
opt
,
3
))
opt_val
=
1
;
if
(
!
strncasecmp
(
"true"
,
opt
,
4
))
opt_val
=
1
;
if
(
!
strncasecmp
(
"debug"
,
opt
,
5
))
opt_val
=
2
;
if
(
!
strncasecmp
(
"dbug"
,
opt
,
4
))
opt_val
=
2
;
if
(
!
strncasecmp
(
"on"
,
opt
,
2
))
opt_val
=
2
;
if
(
!
strncasecmp
(
"yes"
,
opt
,
3
))
opt_val
=
2
;
if
(
!
strncasecmp
(
"true"
,
opt
,
4
))
opt_val
=
2
;
if
(
!
strncasecmp
(
"debug"
,
opt
,
5
))
opt_val
=
4
;
if
(
!
strncasecmp
(
"dbug"
,
opt
,
4
))
opt_val
=
4
;
}
opt_auth_win_client_log
=
opt_val
;
set_log_level
(
opt_val
)
;
}
ERROR_LOG
(
INFO
,
(
"Authentication handshake for account %s"
,
mysql
->
user
));
...
...
libmysql/authentication_win/log_client.cc
View file @
99eeaee7
...
...
@@ -16,36 +16,32 @@
#include <my_global.h>
#include "common.h"
/**
This option is set in win_auth_handshake_client() function
in handshake_client.cc.
Values:
0 - no logging
1 - log error/warning/info messages
2 - also log debug messages
Note: No error or debug messages are logged in production code
(see logging macros in common.h).
*/
int
opt_auth_win_client_log
=
0
;
// Client-side logging function
void
error_log_vprint
(
error_log_level
::
type
level
,
const
char
*
fmt
,
va_list
args
)
{
if
(
0
==
opt_auth_win_client_log
)
return
;
const
char
*
level_string
=
""
;
int
log_level
=
get_log_level
();
switch
(
level
)
{
case
error_log_level
:
:
INFO
:
level_string
=
"Note"
;
break
;
case
error_log_level
:
:
WARNING
:
level_string
=
"Warning"
;
break
;
case
error_log_level
:
:
ERROR
:
level_string
=
"ERROR"
;
break
;
case
error_log_level
:
:
INFO
:
if
(
3
>
log_level
)
return
;
level_string
=
"Note"
;
break
;
case
error_log_level
:
:
WARNING
:
if
(
2
>
log_level
)
return
;
level_string
=
"Warning"
;
break
;
case
error_log_level
:
:
ERROR
:
if
(
1
>
log_level
)
return
;
level_string
=
"ERROR"
;
break
;
}
fprintf
(
stderr
,
"Windows Authentication Plugin %s: "
,
level_string
);
...
...
@@ -53,3 +49,17 @@ void error_log_vprint(error_log_level::type level,
fputc
(
'\n'
,
stderr
);
fflush
(
stderr
);
}
// Trivial implementation of log-level setting storage.
void
set_log_level
(
unsigned
int
level
)
{
opt_auth_win_log_level
=
level
;
}
unsigned
int
get_log_level
(
void
)
{
return
opt_auth_win_log_level
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment