Skip to content

Commit 45d414d

Browse files
WL#8885: Introduce a delay in authentication process
based on successive failed login attempts Post push fix: Fixing non-ps build issues.
1 parent c8c562a commit 45d414d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

plugin/connection_control/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ MYSQL_ADD_PLUGIN(connection_control
1818
connection_control.cc
1919
security_context_wrapper.cc
2020
connection_delay.cc
21-
MODULE_ONLY)
21+
LINK_LIBRARIES mysys
22+
MODULE_ONLY)
2223

plugin/connection_control/connection_delay.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@ namespace connection_control
5757

5858
/** variables used by connection_delay.cc */
5959
static mysql_rwlock_t connection_event_delay_lock;
60+
61+
#ifdef HAVE_PSI_INTERFACE
6062
static PSI_rwlock_key key_connection_event_delay_lock;
6163
static PSI_rwlock_info all_rwlocks[]=
6264
{
6365
{&key_connection_event_delay_lock, "connection_event_delay_lock", 0}
6466
};
67+
#endif /* HAVE_PSI_INTERFACE */
6568

6669
static opt_connection_control opt_enums[]=
6770
{
@@ -518,7 +521,6 @@ namespace connection_control
518521
ulonglong wait_time)
519522
{
520523
DBUG_ENTER("Connection_delay_action::conditional_wait");
521-
const char * category= "connection_delay";
522524

523525
/** mysql_cond_timedwait requires wait time in timespec format */
524526
struct timespec abstime;
@@ -532,25 +534,30 @@ namespace connection_control
532534

533535
/** Initialize mutex required for mysql_cond_timedwait */
534536
mysql_mutex_t connection_delay_mutex;
537+
#ifdef HAVE_PSI_INTERFACE
538+
const char * category= "conn_delay";
535539
PSI_mutex_key key_connection_delay_mutex;
536540
PSI_mutex_info connection_delay_mutex_info[]=
537541
{
538542
{&key_connection_delay_mutex, "connection_delay_mutex", PSI_FLAG_GLOBAL}
539543
};
540544
int count_mutex= array_elements(connection_delay_mutex_info);
541545
PSI_server->register_mutex(category, connection_delay_mutex_info, count_mutex);
546+
#endif /* HAVE_PSI_INTERFACE */
542547
mysql_mutex_init(key_connection_delay_mutex, &connection_delay_mutex,
543548
MY_MUTEX_INIT_FAST);
544549

545550
/* Initialize condition to wait for */
546551
mysql_cond_t connection_delay_wait_condition;
552+
#ifdef HAVE_PSI_INTERFACE
547553
PSI_cond_key key_connection_delay_wait;
548554
PSI_cond_info connection_delay_wait_info[]=
549555
{
550556
{&key_connection_delay_wait, "connection_delay_wait_condition", 0}
551557
};
552558
int count_cond= array_elements(connection_delay_wait_info);
553559
PSI_server->register_cond(category, connection_delay_wait_info, count_cond);
560+
#endif /* HAVE_PSI_INTERFACE */
554561
mysql_cond_init(key_connection_delay_wait, &connection_delay_wait_condition, NULL);
555562

556563
/** Register wait condition with THD */
@@ -917,9 +924,11 @@ namespace connection_control
917924
/*
918925
1. Initialize lock(s)
919926
*/
927+
#ifdef HAVE_PSI_INTERFACE
920928
const char *category= "conn_control";
921929
int count= array_elements(all_rwlocks);
922930
mysql_rwlock_register(category, all_rwlocks, count);
931+
#endif /* HAVE_PSI_INTERFACE */
923932
mysql_rwlock_init(key_connection_event_delay_lock,
924933
&connection_event_delay_lock);
925934
g_max_failed_connection_handler= new Connection_delay_action(g_variables.failed_connections_threshold,

0 commit comments

Comments
 (0)