48 #if defined(HAVE_GSSAPI_H)
51 #include <gssapi/gssapi.h>
56 #define SECURITY_WIN32
57 #if defined(WIN32) && !defined(_MSC_VER)
76 #include <openssl/ssl.h>
77 #include <openssl/err.h>
79 #ifndef OPENSSL_NO_ENGINE
80 #define USE_SSL_ENGINE
89 #define CMDSTATUS_LEN 64
136 #define NULL_LEN (-1)
236 #define ENC_PLAINTEXT 0x01
237 #define ENC_GSSAPI 0x02
341 #define AUTH_RESPONSE_GSS 'G'
342 #define AUTH_RESPONSE_PASSWORD 'P'
343 #define AUTH_RESPONSE_SASL_INITIAL 'I'
344 #define AUTH_RESPONSE_SASL 'S'
589 #ifdef USE_SSL_ENGINE
600 gss_name_t gtarg_nam;
607 char *gss_SendBuffer;
611 int gss_SendConsumed;
613 char *gss_RecvBuffer;
615 char *gss_ResultBuffer;
616 int gss_ResultLength;
625 CredHandle *sspicred;
659 #define USER_CERT_FILE ".postgresql/postgresql.crt"
660 #define USER_KEY_FILE ".postgresql/postgresql.key"
661 #define ROOT_CERT_FILE ".postgresql/root.crt"
662 #define ROOT_CRL_FILE ".postgresql/root.crl"
665 #define USER_CERT_FILE "postgresql.crt"
666 #define USER_KEY_FILE "postgresql.key"
667 #define ROOT_CERT_FILE "root.crt"
668 #define ROOT_CRL_FILE "root.crl"
686 #if defined(WIN32) && defined(SIO_KEEPALIVE_VALS)
695 const void *
buf,
size_t buf_len);
703 #define pglock_thread() pg_g_threadlock(true)
704 #define pgunlock_thread() pg_g_threadlock(false)
738 int *result_buf,
int *actual_result_len,
878 #define pqClearConnErrorState(conn) \
879 (resetPQExpBuffer(&(conn)->errorMessage), \
880 (conn)->errorReported = 0)
887 #define pgHavePendingResult(conn) \
888 ((conn)->result != NULL || (conn)->error_result)
894 #define pqIsnonblocking(conn) ((conn)->nonblocking)
899 #define OUTBUFFER_THRESHOLD 65536
905 #define libpq_gettext(x) (x)
906 #define libpq_ngettext(s, p, n) ((n) == 1 ? (s) : (p))
922 #define SOCK_ERRNO (WSAGetLastError())
923 #define SOCK_STRERROR winsock_strerror
924 #define SOCK_ERRNO_SET(e) WSASetLastError(e)
926 #define SOCK_ERRNO errno
927 #define SOCK_STRERROR strerror_r
928 #define SOCK_ERRNO_SET(e) (errno = (e))
#define pg_attribute_format_arg(a)
#define pg_attribute_printf(f, a)
#define FLEXIBLE_ARRAY_MEMBER
static void PGresult * res
ssize_t pg_GSS_read(PGconn *conn, void *ptr, size_t len)
ssize_t pg_GSS_write(PGconn *conn, const void *ptr, size_t len)
PostgresPollingStatusType pqsecure_open_gss(PGconn *conn)
int(* PGEventProc)(PGEventId evtId, void *evtInfo, void *passThrough)
void(* pgthreadlock_t)(int acquire)
void(* PQnoticeReceiver)(void *arg, const PGresult *res)
void(* PQnoticeProcessor)(void *arg, const char *message)
PostgresPollingStatusType
int pqPutc(char c, PGconn *conn)
int pqReadData(PGconn *conn)
void pqDropConnection(PGconn *conn, bool flushInput)
int PQsendQueryContinue(PGconn *conn, const char *query)
int pqPutInt(int value, size_t bytes, PGconn *conn)
void pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, bool got_epipe)
bool pqConnectOptions2(PGconn *conn)
int pqCheckOutBufferSpace(size_t bytes_needed, PGconn *conn)
ssize_t pqsecure_raw_write(PGconn *, const void *ptr, size_t len)
int pqFlush(PGconn *conn)
void pqBuildErrorMessage3(PQExpBuffer msg, const PGresult *res, PGVerbosity verbosity, PGContextVisibility show_context)
void pqParseDone(PGconn *conn, int newInStart)
void pqParseInput3(PGconn *conn)
ssize_t pqsecure_raw_read(PGconn *, void *ptr, size_t len)
int pqReadReady(PGconn *conn)
ssize_t pqsecure_write(PGconn *, const void *ptr, size_t len)
int pqPutMsgStart(char msg_type, PGconn *conn)
int pqSkipnchar(size_t len, PGconn *conn)
int pqEndcopy3(PGconn *conn)
PGresult * pqFunctionCall3(PGconn *conn, Oid fnid, int *result_buf, int *actual_result_len, int result_is_int, const PQArgBlock *args, int nargs)
void pqClosePGconn(PGconn *conn)
bool pqGetHomeDirectory(char *buf, int bufsize)
void libpq_append_error(PQExpBuffer errorMessage, const char *fmt,...) pg_attribute_printf(2
int pgtls_verify_peer_name_matches_certificate_guts(PGconn *conn, int *names_examined, char **first_name)
int pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending)
void pqCommandQueueAdvance(PGconn *conn, bool isReadyForQuery, bool gotSync)
void pqSetResultError(PGresult *res, PQExpBuffer errorMessage, int offset)
struct pg_conn_host pg_conn_host
void pqSaveErrorResult(PGconn *conn)
char *const pgresStatus[]
PostgresPollingStatusType pgtls_open_client(PGconn *conn)
bool pgtls_read_pending(PGconn *conn)
char * pqResultStrdup(PGresult *res, const char *str)
int pqGetlineAsync3(PGconn *conn, char *buffer, int bufsize)
int pqGetCopyData3(PGconn *conn, char **buffer, int async)
int pqRowProcessor(PGconn *conn, const char **errmsgp)
struct pgresParamDesc PGresParamDesc
int pqGetc(char *result, PGconn *conn)
struct PGcmdQueueEntry PGcmdQueueEntry
int pqGetNegotiateProtocolVersion3(PGconn *conn)
int pqGetInt(int *result, size_t bytes, PGconn *conn)
bool pqParseIntParam(const char *value, int *result, PGconn *conn, const char *context)
int pqGetnchar(char *s, size_t len, PGconn *conn)
ssize_t pgtls_read(PGconn *conn, void *ptr, size_t len)
void pqsecure_close(PGconn *)
void void libpq_append_conn_error(PGconn *conn, const char *fmt,...) pg_attribute_printf(2
void void pqSaveMessageField(PGresult *res, char code, const char *value)
ssize_t pgtls_write(PGconn *conn, const void *ptr, size_t len)
int pqWait(int forRead, int forWrite, PGconn *conn)
PostgresPollingStatusType pqsecure_open_client(PGconn *)
struct pgParameterStatus pgParameterStatus
void pqReleaseConnHosts(PGconn *conn)
pgthreadlock_t pg_g_threadlock
int pqGets(PQExpBuffer buf, PGconn *conn)
struct pgMessageField PGMessageField
void pqSaveParameterStatus(PGconn *conn, const char *name, const char *value)
PGconn * pqMakeEmptyPGconn(void)
void pqClearAsyncResult(PGconn *conn)
void pqTraceOutputMessage(PGconn *conn, const char *message, bool toServer)
int pqCheckInBufferSpace(size_t bytes_needed, PGconn *conn)
int pqPutnchar(const char *s, size_t len, PGconn *conn)
struct pgDataValue PGdataValue
int pqConnectDBStart(PGconn *conn)
void pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) pg_attribute_printf(2
#define libpq_ngettext(s, p, n)
void * pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary)
bool pqCopyPGconn(PGconn *srcConn, PGconn *dstConn)
int pqPuts(const char *s, PGconn *conn)
ssize_t pqsecure_read(PGconn *, void *ptr, size_t len)
struct PQEnvironmentOption PQEnvironmentOption
char * pgtls_get_peer_certificate_hash(PGconn *conn, size_t *len)
@ SERVER_TYPE_PREFER_STANDBY_PASS2
@ SERVER_TYPE_PREFER_STANDBY
int pqGetline3(PGconn *conn, char *s, int maxlen)
int pqWaitTimed(int forRead, int forWrite, PGconn *conn, pg_usec_time_t end_time)
int pqGetErrorNotice3(PGconn *conn, bool isError)
void pgtls_close(PGconn *conn)
char * pqBuildStartupPacket3(PGconn *conn, int *packetlen, const PQEnvironmentOption *options)
struct pgLobjfuncs PGlobjfuncs
void pqTraceOutputNoTypeByteMessage(PGconn *conn, const char *message)
void pqTraceOutputCharResponse(PGconn *conn, const char *responseType, char response)
int pqGets_append(PQExpBuffer buf, PGconn *conn)
PGresult * pqPrepareAsyncResult(PGconn *conn)
int pqWriteReady(PGconn *conn)
int pqPutMsgEnd(PGconn *conn)
int pqConnectDBComplete(PGconn *conn)
struct pgresAttValue PGresAttValue
int pqPacketSend(PGconn *conn, char pack_type, const void *buf, size_t buf_len)
static void const char * fmt
PQnoticeReceiver noticeRec
PQnoticeProcessor noticeProc
struct PGcmdQueueEntry * next
struct pgMessageField * next
char contents[FLEXIBLE_ARRAY_MEMBER]
struct pgParameterStatus * next
char current_auth_response
PGTransactionStatusType xactStatus
const pg_fe_sasl_mech * sasl
char * ssl_max_protocol_version
PGTernaryBool in_hot_standby
bool client_finished_auth
PGcmdQueueEntry * cmd_queue_recycle
uint32 allowed_auth_methods
char * target_session_attrs
PGcmdQueueEntry * cmd_queue_tail
PQExpBufferData workBuffer
char * load_balance_hosts
PGTernaryBool default_transaction_read_only
pgParameterStatus * pstatus
char * client_encoding_initial
char * keepalives_interval
char * pgtcp_user_timeout
char * ssl_min_protocol_version
PQExpBufferData errorMessage
PGAsyncStatusType asyncStatus
PGLoadBalanceType load_balance_type
int scram_sha_256_iterations
PGpipelineStatus pipelineStatus
uint8 allowed_enc_methods
PGNoticeHooks noticeHooks
PGTargetServerType target_server_type
PGcmdQueueEntry * cmd_queue_head
bool ssl_handshake_started
PGContextVisibility show_context
PGNoticeHooks noticeHooks
char cmdStatus[CMDSTATUS_LEN]
PGMessageField * errFields
PGresParamDesc * paramDescs
ExecStatusType resultStatus