diff options
Diffstat (limited to 'src/include/libpq/libpq-be.h')
-rw-r--r-- | src/include/libpq/libpq-be.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index 4d92c18974b..95b538c64db 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -99,6 +99,20 @@ typedef struct * still available when a backend is running (see MyProcPort). The data * it points to must also be malloc'd, or else palloc'd in TopMemoryContext, * so that it survives into PostgresMain execution! + * + * remote_hostname is set if we did a successful reverse lookup of the + * client's IP address during connection setup. + * remote_hostname_resolv tracks the state of hostname verification: + * +1 = remote_hostname is known to resolve to client's IP address + * -1 = remote_hostname is known NOT to resolve to client's IP address + * 0 = we have not done the forward DNS lookup yet + * -2 = there was an error in name resolution + * If reverse lookup of the client IP address fails, remote_hostname will be + * left NULL while remote_hostname_resolv is set to -2. If reverse lookup + * succeeds but forward lookup fails, remote_hostname_resolv is also set to -2 + * (the case is distinguishable because remote_hostname isn't NULL). In + * either of the -2 cases, remote_hostname_errcode saves the lookup return + * code for possible later use with gai_strerror. */ typedef struct Port @@ -111,12 +125,7 @@ typedef struct Port char *remote_host; /* name (or ip addr) of remote host */ char *remote_hostname;/* name (not ip addr) of remote host, if * available */ - int remote_hostname_resolv; /* +1 = remote_hostname is known to - * resolve to client's IP address; -1 - * = remote_hostname is known NOT to - * resolve to client's IP address; 0 = - * we have not done the forward DNS - * lookup yet */ + int remote_hostname_resolv; /* see above */ char *remote_port; /* text rep of remote port */ CAC_state canAcceptConnections; /* postmaster connection status */ @@ -178,6 +187,9 @@ typedef struct Port char *peer_cn; unsigned long count; #endif + + /* This field will be in a saner place in 9.4 and up */ + int remote_hostname_errcode; /* see above */ } Port; |