@@ -400,44 +400,37 @@ ClientAuthentication(Port *port)
400400 */
401401{
402402char hostinfo [NI_MAXHOST ];
403+ const char * encryption_state ;
403404
404405pg_getnameinfo_all (& port -> raddr .addr ,port -> raddr .salen ,
405406hostinfo ,sizeof (hostinfo ),
406407NULL ,0 ,
407408NI_NUMERICHOST );
408409
409- if (am_walsender )
410- {
410+ encryption_state =
411+ #ifdef ENABLE_GSS
412+ (port -> gss && port -> gss -> enc ) ?_ ("GSS encryption" ) :
413+ #endif
411414#ifdef USE_SSL
415+ port -> ssl_in_use ?_ ("SSL on" ) :
416+ #endif
417+ _ ("SSL off" );
418+
419+ if (am_walsender )
412420ereport (FATAL ,
413421(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
422+ /* translator: last %s describes encryption state */
414423errmsg ("pg_hba.conf rejects replication connection for host \"%s\", user \"%s\", %s" ,
415424hostinfo ,port -> user_name ,
416- port -> ssl_in_use ?_ ("SSL on" ) :_ ("SSL off" ))));
417- #else
418- ereport (FATAL ,
419- (errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
420- errmsg ("pg_hba.conf rejects replication connection for host \"%s\", user \"%s\"" ,
421- hostinfo ,port -> user_name )));
422- #endif
423- }
425+ encryption_state )));
424426else
425- {
426- #ifdef USE_SSL
427427ereport (FATAL ,
428428(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
429+ /* translator: last %s describes encryption state */
429430errmsg ("pg_hba.conf rejects connection for host \"%s\", user \"%s\", database \"%s\", %s" ,
430431hostinfo ,port -> user_name ,
431432port -> database_name ,
432- port -> ssl_in_use ?_ ("SSL on" ) :_ ("SSL off" ))));
433- #else
434- ereport (FATAL ,
435- (errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
436- errmsg ("pg_hba.conf rejects connection for host \"%s\", user \"%s\", database \"%s\"" ,
437- hostinfo ,port -> user_name ,
438- port -> database_name )));
439- #endif
440- }
433+ encryption_state )));
441434break ;
442435}
443436
@@ -453,12 +446,22 @@ ClientAuthentication(Port *port)
453446 */
454447{
455448char hostinfo [NI_MAXHOST ];
449+ const char * encryption_state ;
456450
457451pg_getnameinfo_all (& port -> raddr .addr ,port -> raddr .salen ,
458452hostinfo ,sizeof (hostinfo ),
459453NULL ,0 ,
460454NI_NUMERICHOST );
461455
456+ encryption_state =
457+ #ifdef ENABLE_GSS
458+ (port -> gss && port -> gss -> enc ) ?_ ("GSS encryption" ) :
459+ #endif
460+ #ifdef USE_SSL
461+ port -> ssl_in_use ?_ ("SSL on" ) :
462+ #endif
463+ _ ("SSL off" );
464+
462465#define HOSTNAME_LOOKUP_DETAIL (port ) \
463466(port->remote_hostname ? \
464467 (port->remote_hostname_resolv == +1 ? \
@@ -481,41 +484,22 @@ ClientAuthentication(Port *port)
4814840))
482485
483486if (am_walsender )
484- {
485- #ifdef USE_SSL
486487ereport (FATAL ,
487488(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
489+ /* translator: last %s describes encryption state */
488490errmsg ("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\", %s" ,
489491hostinfo ,port -> user_name ,
490- port -> ssl_in_use ? _ ( "SSL on" ) : _ ( "SSL off" ) ),
492+ encryption_state ),
491493HOSTNAME_LOOKUP_DETAIL (port )));
492- #else
493- ereport (FATAL ,
494- (errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
495- errmsg ("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\"" ,
496- hostinfo ,port -> user_name ),
497- HOSTNAME_LOOKUP_DETAIL (port )));
498- #endif
499- }
500494else
501- {
502- #ifdef USE_SSL
503495ereport (FATAL ,
504496(errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
497+ /* translator: last %s describes encryption state */
505498errmsg ("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s" ,
506499hostinfo ,port -> user_name ,
507500port -> database_name ,
508- port -> ssl_in_use ?_ ("SSL on" ) :_ ("SSL off" )),
509- HOSTNAME_LOOKUP_DETAIL (port )));
510- #else
511- ereport (FATAL ,
512- (errcode (ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION ),
513- errmsg ("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"" ,
514- hostinfo ,port -> user_name ,
515- port -> database_name ),
501+ encryption_state ),
516502HOSTNAME_LOOKUP_DETAIL (port )));
517- #endif
518- }
519503break ;
520504}
521505