forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfc75250
committed
Fix assorted issues in client host name lookup.
The code for matching clients to pg_hba.conf lines that specify host names(instead of IP address ranges) failed to complain if reverse DNS lookupfailed; instead it silently didn't match, so that you might end up gettinga surprising "no pg_hba.conf entry for ..." error, as seen in bug #9518from Mike Blackwell. Since we don't want to make this a fatal error insituations where pg_hba.conf contains a mixture of host names and IPaddresses (clients matching one of the numeric entries should not have tohave rDNS data), remember the lookup failure and mention it as DETAIL ifwe get to "no pg_hba.conf entry". Apply the same approach to forward-DNSlookup failures, too, rather than treating them as immediate hard errors.Along the way, fix a couple of bugs that prevented us from detecting anrDNS lookup error reliably, and make sure that we make only one rDNS lookupattempt; formerly, if the lookup attempt failed, the code would try againfor each host name entry in pg_hba.conf. Since more or less the wholepoint of this design is to ensure there's only one lookup attempt not oneper entry, the latter point represents a performance bug that seemssufficient justification for back-patching.Also, adjust src/port/getaddrinfo.c so that it plays as well as it canwith this code. Which is not all that well, since it does not have actualsupport for rDNS lookup, but at least it should return the expected (andrequired by spec) error codes so that the main code correctly perceives thelack of functionality as a lookup failure. It's unlikely that PG is stillbeing used in production on any machines that require our getaddrinfo.c,so I'm not excited about working harder than this.To keep the code in the various branches similar, this includesback-patching commitsc424d0d and1997f34 into 9.2 and earlier.Back-patch to 9.1 where the facility for hostnames in pg_hba.conf wasintroduced.1 parentf33a71a commitfc75250
File tree
6 files changed
+86
-32
lines changed- src
- backend
- libpq
- postmaster
- include
- libpq
- port
6 files changed
+86
-32
lines changedLines changed: 19 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
425 | 425 |
| |
426 | 426 |
| |
427 | 427 |
| |
428 |
| - | |
429 |
| - | |
430 |
| - | |
431 |
| - | |
432 |
| - | |
433 |
| - | |
434 |
| - | |
435 |
| - | |
436 |
| - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
437 | 447 |
| |
438 | 448 |
| |
439 | 449 |
| |
|
Lines changed: 23 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
592 | 592 |
| |
593 | 593 |
| |
594 | 594 |
| |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
595 | 599 |
| |
596 | 600 |
| |
597 | 601 |
| |
598 | 602 |
| |
599 | 603 |
| |
600 |
| - | |
601 |
| - | |
602 |
| - | |
603 |
| - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
604 | 613 |
| |
| 614 | + | |
605 | 615 |
| |
606 | 616 |
| |
607 | 617 |
| |
608 | 618 |
| |
| 619 | + | |
609 | 620 |
| |
610 | 621 |
| |
611 | 622 |
| |
612 |
| - | |
613 |
| - | |
| 623 | + | |
614 | 624 |
| |
615 | 625 |
| |
616 |
| - | |
617 |
| - | |
618 | 626 |
| |
| 627 | + | |
619 | 628 |
| |
620 | 629 |
| |
621 |
| - | |
622 |
| - | |
623 |
| - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
624 | 636 |
| |
625 | 637 |
| |
626 | 638 |
| |
|
Lines changed: 17 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3952 | 3952 |
| |
3953 | 3953 |
| |
3954 | 3954 |
| |
3955 |
| - | |
3956 |
| - | |
| 3955 | + | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
| 3961 | + | |
| 3962 | + | |
| 3963 | + | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
3957 | 3972 |
| |
3958 | 3973 |
| |
3959 | 3974 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| 85 | + | |
| 86 | + | |
| 87 | + | |
85 | 88 |
| |
86 | 89 |
| |
87 | 90 |
| |
|
Lines changed: 16 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
107 | 121 |
| |
108 | 122 |
| |
109 | 123 |
| |
| |||
116 | 130 |
| |
117 | 131 |
| |
118 | 132 |
| |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
| 133 | + | |
| 134 | + | |
125 | 135 |
| |
126 | 136 |
| |
127 | 137 |
| |
|
Lines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
181 | 181 |
| |
182 | 182 |
| |
183 | 183 |
| |
184 |
| - | |
| 184 | + | |
185 | 185 |
| |
186 | 186 |
| |
187 | 187 |
| |
| |||
347 | 347 |
| |
348 | 348 |
| |
349 | 349 |
| |
350 |
| - | |
351 |
| - | |
| 350 | + | |
| 351 | + | |
352 | 352 |
| |
353 | 353 |
| |
354 | 354 |
| |
| |||
375 | 375 |
| |
376 | 376 |
| |
377 | 377 |
| |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
378 | 382 |
| |
379 | 383 |
| |
380 | 384 |
| |
| |||
397 | 401 |
| |
398 | 402 |
| |
399 | 403 |
| |
400 |
| - | |
| 404 | + | |
401 | 405 |
| |
402 | 406 |
| |
403 | 407 |
| |
|
0 commit comments
Comments
(0)