@@ -443,19 +443,32 @@ ClientAuthentication(Port *port)
443
443
NULL ,0 ,
444
444
NI_NUMERICHOST );
445
445
446
+ #define HOSTNAME_LOOKUP_DETAIL (port ) \
447
+ (port->remote_hostname \
448
+ ? (port->remote_hostname_resolv == +1\
449
+ ? errdetail_log("Client IP address resolved to \"%s\", forward lookup matches.", port->remote_hostname) \
450
+ : (port->remote_hostname_resolv == 0\
451
+ ? errdetail_log("Client IP address resolved to \"%s\", forward lookup not checked.", port->remote_hostname) \
452
+ : (port->remote_hostname_resolv == -1\
453
+ ? errdetail_log("Client IP address resolved to \"%s\", forward lookup does not match.", port->remote_hostname) \
454
+ : 0)))\
455
+ : 0)
456
+
446
457
if (am_walsender )
447
458
{
448
459
#ifdef USE_SSL
449
460
ereport (FATAL ,
450
461
(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
451
462
errmsg ("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\", %s" ,
452
463
hostinfo ,port -> user_name ,
453
- port -> ssl ?_ ("SSL on" ) :_ ("SSL off" ))));
464
+ port -> ssl ?_ ("SSL on" ) :_ ("SSL off" )),
465
+ HOSTNAME_LOOKUP_DETAIL (port )));
454
466
#else
455
467
ereport (FATAL ,
456
468
(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
457
469
errmsg ("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\"" ,
458
- hostinfo ,port -> user_name )));
470
+ hostinfo ,port -> user_name ),
471
+ HOSTNAME_LOOKUP_DETAIL (port )));
459
472
#endif
460
473
}
461
474
else
@@ -466,13 +479,15 @@ ClientAuthentication(Port *port)
466
479
errmsg ("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s" ,
467
480
hostinfo ,port -> user_name ,
468
481
port -> database_name ,
469
- port -> ssl ?_ ("SSL on" ) :_ ("SSL off" ))));
482
+ port -> ssl ?_ ("SSL on" ) :_ ("SSL off" )),
483
+ HOSTNAME_LOOKUP_DETAIL (port )));
470
484
#else
471
485
ereport (FATAL ,
472
486
(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
473
487
errmsg ("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"" ,
474
488
hostinfo ,port -> user_name ,
475
- port -> database_name )));
489
+ port -> database_name ),
490
+ HOSTNAME_LOOKUP_DETAIL (port )));
476
491
#endif
477
492
}
478
493
break ;