Commit a01775c5 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Added help for --local-infile

Fix for bug on intel where (int32) 1 << 32 == 1, which gave problems when using 32 keys.
Allow SET PASSWORD for anonymous user
parent ed8fc0b0
...@@ -12010,6 +12010,12 @@ make sure that @file{gmalloc.o} is included in @file{libgthreads.a} and ...@@ -12010,6 +12010,12 @@ make sure that @file{gmalloc.o} is included in @file{libgthreads.a} and
In FSU Pthreads, the following system calls are pthreads-aware: @code{read()}, In FSU Pthreads, the following system calls are pthreads-aware: @code{read()},
@code{write()}, @code{getmsg()}, @code{connect()}, @code{accept()}, @code{write()}, @code{getmsg()}, @code{connect()}, @code{accept()},
@code{select()}, and @code{wait()}. @code{select()}, and @code{wait()}.
@item
The CSSA-2001-SCO.35.2 (the patch is listed in custom as
erg711905-dscr_remap security patch (ver 2.0.0) breaks FSU threads and
makes mysqld instable. You have to remove this one if you want to run
mysqld on an OpenServer 5.0.6 machine.
@end itemize @end itemize
If you want to install DBI on SCO, you have to edit the @file{Makefile} in If you want to install DBI on SCO, you have to edit the @file{Makefile} in
...@@ -46890,6 +46896,12 @@ not yet 100% confident in this code. ...@@ -46890,6 +46896,12 @@ not yet 100% confident in this code.
@node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x @node News-3.23.50, News-3.23.49, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.50 @appendixsubsec Changes in release 3.23.50
@itemize @bullet @itemize @bullet
@item
Fixed problem with @code{SHOW CREATE TABLE} and @code{PRIMARY KEY} when using
32 indexes.
@item
Fixed that one can use @code{SET PASSWORD} for the anonymous user.
@item
Fixed core-dump bug when reading client groups from option files using Fixed core-dump bug when reading client groups from option files using
@code{mysql_options()}. @code{mysql_options()}.
@item @item
...@@ -487,6 +487,7 @@ static void usage(int version) ...@@ -487,6 +487,7 @@ static void usage(int version)
-i, --ignore-space Ignore space after function names.\n\ -i, --ignore-space Ignore space after function names.\n\
-h, --host=... Connect to host.\n\ -h, --host=... Connect to host.\n\
-H, --html Produce HTML output.\n\ -H, --html Produce HTML output.\n\
--local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\
-L, --skip-line-numbers\n\ -L, --skip-line-numbers\n\
Don't write line number for errors.\n"); Don't write line number for errors.\n");
#ifndef __WIN__ #ifndef __WIN__
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
** * * ** * *
** ************************* ** *************************
*/ */
#define IMPORT_VERSION "2.7" #define IMPORT_VERSION "2.8"
#include "client_priv.h" #include "client_priv.h"
#include "mysql_version.h" #include "mysql_version.h"
...@@ -397,10 +397,13 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd) ...@@ -397,10 +397,13 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd)
mysql_init(&mysql_connection); mysql_init(&mysql_connection);
if (opt_compress) if (opt_compress)
mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS); mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS);
if (opt_local_file)
mysql_options(&mysql_connection,MYSQL_OPT_LOCAL_INFILE,
(char*) &opt_local_file);
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if (opt_use_ssl) if (opt_use_ssl)
mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath); opt_ssl_capath, opt_ssl_cipher);
#endif #endif
if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd, if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port, database,opt_mysql_port,opt_mysql_unix_port,
......
...@@ -607,7 +607,7 @@ AC_SUBST(MYSQLD_USER) ...@@ -607,7 +607,7 @@ AC_SUBST(MYSQLD_USER)
AC_MSG_CHECKING(if we should should enable LOAD DATA LOCAL by default) AC_MSG_CHECKING(if we should should enable LOAD DATA LOCAL by default)
AC_ARG_ENABLE(local-infile, AC_ARG_ENABLE(local-infile,
[ --enable-local-infile [ --enable-local-infile
If LOAD DATA LOCAL INFILE is enabled by default.], Enable LOAD DATA LOCAL INFILE (default: disabled)],
[ ENABLED_LOCAL_INFILE=$enableval ], [ ENABLED_LOCAL_INFILE=$enableval ],
[ ENABLED_LOCAL_INFILE=no ] [ ENABLED_LOCAL_INFILE=no ]
) )
......
...@@ -281,6 +281,7 @@ typedef unsigned short ushort; ...@@ -281,6 +281,7 @@ typedef unsigned short ushort;
#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); } #define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); } #define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
#define test_all_bits(a,b) (((a) & (b)) == (b)) #define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#ifndef HAVE_RINT #ifndef HAVE_RINT
#define rint(A) floor((A)+0.5) #define rint(A) floor((A)+0.5)
......
...@@ -12,3 +12,40 @@ table type possible_keys key key_len ref rows Extra ...@@ -12,3 +12,40 @@ table type possible_keys key key_len ref rows Extra
t2 ref B B 21 const 1 where used t2 ref B B 21 const 1 where used
a B a B
3 world 3 world
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`),
KEY `b_2` (`b`),
KEY `b_3` (`b`),
KEY `b_4` (`b`),
KEY `b_5` (`b`),
KEY `b_6` (`b`),
KEY `b_7` (`b`),
KEY `b_8` (`b`),
KEY `b_9` (`b`),
KEY `b_10` (`b`),
KEY `b_11` (`b`),
KEY `b_12` (`b`),
KEY `b_13` (`b`),
KEY `b_14` (`b`),
KEY `b_15` (`b`),
KEY `b_16` (`b`),
KEY `b_17` (`b`),
KEY `b_18` (`b`),
KEY `b_19` (`b`),
KEY `b_20` (`b`),
KEY `b_21` (`b`),
KEY `b_22` (`b`),
KEY `b_23` (`b`),
KEY `b_24` (`b`),
KEY `b_25` (`b`),
KEY `b_26` (`b`),
KEY `b_27` (`b`),
KEY `b_28` (`b`),
KEY `b_29` (`b`),
KEY `b_30` (`b`),
KEY `b_31` (`b`)
) TYPE=MyISAM
...@@ -69,3 +69,11 @@ create table t2 (key (b)) select * from t1; ...@@ -69,3 +69,11 @@ create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world"; explain select * from t2 where b="world";
select * from t2 where b="world"; select * from t2 where b="world";
drop table t1,t2; drop table t1,t2;
#
# Test of primary key with 32 index
#
create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
show create table t1;
drop table t1;
...@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. ...@@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file # Documentation continued at end of file
my $VERSION = "1.15"; my $VERSION = "1.16";
my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp";
...@@ -236,9 +236,7 @@ my $num_files = 0; ...@@ -236,9 +236,7 @@ my $num_files = 0;
foreach my $rdb ( @db_desc ) { foreach my $rdb ( @db_desc ) {
my $db = $rdb->{src}; my $db = $rdb->{src};
eval { $dbh->do( "use $db" ); }; my @dbh_tables = get_list_of_tables( $db );
die "Database '$db' not accessible: $@" if ( $@ );
my @dbh_tables = $dbh->tables();
## generate regex for tables/files ## generate regex for tables/files
my $t_regex; my $t_regex;
...@@ -307,7 +305,7 @@ foreach my $rdb ( @db_desc ) { ...@@ -307,7 +305,7 @@ foreach my $rdb ( @db_desc ) {
$rdb->{files} = [ @db_files ]; $rdb->{files} = [ @db_files ];
$rdb->{index} = [ @index_files ]; $rdb->{index} = [ @index_files ];
my @hc_tables = map { "$db.$_" } @dbh_tables; my @hc_tables = map { "`$db`.`$_`" } @dbh_tables;
$rdb->{tables} = [ @hc_tables ]; $rdb->{tables} = [ @hc_tables ];
$rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ]; $rdb->{raid_dirs} = [ get_raid_dirs( $rdb->{files} ) ];
...@@ -562,14 +560,14 @@ sub copy_files { ...@@ -562,14 +560,14 @@ sub copy_files {
# add recursive option for scp # add recursive option for scp
push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/; push @cp, "-r" if $^O =~ /m^(solaris|linux|freebsd)$/ && $method =~ /^scp\b/;
my @non_raid = grep { ! m:/\d{2}/[^/]+$: } @$files; my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files;
# add files to copy and the destination directory # add files to copy and the destination directory
safe_system( @cp, @non_raid, $target ); + safe_system( @cp, @non_raid, "'$target'" );
foreach my $rd ( @$raid_dirs ) { foreach my $rd ( @$raid_dirs ) {
my @raid = grep { m:$rd/: } @$files; my @raid = map { "'$_'" } grep { m:$rd/: } @$files;
safe_system( @cp, @raid, "$target/$rd" ) if ( @raid ); safe_system( @cp, @raid, "'$target'/$rd" ) if ( @raid );
} }
} }
else else
...@@ -735,6 +733,25 @@ sub get_raid_dirs { ...@@ -735,6 +733,25 @@ sub get_raid_dirs {
return sort keys %dirs; return sort keys %dirs;
} }
sub get_list_of_tables {
my ( $db ) = @_;
# "use database" cannot cope with database names containing spaces
# so create a new connection
my $dbh = DBI->connect("dbi:mysql:${db}${dsn};mysql_read_default_group=mysqlhotcopy",
$opt{user}, $opt{password},
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 1,
});
my @dbh_tables = eval { $dbh->tables() };
$dbh->disconnect();
return @dbh_tables;
}
__END__ __END__
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -975,3 +992,4 @@ Jeremy D. Zawodny - Removed depricated DBI calls. Fixed bug which ...@@ -975,3 +992,4 @@ Jeremy D. Zawodny - Removed depricated DBI calls. Fixed bug which
resulted in nothing being copied when a regexp was specified but no resulted in nothing being copied when a regexp was specified but no
database name(s). database name(s).
Martin Waite - Fix to handle database name that contains space.
...@@ -191,7 +191,7 @@ void ha_isam::info(uint flag) ...@@ -191,7 +191,7 @@ void ha_isam::info(uint flag)
sortkey = info.sortkey; sortkey = info.sortkey;
block_size=nisam_block_size; block_size=nisam_block_size;
table->keys = min(table->keys,info.keys); table->keys = min(table->keys,info.keys);
table->keys_in_use= (((key_map) 1) << table->keys)- (key_map) 1; table->keys_in_use= set_bits(key_map,table->keys);
table->db_options_in_use= info.options; table->db_options_in_use= info.options;
table->db_record_offset= table->db_record_offset=
(table->db_options_in_use & (table->db_options_in_use &
......
...@@ -664,7 +664,7 @@ bool ha_myisam::activate_all_index(THD *thd) ...@@ -664,7 +664,7 @@ bool ha_myisam::activate_all_index(THD *thd)
MI_CHECK param; MI_CHECK param;
MYISAM_SHARE* share = file->s; MYISAM_SHARE* share = file->s;
DBUG_ENTER("activate_all_index"); DBUG_ENTER("activate_all_index");
if (share->state.key_map != ((ulonglong) 1L << share->base.keys)-1) if (share->state.key_map != set_bits(ulonglong, share->base.keys))
{ {
const char *save_proc_info=thd->proc_info; const char *save_proc_info=thd->proc_info;
thd->proc_info="Creating index"; thd->proc_info="Creating index";
......
...@@ -169,7 +169,7 @@ void ha_myisammrg::info(uint flag) ...@@ -169,7 +169,7 @@ void ha_myisammrg::info(uint flag)
deleted = (ha_rows) info.deleted; deleted = (ha_rows) info.deleted;
data_file_length=info.data_file_length; data_file_length=info.data_file_length;
errkey = info.errkey; errkey = info.errkey;
table->keys_in_use=(((key_map) 1) << table->keys)- (key_map) 1; table->keys_in_use= set_bits(key_map, table->keys);
table->db_options_in_use = info.options; table->db_options_in_use = info.options;
table->is_view=1; table->is_view=1;
mean_rec_length=info.reclength; mean_rec_length=info.reclength;
......
...@@ -3243,6 +3243,7 @@ Starts the MySQL server\n"); ...@@ -3243,6 +3243,7 @@ Starts the MySQL server\n");
--init-file=file Read SQL commands from this file at startup\n\ --init-file=file Read SQL commands from this file at startup\n\
-L, --language=... Client error messages in given language. May be\n\ -L, --language=... Client error messages in given language. May be\n\
given as a full path\n\ given as a full path\n\
--local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\
-l, --log[=file] Log connections and queries to file\n\ -l, --log[=file] Log connections and queries to file\n\
--log-bin[=file] Log queries in new binary format (for replication)\n\ --log-bin[=file] Log queries in new binary format (for replication)\n\
--log-bin-index=file File that holds the names for last binary log files\n\ --log-bin-index=file File that holds the names for last binary log files\n\
......
...@@ -765,11 +765,6 @@ bool change_password(THD *thd, const char *host, const char *user, ...@@ -765,11 +765,6 @@ bool change_password(THD *thd, const char *host, const char *user,
char *new_password) char *new_password)
{ {
uint length=0; uint length=0;
if (!user[0])
{
send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
return 1;
}
if (!initialized) if (!initialized)
{ {
send_error(&thd->net, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */ send_error(&thd->net, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */
...@@ -781,15 +776,21 @@ bool change_password(THD *thd, const char *host, const char *user, ...@@ -781,15 +776,21 @@ bool change_password(THD *thd, const char *host, const char *user,
length=(uint) strlen(new_password); length=(uint) strlen(new_password);
new_password[length & 16]=0; new_password[length & 16]=0;
if (!thd || (!thd->slave_thread && ( strcmp(thd->user,user) || if (!thd->slave_thread &&
my_strcasecmp(host,thd->host ? thd->host : thd->ip)))) (strcmp(thd->user,user) ||
my_strcasecmp(host,thd->host ? thd->host : thd->ip)))
{ {
if (check_access(thd, UPDATE_ACL, "mysql",0,1)) if (check_access(thd, UPDATE_ACL, "mysql",0,1))
return 1; return 1;
} }
if (!thd->slave_thread && !thd->user[0])
{
send_error(&thd->net, ER_PASSWORD_ANONYMOUS_USER);
return 1;
}
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
ACL_USER *acl_user; ACL_USER *acl_user;
if (!(acl_user= find_acl_user(host,user)) || !acl_user->user) if (!(acl_user= find_acl_user(host,user)))
{ {
send_error(&thd->net, ER_PASSWORD_NO_MATCH); send_error(&thd->net, ER_PASSWORD_NO_MATCH);
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
...@@ -797,7 +798,8 @@ bool change_password(THD *thd, const char *host, const char *user, ...@@ -797,7 +798,8 @@ bool change_password(THD *thd, const char *host, const char *user,
} }
if (update_user_table(thd, if (update_user_table(thd,
acl_user->host.hostname ? acl_user->host.hostname : "", acl_user->host.hostname ? acl_user->host.hostname : "",
acl_user->user, new_password)) acl_user->user ? acl_user->user : "",
new_password))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */ VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(&thd->net,0); /* purecov: deadcode */ send_error(&thd->net,0); /* purecov: deadcode */
...@@ -817,7 +819,7 @@ bool change_password(THD *thd, const char *host, const char *user, ...@@ -817,7 +819,7 @@ bool change_password(THD *thd, const char *host, const char *user,
qinfo.q_len = qinfo.q_len =
my_sprintf(buff, my_sprintf(buff,
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"", (buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
acl_user->user, acl_user->user ? acl_user->user : "",
acl_user->host.hostname ? acl_user->host.hostname : "", acl_user->host.hostname ? acl_user->host.hostname : "",
new_password)); new_password));
mysql_update_log.write(thd,buff,qinfo.q_len); mysql_update_log.write(thd,buff,qinfo.q_len);
......
...@@ -130,8 +130,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -130,8 +130,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0))); VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0)));
if (read_string(file,(gptr*) &disk_buff,(uint) uint2korr(head+28))) if (read_string(file,(gptr*) &disk_buff,(uint) uint2korr(head+28)))
goto err_not_open; /* purecov: inspected */ goto err_not_open; /* purecov: inspected */
outparam->keys=keys=disk_buff[0]; outparam->keys=keys= disk_buff[0];
outparam->keys_in_use= (((key_map) 1) << keys)- (key_map) 1; outparam->keys_in_use= set_bits(key_map, keys);
outparam->key_parts=key_parts=disk_buff[1]; outparam->key_parts=key_parts=disk_buff[1];
n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO); n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment