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
b9f51f70
Commit
b9f51f70
authored
Mar 17, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL #1510 "Implement support for "commercial" binaries on handshake",
client library: - implemented 'check_license' function
parent
b28a13c0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
6 deletions
+67
-6
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
sql/set_var.cc
sql/set_var.cc
+1
-3
No files found.
include/errmsg.h
View file @
b9f51f70
...
...
@@ -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 @
b9f51f70
...
...
@@ -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 @
b9f51f70
...
...
@@ -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 @
b9f51f70
...
...
@@ -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
)
...
...
sql/set_var.cc
View file @
b9f51f70
...
...
@@ -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