summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/Makefile.am17
-rw-r--r--sql-common/client.c28
-rw-r--r--sql-common/client_plugin.c4
-rw-r--r--sql-common/my_time.c7
4 files changed, 22 insertions, 34 deletions
diff --git a/sql-common/Makefile.am b/sql-common/Makefile.am
deleted file mode 100644
index 2f5a049085f..00000000000
--- a/sql-common/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2003-2004, 2006 MySQL AB
-#
-# 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
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-## Process this file with automake to create Makefile.in
-EXTRA_DIST = client.c pack.c my_time.c my_user.c client_plugin.c
diff --git a/sql-common/client.c b/sql-common/client.c
index e8ca74eba37..3bb626e824a 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -4197,7 +4197,7 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
int pkt_len;
uchar *pkt;
- DBUG_ENTER ("native_password_auth_client");
+ DBUG_ENTER("native_password_auth_client");
if (((MCPVIO_EXT *)vio)->mysql_change_user)
@@ -4213,10 +4213,10 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
{
/* read the scramble */
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
- return CR_ERROR;
+ DBUG_RETURN(CR_ERROR);
if (pkt_len != SCRAMBLE_LENGTH + 1)
- DBUG_RETURN (CR_SERVER_HANDSHAKE_ERR);
+ DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR);
/* save it in MYSQL */
memcpy(mysql->scramble, pkt, SCRAMBLE_LENGTH);
@@ -4226,19 +4226,19 @@ static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
if (mysql->passwd[0])
{
char scrambled[SCRAMBLE_LENGTH + 1];
- DBUG_PRINT ("info", ("sending scramble"));
+ DBUG_PRINT("info", ("sending scramble"));
scramble(scrambled, (char*)pkt, mysql->passwd);
if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH))
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
}
else
{
- DBUG_PRINT ("info", ("no password"));
+ DBUG_PRINT("info", ("no password"));
if (vio->write_packet(vio, 0, 0)) /* no password */
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
}
- DBUG_RETURN (CR_OK);
+ DBUG_RETURN(CR_OK);
}
/**
@@ -4250,7 +4250,7 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
uchar *pkt;
int pkt_len;
- DBUG_ENTER ("old_password_auth_client");
+ DBUG_ENTER("old_password_auth_client");
if (((MCPVIO_EXT *)vio)->mysql_change_user)
{
@@ -4265,11 +4265,11 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
{
/* read the scramble */
if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
- return CR_ERROR;
+ DBUG_RETURN(CR_ERROR);
if (pkt_len != SCRAMBLE_LENGTH_323 + 1 &&
pkt_len != SCRAMBLE_LENGTH + 1)
- DBUG_RETURN (CR_SERVER_HANDSHAKE_ERR);
+ DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR);
/* save it in MYSQL */
memcpy(mysql->scramble, pkt, pkt_len);
@@ -4281,11 +4281,11 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
char scrambled[SCRAMBLE_LENGTH_323 + 1];
scramble_323(scrambled, (char*)pkt, mysql->passwd);
if (vio->write_packet(vio, (uchar*)scrambled, SCRAMBLE_LENGTH_323 + 1))
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
}
else
if (vio->write_packet(vio, 0, 0)) /* no password */
- DBUG_RETURN (CR_ERROR);
+ DBUG_RETURN(CR_ERROR);
- DBUG_RETURN (CR_OK);
+ DBUG_RETURN(CR_OK);
}
diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c
index bfeea40b401..6114d95cd73 100644
--- a/sql-common/client_plugin.c
+++ b/sql-common/client_plugin.c
@@ -176,11 +176,11 @@ err2:
if (plugin->deinit)
plugin->deinit();
err1:
- if (dlhandle)
- dlclose(dlhandle);
set_mysql_extended_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD, unknown_sqlstate,
ER(CR_AUTH_PLUGIN_CANNOT_LOAD), plugin->name,
errmsg);
+ if (dlhandle)
+ dlclose(dlhandle);
return NULL;
}
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index ac6c2ace890..38384600fc1 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1127,7 +1127,12 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
nr= (nr+19000000L)*1000000L; /* YYMMDD, year: 1970-1999 */
goto ok;
}
- if (nr < 10000101L)
+ /*
+ Though officially we support DATE values from 1000-01-01 only, one can
+ easily insert a value like 1-1-1. So, for consistency reasons such dates
+ are allowed when TIME_FUZZY_DATE is set.
+ */
+ if (nr < 10000101L && !(flags & TIME_FUZZY_DATE))
goto err;
if (nr <= 99991231L)
{