You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Merge branch '3.0' into 3.1
This commit is contained in:
@@ -171,8 +171,8 @@ IF(MAJOR_VERSION)
|
||||
SET(MARIADB_CLIENT_VERSION_PATCH ${PATCH_VERSION})
|
||||
ELSE()
|
||||
SET(MARIADB_CLIENT_VERSION_MAJOR "10")
|
||||
SET(MARIADB_CLIENT_VERSION_MINOR "3")
|
||||
SET(MARIADB_CLIENT_VERSION_PATCH "6")
|
||||
SET(MARIADB_CLIENT_VERSION_MINOR "4")
|
||||
SET(MARIADB_CLIENT_VERSION_PATCH "3")
|
||||
ENDIF()
|
||||
SET(MARIADB_CLIENT_VERSION "${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}.${MARIADB_CLIENT_VERSION_PATCH}")
|
||||
SET(MARIADB_BASE_VERSION "mariadb-${MARIADB_CLIENT_VERSION_MAJOR}.${MARIADB_CLIENT_VERSION_MINOR}")
|
||||
|
@@ -1213,11 +1213,6 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
||||
if (!mysql->methods)
|
||||
mysql->methods= &MARIADB_DEFAULT_METHODS;
|
||||
|
||||
if (!host || !host[0])
|
||||
host = mysql->options.host;
|
||||
|
||||
ma_set_connect_attrs(mysql, host);
|
||||
|
||||
if (net->pvio) /* check if we are already connected */
|
||||
{
|
||||
SET_CLIENT_ERROR(mysql, CR_ALREADY_CONNECTED, SQLSTATE_UNKNOWN, 0);
|
||||
@@ -1236,6 +1231,11 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
||||
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
|
||||
}
|
||||
|
||||
if (!host || !host[0])
|
||||
host = mysql->options.host;
|
||||
|
||||
ma_set_connect_attrs(mysql, host);
|
||||
|
||||
#ifndef WIN32
|
||||
if (mysql->options.protocol > MYSQL_PROTOCOL_SOCKET)
|
||||
{
|
||||
@@ -2032,7 +2032,8 @@ int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length)
|
||||
case SESSION_TRACK_STATE_CHANGE:
|
||||
case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:
|
||||
case SESSION_TRACK_SYSTEM_VARIABLES:
|
||||
net_field_length(&pos); /* ignore total length, item length will follow next */
|
||||
if (si_type != SESSION_TRACK_STATE_CHANGE)
|
||||
net_field_length(&pos); /* ignore total length, item length will follow next */
|
||||
plen= net_field_length(&pos);
|
||||
if (!ma_multi_malloc(0,
|
||||
&session_item, sizeof(LIST),
|
||||
|
@@ -8,7 +8,7 @@
|
||||
typedef struct st_mysql_client_plugin_AUTHENTICATION auth_plugin_t;
|
||||
static int client_mpvio_write_packet(struct st_plugin_vio*, const uchar*, size_t);
|
||||
static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
|
||||
static int dummy_fallback_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
|
||||
static int dummy_fallback_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql __attribute__((unused)));
|
||||
extern void read_user_name(char *name);
|
||||
extern char *ma_send_connect_attr(MYSQL *mysql, unsigned char *buffer);
|
||||
extern int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length);
|
||||
@@ -112,7 +112,7 @@ auth_plugin_t dummy_fallback_client_plugin=
|
||||
};
|
||||
|
||||
|
||||
static int dummy_fallback_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
|
||||
static int dummy_fallback_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql __attribute__((unused)))
|
||||
{
|
||||
char last_error[MYSQL_ERRMSG_SIZE];
|
||||
unsigned int i, last_errno= ((MCPVIO_EXT *)vio)->mysql->net.last_errno;
|
||||
|
@@ -1345,6 +1345,10 @@ static int test_expired_pw(MYSQL *my)
|
||||
my_test_connect(mysql, hostname, "foo", "foo", schema,
|
||||
port, socketname, 0);
|
||||
|
||||
/* we should be in sandbox mode now, only set commands should be allowed */
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
||||
FAIL_IF(!rc, "Error expected (we are in sandbox mode");
|
||||
|
||||
diag("error: %d %s", mysql_errno(mysql), mysql_error(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) != ER_MUST_CHANGE_PASSWORD &&
|
||||
mysql_errno(mysql) != ER_MUST_CHANGE_PASSWORD_LOGIN, "Error 1820/1862 expected");
|
||||
@@ -1610,6 +1614,13 @@ static int test_conc366(MYSQL *mysql)
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
/* check if ed25519 plugin is available */
|
||||
if (!mysql_client_find_plugin(mysql, "client_ed25519", 3))
|
||||
{
|
||||
diag("client_ed25519 plugin not available");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "INSTALL SONAME 'auth_ed25519'");
|
||||
if (rc)
|
||||
{
|
||||
@@ -1639,13 +1650,40 @@ static int test_conc366(MYSQL *mysql)
|
||||
sprintf(query, "UNINSTALL SONAME 'auth_ed25519'");
|
||||
rc= mysql_query(mysql, query);
|
||||
check_mysql_rc(rc, mysql);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc392(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
const char *data;
|
||||
size_t len;
|
||||
ulong capabilities= 0;
|
||||
|
||||
mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_CAPABILITIES, &capabilities);
|
||||
if (!(capabilities & CLIENT_SESSION_TRACKING))
|
||||
{
|
||||
diag("Server doesn't support session tracking (cap=%lu)", mysql->server_capabilities);
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "set session_track_state_change=1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
if (mysql_session_track_get_first(mysql, SESSION_TRACK_STATE_CHANGE, &data, &len))
|
||||
{
|
||||
diag("session_track_get_first failed");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FAIL_IF(len != 1, "Expected length 1");
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_conc366", test_conc366, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc392", test_conc392, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc312", test_conc312, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc351", test_conc351, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_conc332", test_conc332, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
|
@@ -239,6 +239,7 @@ static int test_parse_error_and_bad_length(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
int rc;
|
||||
char stmt_str[128];
|
||||
|
||||
/* check that we get 4 syntax errors over the 4 calls */
|
||||
|
||||
@@ -254,7 +255,9 @@ static int test_parse_error_and_bad_length(MYSQL *mysql)
|
||||
mysql_stmt_close(stmt);
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
FAIL_UNLESS(stmt, "");
|
||||
rc= mysql_stmt_prepare(stmt, "SHOW DATABASES", 100);
|
||||
memset(stmt_str, 0, 100);
|
||||
strcpy(stmt_str, "SHOW DATABASES");
|
||||
rc= mysql_stmt_prepare(stmt, stmt_str, 99);
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
mysql_stmt_close(stmt);
|
||||
return OK;
|
||||
|
Reference in New Issue
Block a user