|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <signal.h>#include <fcntl.h>#include <ctype.h>#include "libpq-fe.h"#include "fe-auth.h"#include "fe-secure-common.h"#include "libpq-int.h"#include <sys/socket.h>#include <unistd.h>#include <netdb.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <arpa/inet.h>#include <sys/stat.h>#include <pthread.h>#include "common/openssl.h"#include <openssl/ssl.h>#include <openssl/conf.h>#include <openssl/x509v3.h>
Go to the source code of this file.
Macros | |
| #define | SSL_ERR_LEN 128 |
| #define SSL_ERR_LEN 128 |
Definition at line 1551 of file fe-secure-openssl.c.
Definition at line 739 of file fe-secure-openssl.c.
References alpn_protos, buf, conn, pg_conn::connhost, err(), fb(), fprintf, free, pg_conn_host::host, libpq_append_conn_error(), libpq_gettext, MAXPGPATH, PG_STRERROR_R_BUFLEN, pqGetHomeDirectory(), PQssl_passwd_cb(), PQsslKeyPassHook, S_IRWXG, S_IRWXO, S_ISREG, S_IWGRP, S_IXGRP, snprintf, SSL_context, pg_conn::ssl_in_use, pg_conn::ssl_max_protocol_version, pg_conn::ssl_min_protocol_version, ssl_protocol_version_to_openssl(), ssl_set_pgconn_bio(), pg_conn::sslcert, pg_conn::sslcertmode, pg_conn::sslcompression, pg_conn::sslcrl, pg_conn::sslcrldir, SSLerrfree(), SSLerrmessage(), pg_conn::sslkey, pg_conn::sslkeylogfile, pg_conn::sslmode, pg_conn::sslpassword, pg_conn::sslrootcert, pg_conn::sslsni, stat, strerror_r, strlcpy(), verify_cb(), and pg_conn::whichhost.
Referenced by pgtls_open_client().
Definition at line 524 of file fe-secure-openssl.c.
References fb(), and inet_aton().
Referenced by pgtls_verify_peer_name_matches_certificate_guts().
|
static |
Definition at line 1338 of file fe-secure-openssl.c.
References conn, pg_conn::current_enc_method, ENC_SSL, err(), fb(), len, libpq_append_conn_error(), PG_ALPN_PROTOCOL, PG_STRERROR_R_BUFLEN, PGRES_POLLING_FAILED, PGRES_POLLING_OK, PGRES_POLLING_READING, PGRES_POLLING_WRITING, pgtls_close(), pq_verify_peer_name_matches_certificate(), SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, pg_conn::ssl_max_protocol_version, pg_conn::ssl_min_protocol_version, SSLerrfree(), SSLerrmessage(), pg_conn::sslnegotiation, and pg_conn::sslrootcert.
Referenced by pgtls_open_client().
|
static |
Definition at line 499 of file fe-secure-openssl.c.
References conn, fb(), len, libpq_append_conn_error(), and pq_verify_peer_name_matches_certificate_ip().
Referenced by pgtls_verify_peer_name_matches_certificate_guts().
|
static |
Definition at line 470 of file fe-secure-openssl.c.
References conn, fb(), len, libpq_append_conn_error(), and pq_verify_peer_name_matches_certificate_name().
Referenced by pgtls_verify_peer_name_matches_certificate_guts().
Definition at line 1803 of file fe-secure-openssl.c.
References conn, fb(), and pg_conn::last_read_was_eof.
Referenced by pgconn_bio_method().
|
static |
Definition at line 1833 of file fe-secure-openssl.c.
References err(), fb(), pgconn_bio_ctrl(), pgconn_bio_method_ptr, pgconn_bio_read(), pgconn_bio_write(), pthread_mutex_lock(), pthread_mutex_unlock(), and ssl_config_mutex.
Referenced by ssl_set_pgconn_bio().
Definition at line 1738 of file fe-secure-openssl.c.
References buf, conn, EAGAIN, EINTR, EWOULDBLOCK, fb(), pg_conn::last_read_was_eof, pqsecure_raw_read(), SOCK_ERRNO, and pg_conn::ssl_handshake_started.
Referenced by pgconn_bio_method().
Definition at line 1773 of file fe-secure-openssl.c.
References buf, EAGAIN, EINTR, EWOULDBLOCK, fb(), pqsecure_raw_write(), and SOCK_ERRNO.
Referenced by pgconn_bio_method().
Definition at line 1502 of file fe-secure-openssl.c.
References conn, fb(), pg_conn::ssl_handshake_started, and pg_conn::ssl_in_use.
Referenced by open_client_SSL(), pgtls_open_client(), and pqsecure_close().
Definition at line 340 of file fe-secure-openssl.c.
References conn, fb(), hash(), len, libpq_append_conn_error(), and malloc.
Referenced by build_client_final_message().
| PostgresPollingStatusType pgtls_open_client | ( | PGconn * | conn | ) |
Definition at line 96 of file fe-secure-openssl.c.
References conn, fb(), initialize_SSL(), open_client_SSL(), PGRES_POLLING_FAILED, and pgtls_close().
Referenced by pqsecure_open_client().
Definition at line 118 of file fe-secure-openssl.c.
References appendPQExpBufferStr(), conn, ECONNRESET, err(), pg_conn::errorMessage, fb(), len, libpq_append_conn_error(), PG_STRERROR_R_BUFLEN, SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, SSLerrfree(), and SSLerrmessage().
Referenced by pqsecure_read().
Definition at line 234 of file fe-secure-openssl.c.
Referenced by pqSocketCheck().
| int pgtls_verify_peer_name_matches_certificate_guts | ( | PGconn * | conn, |
| int * | names_examined, | ||
| char ** | first_name | ||
| ) |
Definition at line 544 of file fe-secure-openssl.c.
References Assert, conn, pg_conn::connhost, fb(), free, pg_conn_host::host, i, is_ip_address(), name, openssl_verify_peer_name_matches_certificate_ip(), openssl_verify_peer_name_matches_certificate_name(), and pg_conn::whichhost.
Referenced by pq_verify_peer_name_matches_certificate().
Definition at line 240 of file fe-secure-openssl.c.
References appendPQExpBufferStr(), conn, ECONNRESET, err(), pg_conn::errorMessage, fb(), len, libpq_append_conn_error(), PG_STRERROR_R_BUFLEN, SOCK_ERRNO, SOCK_ERRNO_SET, SOCK_STRERROR, SSLerrfree(), and SSLerrmessage().
Referenced by pqsecure_write().
Definition at line 1904 of file fe-secure-openssl.c.
References buf, conn, fb(), fprintf, libpq_gettext, and pg_conn::sslpassword.
Referenced by PQssl_passwd_cb().
| PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL | ( | void | ) |
Definition at line 1922 of file fe-secure-openssl.c.
References PQsslKeyPassHook.
| void PQsetSSLKeyPassHook_OpenSSL | ( | PQsslKeyPassHook_OpenSSL_type | hook | ) |
Definition at line 1928 of file fe-secure-openssl.c.
References PQsslKeyPassHook.
Definition at line 1939 of file fe-secure-openssl.c.
References buf, conn, fb(), PQdefaultSSLKeyPassHook_OpenSSL(), and PQsslKeyPassHook.
Referenced by initialize_SSL().
Definition at line 1671 of file fe-secure-openssl.c.
References conn, data, fb(), len, and snprintf.
Referenced by exec_command_conninfo(), print_ssl_library(), and printSSLInfo().
Definition at line 1644 of file fe-secure-openssl.c.
Definition at line 1634 of file fe-secure-openssl.c.
Definition at line 1960 of file fe-secure-openssl.c.
References fb(), and pg_strcasecmp().
Referenced by initialize_SSL().
Definition at line 1878 of file fe-secure-openssl.c.
References conn, fb(), and pgconn_bio_method().
Referenced by initialize_SSL().
Definition at line 1612 of file fe-secure-openssl.c.
References buf, free, and ssl_nomem.
Referenced by initialize_SSL(), open_client_SSL(), pgtls_read(), and pgtls_write().
Definition at line 1554 of file fe-secure-openssl.c.
References fb(), libpq_gettext, malloc, snprintf, SSL_ERR_LEN, ssl_nomem, strerror_r, and strlcpy().
Referenced by initialize_SSL(), open_client_SSL(), pgtls_read(), and pgtls_write().
|
static |
Definition at line 430 of file fe-secure-openssl.c.
References fb().
Referenced by initialize_SSL().
|
static |
Definition at line 686 of file fe-secure-openssl.c.
Referenced by initialize_SSL().
|
static |
Definition at line 1735 of file fe-secure-openssl.c.
Referenced by pgconn_bio_method().
|
static |
Definition at line 88 of file fe-secure-openssl.c.
Referenced by initialize_SSL(), PQgetSSLKeyPassHook_OpenSSL(), PQsetSSLKeyPassHook_OpenSSL(), and PQssl_passwd_cb().
|
static |
Definition at line 86 of file fe-secure-openssl.c.
Referenced by pgconn_bio_method().
|
static |
Definition at line 1549 of file fe-secure-openssl.c.
Referenced by SSLerrfree(), and SSLerrmessage().