summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-06-11 11:20:31 +0300
committerunknown <monty@mashka.mysql.fi>2002-06-11 11:20:31 +0300
commit70aa7424c41c45a8fb171bbdd9e24d74b70a7765 (patch)
tree8fcaabe013fff43cf466235067f2c47f0cd66531 /sql/sql_acl.cc
parent30d5eb22877d0546fb4bd93ead7e8602285d449b (diff)
downloadmariadb-git-70aa7424c41c45a8fb171bbdd9e24d74b70a7765.tar.gz
Big code cleanup/review before 4.0.2 release.
(All commit emails since 4.0.1 checked) This had to be done now, before the 4.1 tree changes to much, to make it easy to propagate bug fixes to the 4.1 tree. BUILD/SETUP.sh: Added -DPEDANTIC_SAFEMALLOC as standard debug option Docs/manual.texi: Changes for new version. client/mysql.cc: Fixed default value for rehash cleanup client/mysqladmin.c: Cleanup client/mysqlbinlog.cc: cleanup client/mysqldump.c: Cleanup client/mysqlmanager-pwgen.c: Cleanup client/mysqlmanagerc.c: Cleanup client/mysqltest.c: Cleanup dbug/dbug.c: Cleanup extra/resolve_stack_dump.c: Cleanup & Simple optimizations include/ft_global.h: Cleanup include/my_alloc.h: Cleanup include/my_global.h: Cleanup include/my_sys.h: Cleanup include/myisam.h: Cleanup libmysql/libmysql.c: Cleanup libmysql/manager.c: Cleanup myisam/ft_boolean_search.c: Cleanup myisam/ft_dump.c: Change strcpy -> strmov myisam/ft_eval.c: Cleanup myisam/ft_nlq_search.c: Cleanup myisam/ft_test1.c: strncpy -> strnmov myisam/ft_update.c: Cleanup myisam/mi_static.c: Cleanup myisam/mi_test2.c: Cleanup myisam/mi_write.c: Cleanup mysys/mf_fn_ext.c: Cleanup mysys/mf_iocache.c: Cleanup mysys/mf_iocache2.c: Cleanup mysys/my_getopt.c: Cleanup mysys/my_read.c: Cleanup mysys/my_thr_init.c: Cleanup mysys/queues.c: Cleanup mysys/safemalloc.c: Cleanup sql/field.cc: Indentation cleanups sql/ha_berkeley.cc: Indentation cleanups sql/ha_myisam.cc: Cleanup sql/item.h: Indentation cleanups sql/item_cmpfunc.cc: Indentation cleanups sql/item_create.cc: cleanup sql/item_func.cc: Cleanup sql/item_func.h: Indentation cleanups sql/item_strfunc.cc: Indentation cleanups sql/item_sum.cc: Indentation cleanups sql/item_timefunc.cc: Indentation cleanups sql/lock.cc: Indentation cleanups sql/log.cc: Cleanup strnmov -> strmake sql/log_event.cc: Cleanup + optimizations Fixed memory leak Added missing pthread_mutex_unlock() (On error condition) sql/log_event.h: Indentation and comment cleanup Merged #ifdef's into common blocks for better readability sql/mini_client.cc: Indentation cleanup sql/mysql_priv.h: Cleanup Changed int function to bool sql/mysqld.cc: Indentation and comment cleanup sql/net_pkg.cc: Indentation cleanup sql/net_serv.cc: Changed int function -> bool sql/nt_servc.cc: Cleanup sql/opt_range.cc: Indentation cleanup sql/repl_failsafe.cc: Cleanup + simple optimization strnmov -> strmake sql/slave.cc: strnmov -> strmake Cleanups sql/slave.h: Cleanup sql/sql_acl.cc: Indentation and DBUG_PRINT cleanup Changed WITH MAX... to not use = sql/sql_base.cc: Indentation cleanup sql/sql_cache.cc: Indentation cleanup sql/sql_class.cc: Indentation cleanup sql/sql_class.h: Renamed some struct slots sql/sql_delete.cc: Indentation cleanup sql/sql_handler.cc: Indentation cleanup sql/sql_insert.cc: Use new slot names. sql/sql_lex.cc: Indentation cleanup sql/sql_lex.h: Indentation cleanup sql/sql_load.cc: Indentation cleanup sql/sql_parse.cc: Indentation cleanup Removed not used check from LOCK TABLES sql/sql_repl.cc: strnmov -> strmake sql/sql_repl.h: Removed test if file is included (We want to know if it's included twice to avoid this) sql/sql_select.cc: Indentation cleanup sql/sql_show.cc: Indentation cleanup sql/sql_string.cc: Indentation cleanup sql/sql_table.cc: Indentation cleanup sql/sql_union.cc: Use renamed struct slot sql/sql_update.cc: Indentation cleanup sql/sql_yacc.yy: Removed = after GRANT ... MAX_ to make the syntax uniform sql/table.cc: Indentation cleanup sql/table.h: Indentation cleanup sql/time.cc: Indentation cleanup sql/udf_example.cc: Indentation cleanup sql/unireg.cc: strnmov -> strmake tests/grant.pl: Added test for LOCK TABLES tools/mysqlmanager.c: Cleanup fopen() -> my_fopen() vio/viosocket.c: DBUG_PRINT cleanups vio/viosslfactories.c: Indentation cleanup Checking of results from malloc() Fixed possible memory leak BitKeeper/etc/ignore: Added scripts/mysql_secure_installation to the ignore list BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc48
1 files changed, 25 insertions, 23 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 0b2d4ad76e8..7657bdd8133 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -255,7 +255,7 @@ int acl_init(bool dont_read_acl_tables)
protocol_version == PROTOCOL_VERSION)
{
sql_print_error(
- "Found old style password for user '%s'. Ignoring user. (You may want to restart using --old-protocol)",
+ "Found old style password for user '%s'. Ignoring user. (You may want to restart mysqld using --old-protocol)",
user.user ? user.user : ""); /* purecov: tested */
}
else if (length % 8) // This holds true for passwords
@@ -269,8 +269,9 @@ int acl_init(bool dont_read_acl_tables)
get_salt_from_password(user.salt,user.password);
user.access=get_access(table,3);
user.sort=get_sort(2,user.host.hostname,user.user);
- user.hostname_length=user.host.hostname ? (uint) strlen(user.host.hostname) : 0;
- if (table->fields >=23)
+ user.hostname_length= (user.host.hostname ?
+ (uint) strlen(user.host.hostname) : 0);
+ if (table->fields >= 23)
{
/* Table has new MySQL usage limits */
char *ptr = get_field(&mem, table, 21);
@@ -279,7 +280,8 @@ int acl_init(bool dont_read_acl_tables)
user.user_resource.updates=atoi(ptr);
ptr = get_field(&mem, table, 23);
user.user_resource.connections=atoi(ptr);
- if (user.user_resource.questions || user.user_resource.updates || user.user_resource.connections)
+ if (user.user_resource.questions || user.user_resource.updates ||
+ user.user_resource.connections)
mqh_used=1;
}
else
@@ -829,7 +831,7 @@ int wild_case_compare(const char *str,const char *wildstr)
{
reg3 int flag;
DBUG_ENTER("wild_case_compare");
- DBUG_PRINT("enter",("str='%s', wildstr='%s'",str,wildstr));
+ DBUG_PRINT("enter",("str: '%s' wildstr: '%s'",str,wildstr));
while (*wildstr)
{
while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
@@ -954,7 +956,8 @@ bool change_password(THD *thd, const char *host, const char *user,
{
uint length=0;
DBUG_ENTER("change_password");
- DBUG_PRINT("enter",("thd=%x, host='%s', user='%s', new_password='%s'",thd,host,user,new_password));
+ DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
+ host,user,new_password));
if (!initialized)
{
@@ -1027,7 +1030,7 @@ static ACL_USER *
find_acl_user(const char *host, const char *user)
{
DBUG_ENTER("find_acl_user");
- DBUG_PRINT("enter",("host='%s', user='%s'",host,user));
+ DBUG_PRINT("enter",("host: '%s' user: '%s'",host,user));
for (uint i=0 ; i < acl_users.elements ; i++)
{
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
@@ -1238,7 +1241,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
rights=get_access(table,3);
#ifdef HAVE_OPENSSL
/* We write down SSL related ACL stuff */
- DBUG_PRINT("info",("table->fields=%d",table->fields));
+ DBUG_PRINT("info",("table->fields: %d",table->fields));
if (table->fields >= 21) /* From 4.0.0 we have more fields */
{
table->field[18]->store("",0);
@@ -1883,9 +1886,9 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
TABLE_LIST tables[3];
bool create_new_users=0;
DBUG_ENTER("mysql_table_grant");
- DBUG_PRINT("info",("ssl_cipher=%s",thd->lex.ssl_cipher));
- DBUG_PRINT("info",("x509_issuer=%s",thd->lex.x509_issuer));
- DBUG_PRINT("info",("x509_subject=%s",thd->lex.x509_subject));
+ DBUG_PRINT("info",("ssl_cipher: %s",thd->lex.ssl_cipher));
+ DBUG_PRINT("info",("x509_issuer: %s",thd->lex.x509_issuer));
+ DBUG_PRINT("info",("x509_subject: %s",thd->lex.x509_subject));
if (!initialized)
{
@@ -2601,7 +2604,6 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
{
uint counter, want_access,index;
int error = 0;
- int ssl_options = 0;
ACL_USER *acl_user; ACL_DB *acl_db;
char buff[1024];
DBUG_ENTER("mysql_show_grants");
@@ -2699,18 +2701,18 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* "show grants" SSL related stuff */
if (acl_user->ssl_type == SSL_TYPE_ANY)
global.append(" REQUIRE SSL",12);
- else if (acl_user->ssl_type==SSL_TYPE_X509)
+ else if (acl_user->ssl_type == SSL_TYPE_X509)
global.append(" REQUIRE X509",13);
- else if (acl_user->ssl_type==SSL_TYPE_SPECIFIED)
+ else if (acl_user->ssl_type == SSL_TYPE_SPECIFIED)
{
+ int ssl_options = 0;
global.append(" REQUIRE ",9);
if (acl_user->x509_issuer)
{
- if (ssl_options++)
- global.append(" AND ",5);
+ ssl_options++;
global.append("ISSUER \"",8);
global.append(acl_user->x509_issuer,strlen(acl_user->x509_issuer));
- global.append("\"",1);
+ global.append('\'');
}
if (acl_user->x509_subject)
{
@@ -2718,15 +2720,15 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
global.append(" AND ",5);
global.append("SUBJECT \"",9);
global.append(acl_user->x509_subject,strlen(acl_user->x509_subject));
- global.append("\"",1);
+ global.append('\'');
}
if (acl_user->ssl_cipher)
{
if (ssl_options++)
global.append(" AND ",5);
- global.append("CIPHER \"",8);
+ global.append("CIPHER '",8);
global.append(acl_user->ssl_cipher,strlen(acl_user->ssl_cipher));
- global.append("\"",1);
+ global.append('\'');
}
}
#endif /* HAVE_OPENSSL */
@@ -2735,21 +2737,21 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (acl_user->user_resource.questions)
{
char buff[65], *p; // just as in int2str
- global.append(" WITH MAX_QUERIES_PER_HOUR = ",29);
+ global.append(" WITH MAX_QUERIES_PER_HOUR ",27);
p=int2str(acl_user->user_resource.questions,buff,10);
global.append(buff,p-buff);
}
if (acl_user->user_resource.updates)
{
char buff[65], *p; // just as in int2str
- global.append(" WITH MAX_UPDATES_PER_HOUR = ",29);
+ global.append(" WITH MAX_UPDATES_PER_HOUR ",27);
p=int2str(acl_user->user_resource.updates,buff,10);
global.append(buff,p-buff);
}
if (acl_user->user_resource.connections)
{
char buff[65], *p; // just as in int2str
- global.append(" WITH MAX_CONNECTIONS_PER_HOUR = ",33);
+ global.append(" WITH MAX_CONNECTIONS_PER_HOUR ",31);
p=int2str(acl_user->user_resource.connections,buff,10);
global.append(buff,p-buff);
}