Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
00ff1f60
Commit
00ff1f60
authored
Mar 19, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/my/mysql-4.0
parents
b5469837
c6a05996
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
280 additions
and
119 deletions
+280
-119
include/errmsg.h
include/errmsg.h
+1
-0
include/mysql_version.h.in
include/mysql_version.h.in
+5
-0
libmysql/errmsg.c
libmysql/errmsg.c
+6
-3
libmysql/libmysql.c
libmysql/libmysql.c
+54
-0
mysql-test/r/rpl000009.result
mysql-test/r/rpl000009.result
+12
-0
mysql-test/t/reserv/system_mysql_db_fix.test
mysql-test/t/reserv/system_mysql_db_fix.test
+0
-14
mysql-test/t/rpl000009.test
mysql-test/t/rpl000009.test
+15
-0
mysql-test/t/system_mysql_db.test
mysql-test/t/system_mysql_db.test
+8
-8
mysql-test/t/system_mysql_db_fix-master.opt
mysql-test/t/system_mysql_db_fix-master.opt
+0
-0
mysql-test/t/system_mysql_db_fix.test
mysql-test/t/system_mysql_db_fix.test
+78
-0
mysql-test/t/system_mysql_db_refs.test
mysql-test/t/system_mysql_db_refs.test
+90
-89
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+10
-2
sql/set_var.cc
sql/set_var.cc
+1
-3
No files found.
include/errmsg.h
View file @
00ff1f60
...
...
@@ -63,4 +63,5 @@ extern const char *client_errors[]; /* Error messages */
#define CR_PROBE_MASTER_CONNECT 2025
#define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027
#define CR_WRONG_LICENSE 2028
include/mysql_version.h.in
View file @
00ff1f60
...
...
@@ -26,4 +26,9 @@
#define MYSQL_CHARSET "@default_charset@"
#endif /* MYSQL_CHARSET */
#endif /* _CUSTOMCONFIG_ */
#ifndef LICENSE
#define LICENSE "GPL"
#endif /* LICENSE */
#endif /* _mysql_version_h */
libmysql/errmsg.c
View file @
00ff1f60
...
...
@@ -51,7 +51,8 @@ const char *client_errors[]=
"Error connecting to slave:"
,
"Error connecting to master:"
,
"SSL connection error"
,
"Malformed packet"
"Malformed packet"
,
"This client library is licensed only for use with MySQL servers having '%s' license"
};
/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
...
...
@@ -86,7 +87,8 @@ const char *client_errors[]=
"Error connecting to slave:"
,
"Error connecting to master:"
,
"SSL connection error"
,
"Malformed packet"
"Malformed packet"
,
"This client library is licensed only for use with MySQL servers having '%s' license"
};
#else
/* ENGLISH */
...
...
@@ -119,7 +121,8 @@ const char *client_errors[]=
"Error connecting to slave:"
,
"Error connecting to master:"
,
"SSL connection error"
,
"Malformed packet"
"Malformed packet"
,
"This client library is licensed only for use with MySQL servers having '%s' license"
};
#endif
...
...
libmysql/libmysql.c
View file @
00ff1f60
...
...
@@ -1612,6 +1612,56 @@ mysql_connect(MYSQL *mysql,const char *host,
#endif
#ifdef CHECK_LICENSE
/*
Check server side variable 'license'.
If the variable does not exist or does not contain 'Commercial',
we're talking to non-commercial server from commercial client.
SYNOPSIS
check_license()
RETURN VALUE
0 success
!0 network error or the server is not commercial.
Error code is saved in mysql->net.last_errno.
*/
static
int
check_license
(
MYSQL
*
mysql
)
{
MYSQL_ROW
row
;
MYSQL_RES
*
res
;
NET
*
net
=
&
mysql
->
net
;
static
const
char
query
[]
=
"SELECT @@license"
;
static
const
char
required_license
[]
=
LICENSE
;
if
(
mysql_real_query
(
mysql
,
query
,
sizeof
(
query
)
-
1
))
{
if
(
net
->
last_errno
==
ER_UNKNOWN_SYSTEM_VARIABLE
)
{
net
->
last_errno
=
CR_WRONG_LICENSE
;
sprintf
(
net
->
last_error
,
ER
(
net
->
last_errno
),
required_license
);
}
return
1
;
}
if
(
!
(
res
=
mysql_use_result
(
mysql
)))
return
1
;
row
=
mysql_fetch_row
(
res
);
/*
If no rows in result set, or column value is NULL (none of these
two is ever true for server variables now), or column value
mismatch, set wrong license error.
*/
if
(
!
net
->
last_errno
&&
(
!
row
||
!
row
[
0
]
||
strncmp
(
row
[
0
],
required_license
,
sizeof
(
required_license
))))
{
net
->
last_errno
=
CR_WRONG_LICENSE
;
sprintf
(
net
->
last_error
,
ER
(
net
->
last_errno
),
required_license
);
}
mysql_free_result
(
res
);
return
net
->
last_errno
;
}
#endif
/* CHECK_LICENSE */
/*
The following union is used to force a struct to be double allgined.
This is to avoid warings with gethostname_r() on Linux itanium systems
...
...
@@ -2048,6 +2098,10 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
net
->
compress
=
1
;
if
(
mysql
->
options
.
max_allowed_packet
)
net
->
max_packet_size
=
mysql
->
options
.
max_allowed_packet
;
#ifdef CHECK_LICENSE
if
(
check_license
(
mysql
))
goto
error
;
#endif
if
(
db
&&
mysql_select_db
(
mysql
,
db
))
goto
error
;
if
(
mysql
->
options
.
init_command
)
...
...
mysql-test/r/rpl000009.result
View file @
00ff1f60
...
...
@@ -111,6 +111,18 @@ n s
2 two bar
3 three bar
4 four bar
stop slave;
reset slave;
load data from master;
start slave;
insert into bar.t1 values (5, 'five bar');
select * from bar.t1;
n s
1 one bar
2 two bar
3 three bar
4 four bar
5 five bar
load table bar.t1 from master;
Table 't1' already exists
drop table bar.t1;
...
...
mysql-test/t/reserv/system_mysql_db_fix.test
deleted
100644 → 0
View file @
b5469837
#
# This is the test for mysql_fix_privilege_tables
#
--
disable_query_log
--
source
include
/
create_old_system_tables
.
inc
--
exec
$MYSQL_FIX_SYSTEM_TABLES
--
database
=
test
>
nil
2
>
nil
--
enable_query_log
--
source
include
/
system_db_struct
.
inc
--
disable_query_log
--
source
include
/
drop_system_tables
.
inc
--
enable_query_log
mysql-test/t/rpl000009.test
View file @
00ff1f60
...
...
@@ -108,6 +108,21 @@ connection slave;
sync_with_master
;
select
*
from
bar
.
t1
;
# Check that LOAD DATA FROM MASTER is able to create master.info
# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
stop
slave
;
reset
slave
;
load
data
from
master
;
start
slave
;
# see if replication coordinates were restored fine
connection
master
;
insert
into
bar
.
t1
values
(
5
,
'five bar'
);
save_master_pos
;
connection
slave
;
sync_with_master
;
select
*
from
bar
.
t1
;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten.
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
...
...
mysql-test/t/
reserv/
system_mysql_db.test
→
mysql-test/t/system_mysql_db.test
View file @
00ff1f60
mysql-test/t/
reserv/
system_mysql_db_fix-master.opt
→
mysql-test/t/system_mysql_db_fix-master.opt
View file @
00ff1f60
File moved
mysql-test/t/system_mysql_db_fix.test
0 → 100644
View file @
00ff1f60
#
# This is the test for mysql_fix_privilege_tables
#
--
disable_result_log
--
disable_query_log
use
test
;
# create system tables as in mysql-3.20
CREATE
TABLE
db
(
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
Db
char
(
32
)
binary
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
Select_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Insert_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Update_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Delete_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Create_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Drop_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
PRIMARY
KEY
Host
(
Host
,
Db
,
User
),
KEY
User
(
User
)
)
type
=
ISAM
;
INSERT
INTO
db
VALUES
(
'%'
,
'test'
,
''
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
);
INSERT
INTO
db
VALUES
(
'%'
,
'test\_%'
,
''
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
);
CREATE
TABLE
host
(
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
Db
char
(
32
)
binary
DEFAULT
''
NOT
NULL
,
Select_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Insert_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Update_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Delete_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Create_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Drop_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
PRIMARY
KEY
Host
(
Host
,
Db
)
)
type
=
ISAM
;
CREATE
TABLE
user
(
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
Password
char
(
16
),
Select_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Insert_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Update_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Delete_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Create_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Drop_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Reload_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Shutdown_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
Process_priv
enum
(
'N'
,
'Y'
)
DEFAULT
'N'
NOT
NULL
,
PRIMARY
KEY
Host
(
Host
,
User
)
)
type
=
ISAM
;
INSERT
INTO
user
VALUES
(
'localhost'
,
'root'
,
''
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
,
'Y'
);
INSERT
INTO
user
VALUES
(
'localhost'
,
''
,
''
,
'N'
,
'N'
,
'N'
,
'N'
,
'N'
,
'N'
,
'N'
,
'N'
,
'N'
);
--
exec
$MYSQL_FIX_SYSTEM_TABLES
--
database
=
test
--
enable_query_log
--
enable_result_log
--
source
include
/
system_db_struct
.
inc
--
disable_query_log
DROP
TABLE
db
;
DROP
TABLE
host
;
DROP
TABLE
user
;
DROP
TABLE
func
;
DROP
TABLE
tables_priv
;
DROP
TABLE
columns_priv
;
--
enable_query_log
mysql-test/t/
reserv/
system_mysql_db_refs.test
→
mysql-test/t/system_mysql_db_refs.test
View file @
00ff1f60
...
...
@@ -87,3 +87,4 @@ drop table test_func;
drop
table
test_host
;
drop
table
test_user
;
drop
table
test_db
;
sql/repl_failsafe.cc
View file @
00ff1f60
...
...
@@ -874,7 +874,7 @@ int load_master_data(THD* thd)
cleanup_mysql_results
(
db_res
,
cur_table_res
-
1
,
table_res
);
// adjust
position in
the master
// adjust
replication coordinates from
the master
if
(
master_status_res
)
{
MYSQL_ROW
row
=
mc_mysql_fetch_row
(
master_status_res
);
...
...
@@ -887,10 +887,18 @@ int load_master_data(THD* thd)
*/
if
(
row
&&
row
[
0
]
&&
row
[
1
])
{
/*
If the slave's master info is not inited, we init it, then we write
the new coordinates to it. Must call init_master_info() *before*
setting active_mi, because init_master_info() sets active_mi with
defaults.
*/
if
(
init_master_info
(
active_mi
,
master_info_file
,
relay_log_info_file
,
0
))
send_error
(
&
thd
->
net
,
ER_MASTER_INFO
);
strmake
(
active_mi
->
master_log_name
,
row
[
0
],
sizeof
(
active_mi
->
master_log_name
));
active_mi
->
master_log_pos
=
strtoull
(
row
[
1
],
(
char
**
)
0
,
10
);
// don't hit the magic number
// at least in recent versions, the condition below should be false
if
(
active_mi
->
master_log_pos
<
BIN_LOG_HEADER_SIZE
)
active_mi
->
master_log_pos
=
BIN_LOG_HEADER_SIZE
;
active_mi
->
rli
.
pending
=
0
;
...
...
sql/set_var.cc
View file @
00ff1f60
...
...
@@ -334,14 +334,12 @@ static sys_var_rand_seed2 sys_rand_seed2("rand_seed2");
static
sys_var_thd_ulong
sys_default_week_format
(
"default_week_format"
,
&
SV
::
default_week_format
);
static
const
char
license
[]
=
"GPL"
;
/* Read only variables */
sys_var_const_str
sys_os
(
"version_compile_os"
,
SYSTEM_TYPE
);
sys_var_const_str
sys_license
(
"license"
,
license
);
/* Global read-only variable describing server license */
sys_var_const_str
sys_license
(
"license"
,
LICENSE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment