WL#1054: code style remarks fixed.
This commit is contained in:
parent
353739fdef
commit
5f9c629da0
@ -30,6 +30,13 @@
|
||||
|
||||
#include <mysql/plugin_auth_common.h>
|
||||
|
||||
/* defines for MYSQL_SERVER_AUTH_INFO.password_used */
|
||||
|
||||
#define PASSWORD_USED_NO 0
|
||||
#define PASSWORD_USED_YES 1
|
||||
#define PASSWORD_USED_NO_MENTION 2
|
||||
|
||||
|
||||
/**
|
||||
Provides server plugin access to authentication information
|
||||
*/
|
||||
|
@ -46,7 +46,7 @@ static int socket_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
|
||||
return CR_ERROR;
|
||||
}
|
||||
|
||||
info->password_used = 2;
|
||||
info->password_used= PASSWORD_USED_NO_MENTION;
|
||||
|
||||
vio->info(vio, &vio_info);
|
||||
if (vio_info.protocol != MYSQL_VIO_SOCKET)
|
||||
|
@ -78,7 +78,7 @@ static int two_questions(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
|
||||
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
|
||||
return CR_ERROR;
|
||||
|
||||
info->password_used = 1;
|
||||
info->password_used= PASSWORD_USED_YES;
|
||||
|
||||
/* fail if the password is wrong */
|
||||
if (strcmp((const char *) pkt, info->auth_string))
|
||||
@ -120,7 +120,7 @@ static int three_attempts(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
|
||||
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
|
||||
return CR_ERROR;
|
||||
|
||||
info->password_used = 1;
|
||||
info->password_used= PASSWORD_USED_YES;
|
||||
|
||||
/*
|
||||
finish, if the password is correct.
|
||||
|
@ -70,7 +70,7 @@ static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
|
||||
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
|
||||
return CR_ERROR;
|
||||
|
||||
info->password_used = 1;
|
||||
info->password_used= PASSWORD_USED_YES;
|
||||
|
||||
/* fail if the password is wrong */
|
||||
if (strcmp((const char *) pkt, info->auth_string))
|
||||
@ -177,7 +177,8 @@ static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
||||
if (!reply)
|
||||
return CR_ERROR;
|
||||
/* send the reply to the server */
|
||||
res= vio->write_packet(vio, (const unsigned char *)reply, strlen(reply)+1);
|
||||
res= vio->write_packet(vio, (const unsigned char *) reply,
|
||||
strlen(reply) + 1);
|
||||
|
||||
if (res)
|
||||
return CR_ERROR;
|
||||
|
@ -510,16 +510,17 @@ static uchar* acl_entry_get_key(acl_entry *entry, size_t *length,
|
||||
}
|
||||
|
||||
#define IP_ADDR_STRLEN (3 + 1 + 3 + 1 + 3 + 1 + 3)
|
||||
#define ACL_KEY_LENGTH (IP_ADDR_STRLEN+1+NAME_LEN+1+USERNAME_LENGTH+1)
|
||||
#define ACL_KEY_LENGTH (IP_ADDR_STRLEN + 1 + NAME_LEN + \
|
||||
1 + USERNAME_LENGTH + 1)
|
||||
|
||||
#if defined(HAVE_OPENSSL)
|
||||
/*
|
||||
Without SSL the handshake consists of one packet. This packet
|
||||
has both client capabilites and scrambled password.
|
||||
has both client capabilities and scrambled password.
|
||||
With SSL the handshake might consist of two packets. If the first
|
||||
packet (client capabilities) has CLIENT_SSL flag set, we have to
|
||||
switch to SSL and read the second packet. The scrambled password
|
||||
is in the second packet and client_capabilites field will be ignored.
|
||||
is in the second packet and client_capabilities field will be ignored.
|
||||
Maybe it is better to accept flags other than CLIENT_SSL from the
|
||||
second packet?
|
||||
*/
|
||||
@ -1021,9 +1022,11 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
|
||||
end_read_record(&read_record_info);
|
||||
freeze_size(&acl_dbs);
|
||||
|
||||
init_read_record(&read_record_info,thd,table=tables[3].table,NULL,1,0,FALSE);
|
||||
init_read_record(&read_record_info, thd, table= tables[3].table, NULL, 1,
|
||||
0, FALSE);
|
||||
table->use_all_columns();
|
||||
(void) my_init_dynamic_array(&acl_proxy_users,sizeof(ACL_PROXY_USER),50,100);
|
||||
(void) my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER),
|
||||
50, 100);
|
||||
while (!(read_record_info.read_record(&read_record_info)))
|
||||
{
|
||||
ACL_PROXY_USER proxy;
|
||||
@ -6058,7 +6061,7 @@ static int handle_grant_struct(uint struct_no, bool drop,
|
||||
host= grant_name->host.hostname;
|
||||
break;
|
||||
case 5:
|
||||
acl_proxy_user= dynamic_element(&acl_proxy_users, idx, ACL_PROXY_USER*);;
|
||||
acl_proxy_user= dynamic_element(&acl_proxy_users, idx, ACL_PROXY_USER*);
|
||||
user= acl_proxy_user->get_user();
|
||||
host= acl_proxy_user->get_host();
|
||||
break;
|
||||
@ -7066,7 +7069,8 @@ acl_find_proxy_user(const char *user, const char *host, const char *ip,
|
||||
uint i;
|
||||
/* if the proxied and proxy user are the same return OK */
|
||||
DBUG_ENTER("acl_find_proxy_user");
|
||||
DBUG_PRINT ("info", ("user=%s host=%s ip=%s authenticated_as=%s", user, host, ip, authenticated_as));
|
||||
DBUG_PRINT("info", ("user=%s host=%s ip=%s authenticated_as=%s",
|
||||
user, host, ip, authenticated_as));
|
||||
|
||||
if (!strcmp(authenticated_as, user))
|
||||
{
|
||||
@ -7092,7 +7096,8 @@ acl_check_proxy_grant_access (THD *thd, const char *host, const char *user,
|
||||
bool with_grant)
|
||||
{
|
||||
DBUG_ENTER("acl_check_proxy_grant_access");
|
||||
DBUG_PRINT ("info", ("user=%s host=%s with_grant=%d", user, host, (int) with_grant));
|
||||
DBUG_PRINT("info", ("user=%s host=%s with_grant=%d", user, host,
|
||||
(int) with_grant));
|
||||
if (!initialized)
|
||||
{
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
|
||||
@ -7925,7 +7930,8 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
|
||||
if (data_len < SCRAMBLE_LENGTH)
|
||||
{
|
||||
if (data_len)
|
||||
{ /*
|
||||
{
|
||||
/*
|
||||
the first packet *must* have at least 20 bytes of a scramble.
|
||||
if a plugin provided less, we pad it to 20 with zeros
|
||||
*/
|
||||
@ -9246,7 +9252,7 @@ static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio,
|
||||
if (pkt_len == 0) /* no password */
|
||||
DBUG_RETURN(info->auth_string[0] ? CR_ERROR : CR_OK);
|
||||
|
||||
info->password_used = 1;
|
||||
info->password_used= PASSWORD_USED_YES;
|
||||
if (pkt_len == SCRAMBLE_LENGTH)
|
||||
{
|
||||
if (!mpvio->acl_user->salt_len)
|
||||
@ -9298,7 +9304,7 @@ static int old_password_authenticate(MYSQL_PLUGIN_VIO *vio,
|
||||
if (secure_auth(mpvio))
|
||||
return CR_ERROR;
|
||||
|
||||
info->password_used = 1;
|
||||
info->password_used= PASSWORD_USED_YES;
|
||||
|
||||
if (pkt_len == SCRAMBLE_LENGTH_323)
|
||||
{
|
||||
@ -9306,7 +9312,8 @@ static int old_password_authenticate(MYSQL_PLUGIN_VIO *vio,
|
||||
return CR_ERROR;
|
||||
|
||||
return check_scramble_323(pkt, mpvio->scramble,
|
||||
(ulong *)mpvio->acl_user->salt) ? CR_ERROR : CR_OK;
|
||||
(ulong *) mpvio->acl_user->salt) ?
|
||||
CR_ERROR : CR_OK;
|
||||
}
|
||||
|
||||
inc_host_errors(mpvio->ip);
|
||||
|
Loading…
x
Reference in New Issue
Block a user