summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <monty@tik.mysql.com>2000-11-13 23:55:10 +0200
committerunknown <monty@tik.mysql.com>2000-11-13 23:55:10 +0200
commitf3d2341f1f30384d92b285c1e421d8c599ee2b79 (patch)
tree6689cb755cdb6ba0fb4cc6fbb215d75b175228d2 /client
parent675d31ee9a14d636d838400c670d0a1c2b964c9a (diff)
downloadmariadb-git-f3d2341f1f30384d92b285c1e421d8c599ee2b79.tar.gz
Bug fixes, TRUNCATE, safer passwords on command line and connect timeout
Docs/manual.texi: Update of safe_mysqld, TRUNCATE and changes for 3.23.28 client/mysql.cc: Added --timeout client/mysqladmin.c: Safer password handling client/mysqldump.c: Safer password handling client/mysqlimport.c: Safer password handling client/mysqlshow.c: Safer password handling configure.in: Fixes for Darwin and added test of poll include/my_pthread.h: Fixes for darwin include/violite.h: Added test for polling libmysql/libmysql.c: connect timeout libmysql/violite.c: connect timeout mysys/hash.c: Fix when delting from empty table scripts/safe_mysqld.sh: Added --open-files, --core-file-size and --timezone sql-bench/bench-init.pl.sh: Function print_time sql-bench/crash-me.sh: Added test of truncate sql-bench/test-insert.sh: More "estimated" tests sql-bench/test-select.sh: More "estimated" tests sql/filesort.cc: Removed allocation of extra memory sql/ha_berkeley.cc: Better estimation of number of rows sql/item_create.cc: Truncate sql/item_create.h: Truncate sql/item_strfunc.cc: Removed usage of MY_FAE sql/lex.h: Truncate sql/lock.cc: Fixed possible loop bug sql/log.cc: Removed usage of FILE:s sql/mysqld.cc: Print of more server variables sql/sql_class.h: Changed FILE -> File sql/sql_insert.cc: Fixed bug in temptable handling sql/sql_lex.h: Cleanup sql/sql_load.cc: Removed usage of MY_FAE sql/sql_parse.cc: Cleanup + TRUNCATE sql/sql_select.cc: Cleanup + fix for INSERT ... SELECT sql/sql_yacc.yy: TRUNCATE sql/violite.c: Merge with client/violite.c strings/strstr-sparc.s: Fixed wrong register usage
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc14
-rw-r--r--client/mysqladmin.c20
-rw-r--r--client/mysqldump.c19
-rw-r--r--client/mysqlimport.c17
-rw-r--r--client/mysqlshow.c22
5 files changed, 56 insertions, 36 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 8adb65ab3a6..5494ee6ccb9 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -115,7 +115,7 @@ static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
opt_compress=0,
vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0,
no_named_cmds=1; // we want this to be the default
-static uint verbose=0,opt_silent=0,opt_mysql_port=0;
+static uint verbose=0,opt_silent=0,opt_mysql_port=0,opt_connect_timeout=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
@@ -334,7 +334,7 @@ sig_handler mysql_end(int sig)
exit(status.exit_status);
}
-enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET} ;
+enum options {OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_TIMEOUT} ;
static struct option long_options[] =
@@ -374,6 +374,7 @@ static struct option long_options[] =
{"socket", required_argument, 0, 'S'},
#include "sslopt-longopts.h"
{"table", no_argument, 0, 't'},
+ {"timeout", required_argument, 0, OPT_TIMEOUT},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", required_argument, 0, 'u'},
#endif
@@ -545,9 +546,12 @@ static int get_options(int argc, char **argv)
case 'p':
if (optarg)
{
+ char *start=optarg;
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
opt_password=my_strdup(optarg,MYF(MY_FAE));
while (*optarg) *optarg++= 'x'; // Destroy argument
+ if (*start)
+ start[1]=0;
}
else
tty_password=1;
@@ -603,6 +607,9 @@ static int get_options(int argc, char **argv)
opt_mysql_unix_port=my_strdup(MYSQL_NAMEDPIPE,MYF(0));
#endif
break;
+ case OPT_TIMEOUT:
+ opt_connect_timeout=atoi(optarg);
+ break;
case 'V': usage(1); exit(0);
case 'I':
case '?':
@@ -1772,6 +1779,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
connected= 0;
}
mysql_init(&mysql);
+ if (opt_connect_timeout)
+ mysql_options(&mysql,MYSQL_OPT_CONNECT_TIMEOUT,
+ (char*) &opt_connect_timeout);
if (opt_compress)
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
#ifdef HAVE_OPENSSL
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index f8432ec7fb6..d5b2e73451e 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
-#define ADMIN_VERSION "8.9"
+#define ADMIN_VERSION "8.11"
#define MAX_MYSQL_VAR 64
#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -137,7 +137,7 @@ int main(int argc,char *argv[])
{
int c, error = 0,option_index=0;
MYSQL mysql;
- char *host = NULL,*password=0,*user=0,**commands;
+ char *host = NULL,*opt_password=0,*user=0,**commands;
my_bool tty_password=0;
MY_INIT(argv[0]);
mysql_init(&mysql);
@@ -160,9 +160,12 @@ int main(int argc,char *argv[])
case 'p':
if (optarg)
{
- my_free(password,MYF(MY_ALLOW_ZERO_PTR));
- password=my_strdup(optarg,MYF(MY_FAE));
+ char *start=optarg;
+ my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ opt_password=my_strdup(optarg,MYF(MY_FAE));
while (*optarg) *optarg++= 'x'; /* Destroy argument */
+ if (*start)
+ start[1]=0; /* Cut length of argument */
}
else
tty_password=1;
@@ -243,12 +246,11 @@ int main(int argc,char *argv[])
exit(1);
}
if (tty_password)
- password = get_tty_password(NullS);
+ opt_password = get_tty_password(NullS);
VOID(signal(SIGINT,endprog)); /* Here if abort */
VOID(signal(SIGTERM,endprog)); /* Here if abort */
- mysql_init(&mysql);
if (opt_compress)
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
#ifdef HAVE_OPENSSL
@@ -256,7 +258,7 @@ int main(int argc,char *argv[])
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath);
#endif /* HAVE_OPENSSL */
- if (sql_connect(&mysql,host,user,password,option_wait))
+ if (sql_connect(&mysql,host,user,opt_password,option_wait))
error = 1;
else
{
@@ -269,7 +271,7 @@ int main(int argc,char *argv[])
if (option_wait && !interrupted)
{
mysql_close(&mysql);
- if (!sql_connect(&mysql,host,user,password,option_wait))
+ if (!sql_connect(&mysql,host,user,opt_password,option_wait))
continue; /* Retry */
}
error=1;
@@ -286,7 +288,7 @@ int main(int argc,char *argv[])
}
mysql_close(&mysql);
}
- my_free(password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
my_free(user,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(argv);
my_end(0);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 5ec559c5227..82fcad6bff6 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -37,7 +37,7 @@
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
**/
-#define DUMP_VERSION "8.10"
+#define DUMP_VERSION "8.11"
#include <global.h>
#include <my_sys.h>
@@ -75,7 +75,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0;
static MYSQL mysql_connection,*sock=0;
-static char insert_pat[12 * 1024],*password=0,*current_user=0,
+static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *default_charset;
@@ -333,9 +333,12 @@ static int get_options(int *argc,char ***argv)
case 'p':
if (optarg)
{
- my_free(password,MYF(MY_ALLOW_ZERO_PTR));
- password=my_strdup(optarg,MYF(MY_FAE));
- while (*optarg) *optarg++= 'x'; /* Destroy argument */
+ char *start=optarg;
+ my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ opt_password=my_strdup(optarg,MYF(MY_FAE));
+ while (*optarg) *optarg++= 'x'; /* Destroy argument */
+ if (*start)
+ start[1]=0; /* Cut length of argument */
}
else
tty_password=1;
@@ -459,7 +462,7 @@ static int get_options(int *argc,char ***argv)
return 1;
}
if (tty_password)
- password=get_tty_password(NullS);
+ opt_password=get_tty_password(NullS);
return(0);
} /* get_options */
@@ -1236,7 +1239,7 @@ int main(int argc, char **argv)
my_end(0);
exit(EX_USAGE);
}
- if (dbConnect(current_host, current_user, password))
+ if (dbConnect(current_host, current_user, opt_password))
exit(EX_MYSQLERR);
if (!path)
write_heder(stdout, *argv);
@@ -1276,7 +1279,7 @@ int main(int argc, char **argv)
}
dbDisconnect(current_host);
puts("");
- my_free(password, MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (extended_insert)
dynstr_free(&extended_row);
my_end(0);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 596b68591b7..68cd84fbbb7 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "2.4"
+#define IMPORT_VERSION "2.5"
#include <global.h>
#include <my_sys.h>
@@ -45,7 +45,7 @@ static my_bool verbose=0,lock_tables=0,ignore_errors=0,delete=0,
replace=0,silent=0,ignore=0,opt_compress=0,opt_local_file=0;
static MYSQL mysql_connection;
-static char *password=0, *current_user=0,
+static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, opt_low_priority=0, *opt_columns=0;
@@ -202,9 +202,12 @@ static int get_options(int *argc, char ***argv)
case 'p':
if (optarg)
{
- my_free(password,MYF(MY_ALLOW_ZERO_PTR));
- password= my_strdup(optarg,MYF(MY_FAE));
+ char *start=optarg;
+ my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ opt_password=my_strdup(optarg,MYF(MY_FAE));
while (*optarg) *optarg++= 'x'; /* Destroy argument */
+ if (*start)
+ start[1]=0; /* Cut length of argument */
}
else
tty_password= 1;
@@ -276,7 +279,7 @@ static int get_options(int *argc, char ***argv)
current_db= *((*argv)++);
(*argc)--;
if (tty_password)
- password=get_tty_password(NullS);
+ opt_password=get_tty_password(NullS);
return(0);
}
@@ -504,7 +507,7 @@ int main(int argc, char **argv)
argv_to_free= argv;
if (get_options(&argc, &argv))
return(1);
- if (!(sock= db_connect(current_host,current_db,current_user,password)))
+ if (!(sock= db_connect(current_host,current_db,current_user,opt_password)))
return(1); /* purecov: deadcode */
if (lock_tables)
lock_table(sock, argc, argv);
@@ -513,7 +516,7 @@ int main(int argc, char **argv)
if (exitcode == 0)
exitcode = error;
db_disconnect(current_host, sock);
- my_free(password,MYF(MY_ALLOW_ZERO_PTR));
+ my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(argv_to_free);
my_end(0);
return(exitcode);
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index bf924ddeecd..3c34b2df4b5 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -28,7 +28,7 @@
#include <stdarg.h>
#include <getopt.h>
-static my_string host=0,password=0,user=0;
+static my_string host=0,opt_password=0,user=0;
static my_bool opt_show_keys=0,opt_compress=0,opt_status=0;
static void get_options(int *argc,char ***argv);
@@ -88,15 +88,13 @@ int main(int argc, char **argv)
mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath);
#endif
- if (!(mysql_real_connect(&mysql,host,user,password,
+ if (!(mysql_real_connect(&mysql,host,user,opt_password,
argv[0],opt_mysql_port,opt_mysql_unix_port,
0)))
{
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
exit(1);
}
- /* if (!(mysql_connect(&mysql,host,user,password))) */
-
switch (argc)
{
@@ -111,11 +109,12 @@ int main(int argc, char **argv)
if (opt_status && ! wild)
error=list_table_status(&mysql,argv[0],argv[1]);
else
- error=list_fields(&mysql,argv[0],argv[1],wild); break;
+ error=list_fields(&mysql,argv[0],argv[1],wild);
+ break;
}
mysql_close(&mysql); /* Close & free connection */
- if (password)
- my_free(password,MYF(0));
+ if (opt_password)
+ my_free(opt_password,MYF(0));
my_end(0);
exit(error ? 1 : 0);
return 0; /* No compiler warnings */
@@ -223,9 +222,12 @@ get_options(int *argc,char ***argv)
case 'p':
if (optarg)
{
- my_free(password,MYF(MY_ALLOW_ZERO_PTR));
- password=my_strdup(optarg,MYF(MY_FAE));
+ char *start=optarg;
+ my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+ opt_password=my_strdup(optarg,MYF(MY_FAE));
while (*optarg) *optarg++= 'x'; /* Destroy argument */
+ if (*start)
+ start[1]=0; /* Cut length of argument */
}
else
tty_password=1;
@@ -266,7 +268,7 @@ get_options(int *argc,char ***argv)
(*argc)-=optind;
(*argv)+=optind;
if (tty_password)
- password=get_tty_password(NullS);
+ opt_password=get_tty_password(NullS);
return;
}