diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 0ee018edd2a..cffabbc8f7e 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1873,7 +1873,7 @@ int PQsslInUse(const PGconn *conn); - + PQsslAttributePQsslAttribute @@ -1947,13 +1947,13 @@ const char *PQsslAttribute(const PGconn *conn, const char *attribute_name); - - PQsslAttributesPQsslAttributes + + PQsslAttributeNamesPQsslAttributeNames Return an array of SSL attribute names available. The array is terminated by a NULL pointer. -const char **PQsslAttributes(const PGconn *conn); +const char * const * PQsslAttributeNames(const PGconn *conn); @@ -1963,15 +1963,15 @@ const char **PQsslAttributes(const PGconn *conn); PQsslStructPQsslStruct - Return a pointer to an SSL-implementation specific object describing + Return a pointer to an SSL-implementation-specific object describing the connection. void *PQsslStruct(const PGconn *conn, const char *struct_name); - The structs available depends on the SSL implementation in use. - For OpenSSL, there is one struct, under the name "OpenSSL", + The struct(s) available depend on the SSL implementation in use. + For OpenSSL, there is one struct, available under the name "OpenSSL", and it returns a pointer to the OpenSSL SSL struct. To use this function, code along the following lines could be used: - Add libpq function PQsslAttribute() - that returns SSL information (Heikki Linnakangas) + Add libpq functions to return SSL + information in an implementation-independent way (Heikki Linnakangas) - While PQgetssl() - can still be used to call OpenSSL - functions, PQsslAttribute() returns SSL - information in an SSL-implementation-independent way. - (Future versions of libpq might support other SSL - implementations.) + While PQgetssl() can + still be used to call OpenSSL functions, it is now + considered deprecated because future versions + of libpq might support other SSL + implementations. When possible, use the new + functions PQsslAttribute(), PQsslAttributeNames(), + and PQsslInUse() + to obtain SSL information in + an SSL-implementation-independent way. diff --git a/src/interfaces/libpq/exports.txt b/src/interfaces/libpq/exports.txt index 0bbcae51bbc..c69a4d5ea42 100644 --- a/src/interfaces/libpq/exports.txt +++ b/src/interfaces/libpq/exports.txt @@ -167,6 +167,6 @@ lo_truncate64 164 PQconninfo 165 PQsslInUse 166 PQsslStruct 167 -PQsslAttributes 168 +PQsslAttributeNames 168 PQsslAttribute 169 PQsetErrorContextVisibility 170 diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c index 4b2a324634b..45ad7321bbe 100644 --- a/src/interfaces/libpq/fe-secure-openssl.c +++ b/src/interfaces/libpq/fe-secure-openssl.c @@ -1532,10 +1532,10 @@ PQsslStruct(PGconn *conn, const char *struct_name) return NULL; } -const char ** -PQsslAttributes(PGconn *conn) +const char *const * +PQsslAttributeNames(PGconn *conn) { - static const char *result[] = { + static const char *const result[] = { "library", "key_bits", "cipher", diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index db91e52ee90..aa5af7340fe 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -408,10 +408,10 @@ PQsslAttribute(PGconn *conn, const char *attribute_name) return NULL; } -const char ** -PQsslAttributes(PGconn *conn) +const char *const * +PQsslAttributeNames(PGconn *conn) { - static const char *result[] = {NULL}; + static const char *const result[] = {NULL}; return result; } diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 828c533c1a3..3a521d428d1 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -329,7 +329,7 @@ extern int PQsetClientEncoding(PGconn *conn, const char *encoding); extern int PQsslInUse(PGconn *conn); extern void *PQsslStruct(PGconn *conn, const char *struct_name); extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name); -extern const char **PQsslAttributes(PGconn *conn); +extern const char *const * PQsslAttributeNames(PGconn *conn); /* Get the OpenSSL structure associated with a connection. Returns NULL for * unencrypted connections or if any other TLS library is in use. */