/
02_hostname_cache.patch
596 lines (572 loc) · 19 KB
/
02_hostname_cache.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
diff -Nur -x bdb mysql-5.0.25-nightly-20060823.host_cache01/client/mysql_priv.h mysql-5.0.25-nightly-20060823.host_cache02/client/mysql_priv.h
--- mysql-5.0.25-nightly-20060823.host_cache01/client/mysql_priv.h 2006-09-25 20:30:47.000000000 -0700
+++ mysql-5.0.25-nightly-20060823.host_cache02/client/mysql_priv.h 2006-09-25 20:32:03.000000000 -0700
@@ -1476,8 +1476,8 @@
/* from hostname.cc */
struct in_addr;
my_string ip_to_hostname(struct in_addr *in,uint *errors);
-void inc_host_errors(struct in_addr *in);
-void reset_host_errors(struct in_addr *in);
+void hostname_cache_inc_errors(struct in_addr *in);
+void hostname_cache_reset_errors(struct in_addr *in);
bool hostname_cache_init();
void hostname_cache_free();
void hostname_cache_refresh(void);
diff -Nur -x bdb mysql-5.0.25-nightly-20060823.host_cache01/sql/hostname.cc mysql-5.0.25-nightly-20060823.host_cache02/sql/hostname.cc
--- mysql-5.0.25-nightly-20060823.host_cache01/sql/hostname.cc 2006-09-25 20:30:47.000000000 -0700
+++ mysql-5.0.25-nightly-20060823.host_cache02/sql/hostname.cc 2006-09-25 21:07:53.000000000 -0700
@@ -16,8 +16,9 @@
/*
- Get hostname for an IP. Hostnames are checked with reverse name lookup and
- checked that they doesn't resemble an ip.
+ Get hostname for an IP. Hostnames are then checked with forward lookup
+ to see that they match the IP address, and checked that they don't
+ resemble an IP address.
*/
#include "mysql_priv.h"
@@ -41,122 +42,230 @@
class host_entry :public hash_filo_element
{
public:
- char ip[sizeof(((struct in_addr *) 0)->s_addr)];
+ uint32 ip;
uint errors;
char *hostname;
};
static hash_filo *hostname_cache;
-static pthread_mutex_t LOCK_hostname;
-void hostname_cache_refresh()
+/*
+ A simple inline function to return the hash key for a given entry.
+*/
+static inline byte *host_entry_get_key(host_entry *entry, uint *length,
+ my_bool not_used __attribute__((unused)))
+ {
+ *length= sizeof(uint32);
+ return (byte *) &entry->ip;
+}
+
+/*
+ A simple inline function to free a hash entry.
+*/
+static inline void host_entry_free_key(host_entry *entry)
{
- hostname_cache->clear();
+ my_free(entry->hostname, MYF(0));
+ my_free((byte *) entry, MYF(0));
}
+
+/*
+ Initializes the hash structure for the hostname cache. Should be
+ called while the server is running single-threaded, before accepting
+ any connections.
+
+ SYNOPSIS
+ hostname_cache_init()
+
+ RETURN
+ 0 ok
+ 1 error
+*/
bool hostname_cache_init()
{
- host_entry tmp;
- uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp);
- if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
- sizeof(struct in_addr),NULL,
- (hash_free_key) free,
- &my_charset_bin)))
- return 1;
+ DBUG_ENTER("hostname_cache_init");
+ if (!(hostname_cache= new hash_filo(HOST_CACHE_SIZE, 0, 0,
+ (hash_get_key) host_entry_get_key,
+ (hash_free_key) host_entry_free_key,
+ &my_charset_latin1)))
+ DBUG_RETURN(1);
hostname_cache->clear();
- (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
- return 0;
+ DBUG_RETURN(0);
}
+/*
+ Cleans up the hash structure for the hostname cache. Should be called
+ after stopping accepting connections, before shutting down.
+
+ SYNOPSIS
+ hostname_cache_free()
+*/
void hostname_cache_free()
{
- if (hostname_cache)
- {
- (void) pthread_mutex_destroy(&LOCK_hostname);
- delete hostname_cache;
- hostname_cache= 0;
- }
+ DBUG_ENTER("hostname_cache_free");
+ if (hostname_cache)
+ {
+ delete hostname_cache;
+ hostname_cache= 0;
+ }
+ DBUG_VOID_RETURN;
+}
+
+/*
+ Empty the contents of the hostname cache.
+
+ SYNOPSIS
+ hostname_cache_refresh()
+*/
+void hostname_cache_refresh()
+{
+ DBUG_ENTER("hostname_cache_refresh");
+ hostname_cache->clear();
+ DBUG_VOID_RETURN;
}
+/*
+ Adds an entry in the hostname cache for an IP address stored in 'in'
+ and a hostname 'name'.
-static void add_hostname(struct in_addr *in,const char *name)
+ SYNOPSIS
+ hostname_cache_add(in, name)
+ in pointer to struct in_addr with IP address
+ name string with hostname associated to IP address
+*/
+static void hostname_cache_add(struct in_addr *in, const char *name)
{
- if (!(specialflag & SPECIAL_NO_HOST_CACHE))
- {
+ DBUG_ENTER("hostname_cache_add");
+
+ if (likely(!(specialflag & SPECIAL_NO_HOST_CACHE)))
+ {
VOID(pthread_mutex_lock(&hostname_cache->lock));
host_entry *entry;
- if (!(entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if (!(entry= (host_entry*) hostname_cache->search((gptr) &in->s_addr, 0)))
{
- uint length=name ? (uint) strlen(name) : 0;
-
- if ((entry=(host_entry*) malloc(sizeof(host_entry)+length+1)))
+ if ((entry= (host_entry*) my_malloc(sizeof(host_entry),
+ MYF(MY_WME|MY_ZEROFILL))))
{
- char *new_name;
- memcpy_fixed(&entry->ip, &in->s_addr, sizeof(in->s_addr));
- if (length)
- memcpy(new_name= (char *) (entry+1), name, length+1);
- else
- new_name=0;
- entry->hostname=new_name;
- entry->errors=0;
- (void) hostname_cache->add(entry);
- }
- }
- VOID(pthread_mutex_unlock(&hostname_cache->lock));
- }
+ entry->ip = (uint32)in->s_addr;
+ if (name[0] != '\0')
+ entry->hostname= my_strdup(name, MYF(0));
+ (void) hostname_cache->add(entry);
+ }
+ }
+ VOID(pthread_mutex_unlock(&hostname_cache->lock));
+ }
+ DBUG_VOID_RETURN;
}
-
-inline void add_wrong_ip(struct in_addr *in)
+/*
+ Add a denied IP address to the hostname cache, so it can be quickly
+ denied in the future.
+
+ SYNOPSIS
+ hostname_cache_add_deny()
+ in pointer to struct in_addr with IP address
+*/
+inline void hostname_cache_add_deny(struct in_addr *in)
{
- add_hostname(in,NullS);
+ DBUG_ENTER("hostname_cache_add_deny");
+ hostname_cache_add(in, NullS);
+ DBUG_VOID_RETURN;
}
-void inc_host_errors(struct in_addr *in)
+/*
+ Increment the error count for an IP address.
+
+ SYNOPSIS
+ hostname_cache_inc_errors()
+ in pointer to struct in_addr with IP address
+*/
+void hostname_cache_inc_errors(struct in_addr *in)
{
+ DBUG_ENTER("hostname_cache_inc_errors");
+
VOID(pthread_mutex_lock(&hostname_cache->lock));
host_entry *entry;
- if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr, 0)))
entry->errors++;
VOID(pthread_mutex_unlock(&hostname_cache->lock));
+
+ DBUG_VOID_RETURN;
}
-void reset_host_errors(struct in_addr *in)
+/*
+ Reset the error count for an IP address.
+
+ SYNOPSIS
+ hostname_cache_reset_errors()
+ in pointer to struct in_addr with IP address
+*/
+void hostname_cache_reset_errors(struct in_addr *in)
{
+ DBUG_ENTER("hostname_cache_reset_errors");
+
VOID(pthread_mutex_lock(&hostname_cache->lock));
host_entry *entry;
- if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr, 0)))
entry->errors=0;
VOID(pthread_mutex_unlock(&hostname_cache->lock));
+
+ DBUG_VOID_RETURN;
}
+
/* Deal with systems that don't defined INADDR_LOOPBACK */
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001UL
#endif
+/*
+ Double reverse resolve an IP address and return the hostname and
+ a count of errors seen from this IP address. Cache successes
+ and failures using hostname_cache API.
+
+ SYNOPSIS
+ ip_to_hostname()
+ in struct in_addr with IP address to resolve
+ errors pointer to uint to fill in with count of errors
+
+ NOTES
+ - This is called before accepting a connection, so that MySQL
+ has access to the hostname for checking GRANTs.
+ - The results are kept in a cache (hostname_cache) for future
+ lookups.
+
+ RETURN
+ 0 The IP address couldn't be resolved or verified, and a connection
+ shouldn't be accepted from this IP address.
+ * The hostname corresponding to the IP address is returned.
+
+*/
+
my_string ip_to_hostname(struct in_addr *in, uint *errors)
{
- uint i;
- host_entry *entry;
+ char *name;
DBUG_ENTER("ip_to_hostname");
*errors=0;
- /* We always treat the loopback address as "localhost". */
+ /*
+ We always treat the loopback address as "localhost".
+ */
if (in->s_addr == htonl(INADDR_LOOPBACK)) // is expanded inline by gcc
DBUG_RETURN((char *)my_localhost);
- /* Check first if we have name in cache */
+ /*
+ Check the hostname cache for this IP address first.
+ */
if (!(specialflag & SPECIAL_NO_HOST_CACHE))
{
+ host_entry *entry;
VOID(pthread_mutex_lock(&hostname_cache->lock));
- if ((entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
+ if ((entry= (host_entry *) hostname_cache->search((gptr) &in->s_addr, 0)))
{
- char *name;
if (!entry->hostname)
- name=0; // Don't allow connection
+ name=0; // Don't allow connection
else
- name=my_strdup(entry->hostname,MYF(0));
+ name=my_strdup(entry->hostname,MYF(0));
*errors= entry->errors;
VOID(pthread_mutex_unlock(&hostname_cache->lock));
DBUG_RETURN(name);
@@ -164,111 +273,113 @@
VOID(pthread_mutex_unlock(&hostname_cache->lock));
}
- struct hostent *hp, *check;
- char *name;
- LINT_INIT(check);
-#if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
- char buff[GETHOSTBYADDR_BUFF_SIZE],buff2[GETHOSTBYNAME_BUFF_SIZE];
+ /*
+ The IP didn't exist in the hostname cache, we need to resolve it.
+ */
+
+ struct hostent *reverse, *forward;
+ struct hostent he_reverse, he_forward;
+ char buf_reverse[GETHOSTBYADDR_BUFF_SIZE];
+ char buf_forward[GETHOSTBYNAME_BUFF_SIZE];
int tmp_errno;
- struct hostent tmp_hostent, tmp_hostent2;
-#ifdef HAVE_purify
- bzero(buff,sizeof(buff)); // Bug in purify
-#endif
- if (!(hp=gethostbyaddr_r((char*) in,sizeof(*in),
- AF_INET,
- &tmp_hostent,buff,sizeof(buff),&tmp_errno)))
- {
- DBUG_PRINT("error",("gethostbyaddr_r returned %d",tmp_errno));
+
+ /*
+ Reverse resolve the IP address.
+ */
+ if (!(reverse= my_gethostbyaddr_r((char*) in, sizeof(*in),
+ AF_INET, &he_reverse,
+ buf_reverse, sizeof(buf_reverse),
+ &tmp_errno)))
+ {
+ DBUG_PRINT("error", ("In reverse lookup: my_gethostbyaddr_r returned %d",
+ tmp_errno));
+ my_gethostbyaddr_r_free();
return 0;
}
- if (!(check=my_gethostbyname_r(hp->h_name,&tmp_hostent2,buff2,sizeof(buff2),
- &tmp_errno)))
+
+ /*
+ Check that we got some hostname back, fail if we got an empty one.
+ */
+ if (!reverse->h_name[0])
+ {
+ DBUG_PRINT("error", ("Got an empty hostname from reverse lookup"));
+ hostname_cache_add_deny(in);
+ my_gethostbyaddr_r_free();
+ DBUG_RETURN(0); // Don't allow empty hostnames
+ }
+
+ /*
+ Copy the hostname we got back, so that we can call my_gethostbyaddr_r_free.
+ */
+ if (!(name= my_strdup(reverse->h_name, MYF(0))))
+ {
+ my_gethostbyaddr_r_free();
+ DBUG_RETURN(0); // out of memory
+ }
+ my_gethostbyaddr_r_free();
+
+ /*
+ Forward resolve the hostname we got from the above reverse resolve.
+ */
+ if (!(forward= my_gethostbyname_r(reverse->h_name, &he_forward,
+ buf_forward, sizeof(buf_forward),
+ &tmp_errno)))
{
- DBUG_PRINT("error",("gethostbyname_r returned %d",tmp_errno));
+ DBUG_PRINT("error", ("In forward lookup: my_gethostbyname_r returned %d",
+ tmp_errno));
/*
- Don't cache responses when the DSN server is down, as otherwise
+ Don't cache responses when the DNS server is down, as otherwise
transient DNS failure may leave any number of clients (those
that attempted to connect during the outage) unable to connect
indefinitely.
*/
if (tmp_errno == HOST_NOT_FOUND || tmp_errno == NO_DATA)
- add_wrong_ip(in);
- my_gethostbyname_r_free();
- DBUG_RETURN(0);
- }
- if (!hp->h_name[0])
- {
- DBUG_PRINT("error",("Got an empty hostname"));
- add_wrong_ip(in);
+ hostname_cache_add_deny(in);
+ my_free(name, MYF(0));
my_gethostbyname_r_free();
- DBUG_RETURN(0); // Don't allow empty hostnames
- }
- if (!(name=my_strdup(hp->h_name,MYF(0))))
- {
- my_gethostbyname_r_free();
- DBUG_RETURN(0); // out of memory
- }
- my_gethostbyname_r_free();
-#else
- VOID(pthread_mutex_lock(&LOCK_hostname));
- if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
- {
- VOID(pthread_mutex_unlock(&LOCK_hostname));
- DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
-
- if (errno == HOST_NOT_FOUND || errno == NO_DATA)
- goto add_wrong_ip_and_return;
- /* Failure, don't cache responce */
- DBUG_RETURN(0);
- }
- if (!hp->h_name[0]) // Don't allow empty hostnames
- {
- VOID(pthread_mutex_unlock(&LOCK_hostname));
- DBUG_PRINT("error",("Got an empty hostname"));
- goto add_wrong_ip_and_return;
- }
- if (!(name=my_strdup(hp->h_name,MYF(0))))
- {
- VOID(pthread_mutex_unlock(&LOCK_hostname));
- DBUG_RETURN(0); // out of memory
- }
- check=gethostbyname(name);
- VOID(pthread_mutex_unlock(&LOCK_hostname));
- if (!check)
- {
- DBUG_PRINT("error",("gethostbyname returned %d",errno));
- my_free(name,MYF(0));
DBUG_RETURN(0);
}
-#endif
- /* Don't accept hostnames that starts with digits because they may be
- false ip:s */
- if (my_isdigit(&my_charset_latin1,name[0]))
+ /*
+ Don't accept hostnames that start with digits because they may be
+ false IP addresses.
+ */
+ if (my_isdigit(&my_charset_latin1, name[0]))
{
char *pos;
- for (pos= name+1 ; my_isdigit(&my_charset_latin1,*pos); pos++) ;
+ for (pos= name+1 ; my_isdigit(&my_charset_latin1, *pos); pos++) ;
if (*pos == '.')
{
- DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'"));
- my_free(name,MYF(0));
- goto add_wrong_ip_and_return;
+ DBUG_PRINT("error", ("mysqld doesn't accept hostnames that starts with a number followed by a '.'"));
+ goto cache_failure_and_return;
}
}
- /* Check that 'gethostbyname' returned the used ip */
- for (i=0; check->h_addr_list[i]; i++)
+ /*
+ Check that the IP is contained in the list of returned IPs from
+ the forward resolve above. If so, cache it so that we don't have
+ to resolve it again in the future. If not, the connection will be
+ denied after finishing this loop.
+ */
+ for (uint i=0; forward->h_addr_list[i]; i++)
{
- if (*(uint32*)(check->h_addr_list)[i] == in->s_addr)
+ if (*(uint32*)(forward->h_addr_list)[i] == in->s_addr)
{
- add_hostname(in,name);
+ hostname_cache_add(in, name);
+ my_gethostbyname_r_free();
DBUG_RETURN(name);
}
}
- DBUG_PRINT("error",("Couldn't verify hostname with gethostbyname"));
- my_free(name,MYF(0));
-
-add_wrong_ip_and_return:
- add_wrong_ip(in);
+
+ /*
+ Something about this IP address is wrong, and the connection will
+ be denied. In addition, we'll cache this result, so that we can
+ deny future connections from the same IP address much faster.
+ */
+ cache_failure_and_return:
+ DBUG_PRINT("error", ("Double reverse DNS lookup failed for IP, connection will be denied."));
+ my_gethostbyname_r_free();
+ my_free(name, MYF(0));
+ hostname_cache_add_deny(in);
DBUG_RETURN(0);
}
diff -Nur -x bdb mysql-5.0.25-nightly-20060823.host_cache01/sql/mysql_priv.h mysql-5.0.25-nightly-20060823.host_cache02/sql/mysql_priv.h
--- mysql-5.0.25-nightly-20060823.host_cache01/sql/mysql_priv.h 2006-09-25 20:30:47.000000000 -0700
+++ mysql-5.0.25-nightly-20060823.host_cache02/sql/mysql_priv.h 2006-09-25 20:32:03.000000000 -0700
@@ -1476,8 +1476,8 @@
/* from hostname.cc */
struct in_addr;
my_string ip_to_hostname(struct in_addr *in,uint *errors);
-void inc_host_errors(struct in_addr *in);
-void reset_host_errors(struct in_addr *in);
+void hostname_cache_inc_errors(struct in_addr *in);
+void hostname_cache_reset_errors(struct in_addr *in);
bool hostname_cache_init();
void hostname_cache_free();
void hostname_cache_refresh(void);
diff -Nur -x bdb mysql-5.0.25-nightly-20060823.host_cache01/sql/sql_parse.cc mysql-5.0.25-nightly-20060823.host_cache02/sql/sql_parse.cc
--- mysql-5.0.25-nightly-20060823.host_cache01/sql/sql_parse.cc 2006-09-25 20:30:47.000000000 -0700
+++ mysql-5.0.25-nightly-20060823.host_cache02/sql/sql_parse.cc 2006-09-25 20:54:29.000000000 -0700
@@ -366,7 +366,7 @@
if (send_old_password_request(thd) ||
my_net_read(net) != SCRAMBLE_LENGTH_323 + 1)
{
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
DBUG_RETURN(ER_HANDSHAKE_ERROR);
}
/* Final attempt to check the user based on reply */
@@ -925,7 +925,7 @@
(pkt_len= my_net_read(net)) == packet_error ||
pkt_len < MIN_HANDSHAKE_SIZE)
{
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
return(ER_HANDSHAKE_ERROR);
}
}
@@ -933,7 +933,7 @@
#include "_cust_sql_parse.h"
#endif
if (connect_errors)
- reset_host_errors(&thd->remote.sin_addr);
+ hostname_cache_reset_errors(&thd->remote.sin_addr);
if (thd->packet.alloc(thd->variables.net_buffer_length))
return(ER_OUT_OF_RESOURCES);
@@ -962,14 +962,14 @@
/* Do the SSL layering. */
if (!ssl_acceptor_fd)
{
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
return(ER_HANDSHAKE_ERROR);
}
DBUG_PRINT("info", ("IO layer change in progress..."));
if (sslaccept(ssl_acceptor_fd, net->vio, thd->variables.net_wait_timeout))
{
DBUG_PRINT("error", ("Failed to accept new SSL connection"));
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
return(ER_HANDSHAKE_ERROR);
}
DBUG_PRINT("info", ("Reading user information over SSL layer"));
@@ -978,7 +978,7 @@
{
DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
pkt_len));
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
return(ER_HANDSHAKE_ERROR);
}
}
@@ -986,7 +986,7 @@
if (end >= (char*) net->read_pos+ pkt_len +2)
{
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
return(ER_HANDSHAKE_ERROR);
}
@@ -1018,7 +1018,7 @@
if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len)
{
- inc_host_errors(&thd->remote.sin_addr);
+ hostname_cache_inc_errors(&thd->remote.sin_addr);
return ER_HANDSHAKE_ERROR;
}