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
f394cb68
Commit
f394cb68
authored
Sep 16, 2005
by
hartmut@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compare host names by address lookup instead of simple string comparison
parent
eff11c53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
3 deletions
+45
-3
ndb/tools/ndb_config.cpp
ndb/tools/ndb_config.cpp
+45
-3
No files found.
ndb/tools/ndb_config.cpp
View file @
f394cb68
...
...
@@ -23,6 +23,8 @@
#include <my_getopt.h>
#include <mysql_version.h>
#include <netdb.h>
#include <NdbOut.hpp>
#include <mgmapi.h>
#include <mgmapi_configuration.hpp>
...
...
@@ -127,6 +129,11 @@ struct Match
virtual
int
eval
(
NdbMgmHandle
,
const
Iter
&
);
};
struct
HostMatch
:
public
Match
{
virtual
int
eval
(
NdbMgmHandle
,
const
Iter
&
);
};
struct
Apply
{
Apply
()
{}
...
...
@@ -297,9 +304,10 @@ parse_where(Vector<Match*>& where, int &argc, char**& argv)
Match
m
;
if
(
g_host
)
{
m
.
m_key
=
CFG_NODE_HOST
;
m
.
m_value
.
assfmt
(
"%s"
,
g_host
);
where
.
push_back
(
new
Match
(
m
));
HostMatch
*
m
=
new
HostMatch
;
m
->
m_key
=
CFG_NODE_HOST
;
m
->
m_value
.
assfmt
(
"%s"
,
g_host
);
where
.
push_back
(
m
);
}
if
(
g_type
)
...
...
@@ -375,6 +383,40 @@ Match::eval(NdbMgmHandle h, const Iter& iter)
return
1
;
}
int
HostMatch
::
eval
(
NdbMgmHandle
h
,
const
Iter
&
iter
)
{
const
char
*
valc
;
if
(
iter
.
get
(
m_key
,
&
valc
)
==
0
)
{
struct
hostent
*
h1
,
*
h2
;
h1
=
gethostbyname
(
m_value
.
c_str
());
if
(
h1
==
NULL
)
{
return
0
;
}
h2
=
gethostbyname
(
valc
);
if
(
h2
==
NULL
)
{
return
0
;
}
if
(
h1
->
h_addrtype
!=
h2
->
h_addrtype
)
{
return
0
;
}
if
(
h1
->
h_length
!=
h2
->
h_length
)
{
return
0
;
}
return
0
==
memcmp
(
h1
->
h_addr
,
h2
->
h_addr
,
h1
->
h_length
);
}
return
0
;
}
int
Apply
::
apply
(
NdbMgmHandle
h
,
const
Iter
&
iter
)
{
...
...
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