declare-load_host-more-honestly.patch
text/x-diff
Filename: declare-load_host-more-honestly.patch
Type: text/x-diff
Part: 0
Message:
Re: Serverside SNI support in libpq
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/libpq/be-secure-common.c | 1 | 1 |
| src/backend/libpq/be-secure-openssl.c | 1 | 1 |
| src/include/libpq/hba.h | 0 | 9 |
| src/include/libpq/libpq.h | 10 | 1 |
diff --git a/src/backend/libpq/be-secure-common.c b/src/backend/libpq/be-secure-common.c
index ad04bedaa1d..6ec887b8a47 100644
--- a/src/backend/libpq/be-secure-common.c
+++ b/src/backend/libpq/be-secure-common.c
@@ -361,7 +361,7 @@ parse_hosts_line(TokenizedAuthLine *tok_line, int elevel)
* the hosts configuration failed to load, the err_msg variable may have more
* information in case it was passed as non-NULL.
*/
-int
+HostsFileLoadResult
load_hosts(List **hosts, char **err_msg)
{
FILE *file;
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index f64b2787f66..b978497b5d4 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -156,7 +156,7 @@ be_tls_init(bool isServerStart)
MemoryContext host_memcxt = NULL;
MemoryContextCallback *host_memcxt_cb;
char *err_msg = NULL;
- int res;
+ HostsFileLoadResult res;
struct hosts *new_hosts;
SSL_CTX *context = NULL;
int ssl_ver_min = -1;
diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h
index 29e2a6c5b3d..4aa6258a345 100644
--- a/src/include/libpq/hba.h
+++ b/src/include/libpq/hba.h
@@ -165,15 +165,6 @@ typedef struct HostsLine
void *ssl_ctx; /* associated SSL_CTX* for the above settings */
} HostsLine;
-typedef enum HostsFileLoadResult
-{
- HOSTSFILE_LOAD_OK = 0,
- HOSTSFILE_LOAD_FAILED,
- HOSTSFILE_EMPTY,
- HOSTSFILE_MISSING,
- HOSTSFILE_DISABLED,
-} HostsFileLoadResult;
-
/*
* TokenizedAuthLine represents one line lexed from an authentication
* configuration file. Each item in the "fields" list is a sub-list of
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index c9b934d2321..d15073a0a93 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -156,6 +156,15 @@ enum ssl_protocol_versions
PG_TLS1_3_VERSION,
};
+typedef enum HostsFileLoadResult
+{
+ HOSTSFILE_LOAD_OK = 0,
+ HOSTSFILE_LOAD_FAILED,
+ HOSTSFILE_EMPTY,
+ HOSTSFILE_MISSING,
+ HOSTSFILE_DISABLED,
+} HostsFileLoadResult;
+
/*
* prototypes for functions in be-secure-common.c
*/
@@ -164,6 +173,6 @@ extern int run_ssl_passphrase_command(const char *cmd, const char *prompt,
char *buf, int size);
extern bool check_ssl_key_file_permissions(const char *ssl_key_file,
bool isServerStart);
-extern int load_hosts(List **hosts, char **err_msg);
+extern HostsFileLoadResult load_hosts(List **hosts, char **err_msg);
#endif /* LIBPQ_H */