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
81948e62
Commit
81948e62
authored
Sep 06, 2005
by
eric@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge eherman@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/Users/eric/bktmp/mysql-4.1
parents
167bc61f
5a8af4cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
21 deletions
+19
-21
sql/hostname.cc
sql/hostname.cc
+9
-1
sql/sql_parse.cc
sql/sql_parse.cc
+10
-20
No files found.
sql/hostname.cc
View file @
81948e62
...
@@ -130,15 +130,23 @@ void reset_host_errors(struct in_addr *in)
...
@@ -130,15 +130,23 @@ void reset_host_errors(struct in_addr *in)
VOID
(
pthread_mutex_unlock
(
&
hostname_cache
->
lock
));
VOID
(
pthread_mutex_unlock
(
&
hostname_cache
->
lock
));
}
}
/* Deal with systems that don't defined INADDR_LOOPBACK */
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001UL
#endif
my_string
ip_to_hostname
(
struct
in_addr
*
in
,
uint
*
errors
)
my_string
ip_to_hostname
(
struct
in_addr
*
in
,
uint
*
errors
)
{
{
uint
i
;
uint
i
;
host_entry
*
entry
;
host_entry
*
entry
;
DBUG_ENTER
(
"ip_to_hostname"
);
DBUG_ENTER
(
"ip_to_hostname"
);
*
errors
=
0
;
/* We always treat the loopback address as "localhost". */
if
(
in
->
s_addr
==
htonl
(
INADDR_LOOPBACK
))
DBUG_RETURN
((
char
*
)
my_localhost
);
/* Check first if we have name in cache */
/* Check first if we have name in cache */
*
errors
=
0
;
if
(
!
(
specialflag
&
SPECIAL_NO_HOST_CACHE
))
if
(
!
(
specialflag
&
SPECIAL_NO_HOST_CACHE
))
{
{
VOID
(
pthread_mutex_lock
(
&
hostname_cache
->
lock
));
VOID
(
pthread_mutex_lock
(
&
hostname_cache
->
lock
));
...
...
sql/sql_parse.cc
View file @
81948e62
...
@@ -696,29 +696,19 @@ static int check_connection(THD *thd)
...
@@ -696,29 +696,19 @@ static int check_connection(THD *thd)
return
(
ER_OUT_OF_RESOURCES
);
return
(
ER_OUT_OF_RESOURCES
);
thd
->
host_or_ip
=
thd
->
ip
;
thd
->
host_or_ip
=
thd
->
ip
;
vio_in_addr
(
net
->
vio
,
&
thd
->
remote
.
sin_addr
);
vio_in_addr
(
net
->
vio
,
&
thd
->
remote
.
sin_addr
);
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
if
(
!
(
specialflag
&
SPECIAL_NO_RESOLVE
))
/* Fast local hostname resolve for Win32 */
if
(
!
strcmp
(
thd
->
ip
,
"127.0.0.1"
))
{
{
thd
->
host
=
(
char
*
)
my_localhost
;
vio_in_addr
(
net
->
vio
,
&
thd
->
remote
.
sin_addr
);
thd
->
host_or_ip
=
my_localhost
;
thd
->
host
=
ip_to_hostname
(
&
thd
->
remote
.
sin_addr
,
&
connect_errors
);
}
/* Cut very long hostnames to avoid possible overflows */
else
if
(
thd
->
host
)
#endif
{
if
(
!
(
specialflag
&
SPECIAL_NO_RESOLVE
))
{
{
vio_in_addr
(
net
->
vio
,
&
thd
->
remote
.
sin_addr
);
if
(
thd
->
host
!=
my_localhost
)
thd
->
host
=
ip_to_hostname
(
&
thd
->
remote
.
sin_addr
,
&
connect_errors
);
thd
->
host
[
min
(
strlen
(
thd
->
host
),
HOSTNAME_LENGTH
)]
=
0
;
/* Cut very long hostnames to avoid possible overflows */
thd
->
host_or_ip
=
thd
->
host
;
if
(
thd
->
host
)
{
thd
->
host
[
min
(
strlen
(
thd
->
host
),
HOSTNAME_LENGTH
)]
=
0
;
thd
->
host_or_ip
=
thd
->
host
;
}
if
(
connect_errors
>
max_connect_errors
)
return
(
ER_HOST_IS_BLOCKED
);
}
}
if
(
connect_errors
>
max_connect_errors
)
return
(
ER_HOST_IS_BLOCKED
);
}
}
DBUG_PRINT
(
"info"
,(
"Host: %s ip: %s"
,
DBUG_PRINT
(
"info"
,(
"Host: %s ip: %s"
,
thd
->
host
?
thd
->
host
:
"unknown host"
,
thd
->
host
?
thd
->
host
:
"unknown host"
,
...
...
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