Simple code cleanups, ignore generated files
BitKeeper/etc/ignore: added cmd-line-utils/libedit/common.h mysys/queues.c: Added comments sql/sql_parse.cc: Simple code cleanup tests/grant.res: Updated results for 4.1
This commit is contained in:
parent
fe4e87c967
commit
f71de9b7d0
@ -582,3 +582,12 @@ vio/test-ssl
|
|||||||
vio/test-sslclient
|
vio/test-sslclient
|
||||||
vio/test-sslserver
|
vio/test-sslserver
|
||||||
vio/viotest-ssl
|
vio/viotest-ssl
|
||||||
|
comon.h
|
||||||
|
emacs.h
|
||||||
|
fcns.c
|
||||||
|
fcns.h
|
||||||
|
help.h
|
||||||
|
help.c
|
||||||
|
vi.h
|
||||||
|
include/readline/readline.h
|
||||||
|
cmd-line-utils/libedit/common.h
|
||||||
|
@ -24,7 +24,26 @@
|
|||||||
#include <queues.h>
|
#include <queues.h>
|
||||||
|
|
||||||
|
|
||||||
/* Init queue */
|
/*
|
||||||
|
Init queue
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
init_queue()
|
||||||
|
queue Queue to initialise
|
||||||
|
max_elements Max elements that will be put in queue
|
||||||
|
offset_to_key Offset to key in element stored in queue
|
||||||
|
Used when sending pointers to compare function
|
||||||
|
max_at_top Set to 1 if you want biggest element on top.
|
||||||
|
compare Compare function for elements, takes 3 arguments.
|
||||||
|
first_cmp_arg First argument to compare function
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
Will allocate max_element pointers for queue array
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 ok
|
||||||
|
1 Could not allocate memory
|
||||||
|
*/
|
||||||
|
|
||||||
int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
||||||
pbool max_at_top, int (*compare) (void *, byte *, byte *),
|
pbool max_at_top, int (*compare) (void *, byte *, byte *),
|
||||||
@ -43,11 +62,28 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Reinitialize queue for new usage; Note that you can't currently resize
|
|
||||||
the number of elements! If you need this, fix it :)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reinitialize queue for other usage (deletes all elements)
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
reinit_queue()
|
||||||
|
queue Queue to initialise
|
||||||
|
max_elements Max elements that will be put in queue
|
||||||
|
offset_to_key Offset to key in element stored in queue
|
||||||
|
Used when sending pointers to compare function
|
||||||
|
max_at_top Set to 1 if you want biggest element on top.
|
||||||
|
compare Compare function for elements, takes 3 arguments.
|
||||||
|
first_cmp_arg First argument to compare function
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
You can't currently resize the number of elements! If you need this,
|
||||||
|
fix it :)
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 ok
|
||||||
|
EE_OUTOFMEMORY Wrong max_elements
|
||||||
|
*/
|
||||||
|
|
||||||
int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
||||||
pbool max_at_top, int (*compare) (void *, byte *, byte *),
|
pbool max_at_top, int (*compare) (void *, byte *, byte *),
|
||||||
@ -66,6 +102,21 @@ int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Delete queue
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
delete_queue()
|
||||||
|
queue Queue to delete
|
||||||
|
|
||||||
|
IMPLEMENTATION
|
||||||
|
Just free allocated memory.
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
Can be called safely multiple times
|
||||||
|
*/
|
||||||
|
|
||||||
void delete_queue(QUEUE *queue)
|
void delete_queue(QUEUE *queue)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("delete_queue");
|
DBUG_ENTER("delete_queue");
|
||||||
@ -126,8 +177,7 @@ byte *queue_remove(register QUEUE *queue, uint idx)
|
|||||||
/* Fix when element on top has been replaced */
|
/* Fix when element on top has been replaced */
|
||||||
|
|
||||||
#ifndef queue_replaced
|
#ifndef queue_replaced
|
||||||
void queue_replaced(queue)
|
void queue_replaced(QUEUE *queue)
|
||||||
QUEUE *queue;
|
|
||||||
{
|
{
|
||||||
_downheap(queue,1);
|
_downheap(queue,1);
|
||||||
}
|
}
|
||||||
@ -169,8 +219,8 @@ void _downheap(register QUEUE *queue, uint idx)
|
|||||||
static int queue_fix_cmp(QUEUE *queue, void **a, void **b)
|
static int queue_fix_cmp(QUEUE *queue, void **a, void **b)
|
||||||
{
|
{
|
||||||
return queue->compare(queue->first_cmp_arg,
|
return queue->compare(queue->first_cmp_arg,
|
||||||
(char*) (*a)+queue->offset_to_key,
|
(byte*) (*a)+queue->offset_to_key,
|
||||||
(char*) (*b)+queue->offset_to_key);
|
(byte*) (*b)+queue->offset_to_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -219,12 +219,18 @@ static int check_user(THD *thd,enum_server_command command, const char *user,
|
|||||||
had_password ? "yes": "no",
|
had_password ? "yes": "no",
|
||||||
thd->master_access, thd->db ? thd->db : "*none*"));
|
thd->master_access, thd->db ? thd->db : "*none*"));
|
||||||
|
|
||||||
/* in case we're going to retry we should not send error message at this point */
|
/*
|
||||||
|
In case we're going to retry we should not send error message at this
|
||||||
|
point
|
||||||
|
*/
|
||||||
if (thd->master_access & NO_ACCESS)
|
if (thd->master_access & NO_ACCESS)
|
||||||
{
|
{
|
||||||
if (do_send_error)
|
if (do_send_error)
|
||||||
{
|
{
|
||||||
/* Old client should get nicer error message if password version is not supported*/
|
/*
|
||||||
|
Old client should get nicer error message if password version is
|
||||||
|
not supported
|
||||||
|
*/
|
||||||
if (simple_connect && *hint_user && (*hint_user)->pversion)
|
if (simple_connect && *hint_user && (*hint_user)->pversion)
|
||||||
{
|
{
|
||||||
net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE);
|
net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE);
|
||||||
@ -494,7 +500,10 @@ check_connections(THD *thd)
|
|||||||
{
|
{
|
||||||
uint connect_errors=0;
|
uint connect_errors=0;
|
||||||
NET *net= &thd->net;
|
NET *net= &thd->net;
|
||||||
char *end;
|
char *end, *user, *passwd, *db;
|
||||||
|
char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */
|
||||||
|
ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */
|
||||||
|
uint cur_priv_version;
|
||||||
DBUG_PRINT("info", (("check_connections called by thread %d"),
|
DBUG_PRINT("info", (("check_connections called by thread %d"),
|
||||||
thd->thread_id));
|
thd->thread_id));
|
||||||
DBUG_PRINT("info",("New connection received on %s",
|
DBUG_PRINT("info",("New connection received on %s",
|
||||||
@ -632,9 +641,9 @@ check_connections(THD *thd)
|
|||||||
return(ER_HANDSHAKE_ERROR);
|
return(ER_HANDSHAKE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *user= end;
|
user= end;
|
||||||
char *passwd= strend(user)+1;
|
passwd= strend(user)+1;
|
||||||
char *db=0;
|
db=0;
|
||||||
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
|
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
|
||||||
db=strend(passwd)+1;
|
db=strend(passwd)+1;
|
||||||
|
|
||||||
@ -649,11 +658,6 @@ check_connections(THD *thd)
|
|||||||
thd->net.return_status= &thd->server_status;
|
thd->net.return_status= &thd->server_status;
|
||||||
net->read_timeout=(uint) thd->variables.net_read_timeout;
|
net->read_timeout=(uint) thd->variables.net_read_timeout;
|
||||||
|
|
||||||
char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble and hash */
|
|
||||||
|
|
||||||
ACL_USER* cached_user=NULL; /* Initialise to NULL as first stage indication */
|
|
||||||
uint cur_priv_version;
|
|
||||||
|
|
||||||
/* Simple connect only for old clients. New clients always use secure auth */
|
/* Simple connect only for old clients. New clients always use secure auth */
|
||||||
bool simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
|
bool simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
|
||||||
|
|
||||||
@ -664,15 +668,14 @@ check_connections(THD *thd)
|
|||||||
simple_connect, prepared_scramble, using_password, &cur_priv_version,
|
simple_connect, prepared_scramble, using_password, &cur_priv_version,
|
||||||
&cached_user)<0)
|
&cached_user)<0)
|
||||||
{
|
{
|
||||||
|
/* Store current used and database as they are erased with next packet */
|
||||||
|
char tmp_user[USERNAME_LENGTH+1];
|
||||||
|
char tmp_db[NAME_LEN+1];
|
||||||
|
|
||||||
/* If The client is old we just have to return error */
|
/* If The client is old we just have to return error */
|
||||||
if (simple_connect)
|
if (simple_connect)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Store current used and database as they are erased with next packet */
|
|
||||||
|
|
||||||
char tmp_user[USERNAME_LENGTH+1];
|
|
||||||
char tmp_db[NAME_LEN+1];
|
|
||||||
|
|
||||||
tmp_user[0]=0;
|
tmp_user[0]=0;
|
||||||
if (user)
|
if (user)
|
||||||
strmake(tmp_user,user,USERNAME_LENGTH);
|
strmake(tmp_user,user,USERNAME_LENGTH);
|
||||||
@ -689,13 +692,13 @@ check_connections(THD *thd)
|
|||||||
return ER_HANDSHAKE_ERROR;
|
return ER_HANDSHAKE_ERROR;
|
||||||
}
|
}
|
||||||
/* Reading packet back */
|
/* Reading packet back */
|
||||||
if ((pkt_len=my_net_read(net)) == packet_error)
|
if ((pkt_len= my_net_read(net)) == packet_error)
|
||||||
{
|
{
|
||||||
inc_host_errors(&thd->remote.sin_addr);
|
inc_host_errors(&thd->remote.sin_addr);
|
||||||
return ER_HANDSHAKE_ERROR;
|
return ER_HANDSHAKE_ERROR;
|
||||||
}
|
}
|
||||||
/* We have to get very specific packet size */
|
/* We have to get very specific packet size */
|
||||||
if (pkt_len!=SCRAMBLE41_LENGTH)
|
if (pkt_len != SCRAMBLE41_LENGTH)
|
||||||
{
|
{
|
||||||
inc_host_errors(&thd->remote.sin_addr);
|
inc_host_errors(&thd->remote.sin_addr);
|
||||||
return ER_HANDSHAKE_ERROR;
|
return ER_HANDSHAKE_ERROR;
|
||||||
@ -1075,7 +1078,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
USER_CONN *save_uc= thd->user_connect;
|
USER_CONN *save_uc= thd->user_connect;
|
||||||
bool simple_connect;
|
bool simple_connect;
|
||||||
bool using_password;
|
bool using_password;
|
||||||
|
char prepared_scramble[SCRAMBLE41_LENGTH+4];/* Buffer for scramble,hash */
|
||||||
|
char tmp_user[USERNAME_LENGTH+1];
|
||||||
|
char tmp_db[NAME_LEN+1];
|
||||||
|
ACL_USER* cached_user ; /* Cached user */
|
||||||
|
uint cur_priv_version; /* Cached grant version */
|
||||||
ulong pkt_len=0; /* Length of reply packet */
|
ulong pkt_len=0; /* Length of reply packet */
|
||||||
|
|
||||||
/* Small check for incomming packet */
|
/* Small check for incomming packet */
|
||||||
@ -1089,10 +1096,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
if (passwd[0] && strlen(passwd)!=SCRAMBLE_LENGTH)
|
if (passwd[0] && strlen(passwd)!=SCRAMBLE_LENGTH)
|
||||||
goto restore_user_err;
|
goto restore_user_err;
|
||||||
|
|
||||||
char prepared_scramble[SCRAMBLE41_LENGTH+4];/* Buffer for scramble,hash */
|
|
||||||
ACL_USER* cached_user ; /* Cached user */
|
|
||||||
cached_user= NULL;
|
cached_user= NULL;
|
||||||
uint cur_priv_version; /* Cached grant version */
|
|
||||||
|
|
||||||
/* Simple connect only for old clients. New clients always use sec. auth*/
|
/* Simple connect only for old clients. New clients always use sec. auth*/
|
||||||
simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
|
simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
|
||||||
@ -1116,10 +1120,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
goto restore_user; /* Error is already reported */
|
goto restore_user; /* Error is already reported */
|
||||||
|
|
||||||
/* Store current used and database as they are erased with next packet */
|
/* Store current used and database as they are erased with next packet */
|
||||||
|
|
||||||
char tmp_user[USERNAME_LENGTH+1];
|
|
||||||
char tmp_db[NAME_LEN+1];
|
|
||||||
|
|
||||||
tmp_user[0]=0;
|
tmp_user[0]=0;
|
||||||
if (user)
|
if (user)
|
||||||
strmake(tmp_user,user,USERNAME_LENGTH);
|
strmake(tmp_user,user,USERNAME_LENGTH);
|
||||||
@ -1143,8 +1143,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
goto restore_user;
|
goto restore_user;
|
||||||
|
|
||||||
/* Final attempt to check the user based on reply */
|
/* Final attempt to check the user based on reply */
|
||||||
if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*)net->read_pos,
|
if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*) net->read_pos,
|
||||||
tmp_db, 0, 0, 1, prepared_scramble, using_password, &cur_priv_version,
|
tmp_db, 0, 0, 1, prepared_scramble, using_password,
|
||||||
|
&cur_priv_version,
|
||||||
&cached_user))
|
&cached_user))
|
||||||
goto restore_user;
|
goto restore_user;
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ GRANT LOCK TABLES ON *.* TO 'grant_user'@'localhost'
|
|||||||
GRANT SELECT, INSERT ON grant_test.test3 TO 'grant_user'@'localhost'
|
GRANT SELECT, INSERT ON grant_test.test3 TO 'grant_user'@'localhost'
|
||||||
|
|
||||||
select * from mysql.user where user='grant_user'
|
select * from mysql.user where user='grant_user'
|
||||||
127.0.0.1 grant_user 7f70e8b858ee6782 N N N N N N N N N N N N N N N N N N N N N 0 0 0
|
127.0.0.1 grant_user *042a99b3d247ae587783f647f2d69496d390aa71eab3 N N N N N N N N N N N N N N N N N N N N N 0 0 0
|
||||||
localhost grant_user N N N N N N N N N N N N N N N N N Y N N N 0 0 0
|
localhost grant_user N N N N N N N N N N N N N N N N N Y N N N 0 0 0
|
||||||
|
|
||||||
Connecting grant_user
|
Connecting grant_user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user