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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
bf19492e
Commit
bf19492e
authored
Jun 13, 2016
by
Daniele Sciascia
Committed by
Nirbhay Choubey
Aug 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GCF-837 Check wsrep interface version before loading provider
parent
dfa9012a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
6 deletions
+31
-6
wsrep/wsrep_loader.c
wsrep/wsrep_loader.c
+31
-6
No files found.
wsrep/wsrep_loader.c
View file @
bf19492e
...
...
@@ -37,6 +37,22 @@ static wsrep_log_cb_t logger = default_logger;
* Library loader
**************************************************************************/
static
int
wsrep_check_iface_version
(
const
char
*
found
,
const
char
*
iface_ver
)
{
const
size_t
msg_len
=
128
;
char
msg
[
128
];
if
(
strcmp
(
found
,
iface_ver
))
{
snprintf
(
msg
,
msg_len
,
"provider interface version mismatch: need '%s', found '%s'"
,
iface_ver
,
found
);
logger
(
WSREP_LOG_ERROR
,
msg
);
return
EINVAL
;
}
return
0
;
}
static
int
verify
(
const
wsrep_t
*
wh
,
const
char
*
iface_ver
)
{
char
msg
[
128
];
...
...
@@ -50,13 +66,8 @@ static int verify(const wsrep_t *wh, const char *iface_ver)
VERIFY
(
wh
);
VERIFY
(
wh
->
version
);
if
(
strcmp
(
wh
->
version
,
iface_ver
))
{
snprintf
(
msg
,
sizeof
(
msg
),
"provider interface version mismatch: need '%s', found '%s'"
,
iface_ver
,
wh
->
version
);
logger
(
WSREP_LOG_ERROR
,
msg
);
if
(
wsrep_check_iface_version
(
wh
->
version
,
iface_ver
))
return
EINVAL
;
}
VERIFY
(
wh
->
init
);
VERIFY
(
wh
->
options_set
);
...
...
@@ -107,6 +118,15 @@ static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym)
return
alias
.
dlfun
;
}
static
int
wsrep_check_version_symbol
(
void
*
dlh
)
{
char
**
dlversion
=
NULL
;
dlversion
=
(
char
**
)
dlsym
(
dlh
,
"wsrep_interface_version"
);
if
(
dlversion
==
NULL
)
return
0
;
return
wsrep_check_iface_version
(
*
dlversion
,
WSREP_INTERFACE_VERSION
);
}
extern
int
wsrep_dummy_loader
(
wsrep_t
*
w
);
int
wsrep_load
(
const
char
*
spec
,
wsrep_t
**
hptr
,
wsrep_log_cb_t
log_cb
)
...
...
@@ -151,6 +171,11 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
goto
out
;
}
if
(
wsrep_check_version_symbol
(
dlh
)
!=
0
)
{
ret
=
EINVAL
;
goto
out
;
}
if
((
ret
=
(
*
dlfun
)(
*
hptr
))
!=
0
)
{
snprintf
(
msg
,
sizeof
(
msg
),
"wsrep_load(): loader failed: %s"
,
strerror
(
ret
));
...
...
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