diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-12-20 15:34:07 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-12-20 15:34:07 -0500 |
commit | e8f60e6fe206b4877c5b0d0b70015e672de04f60 (patch) | |
tree | 96f99f3d0311dc5e1628459ae31acbe0deb44865 /src/interfaces/libpq/fe-connect.c | |
parent | e5a37d958decfbc9dc650e66775db5896b7486ff (diff) | |
download | postgresql-e8f60e6fe206b4877c5b0d0b70015e672de04f60.tar.gz postgresql-e8f60e6fe206b4877c5b0d0b70015e672de04f60.zip |
libpq should expose GSS-related parameters even when not implemented.
We realized years ago that it's better for libpq to accept all
connection parameters syntactically, even if some are ignored or
restricted due to lack of the feature in a particular build.
However, that lesson from the SSL support was for some reason never
applied to the GSSAPI support. This is causing various buildfarm
members to have problems with a test case added by commit 6136e94dc,
and it's just a bad idea from a user-experience standpoint anyway,
so fix it.
While at it, fix some places where parameter-related infrastructure
was added with the aid of a dartboard, or perhaps with the aid of
the anti-pattern "add new stuff at the end". It should be safe
to rearrange the contents of struct pg_conn even in released
branches, since that's private to libpq (and we'd have to move
some fields in some builds to fix this, anyway).
Back-patch to all supported branches.
Discussion: https://postgr.es/m/11297.1576868677@sss.pgh.pa.us
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 84765a79fee..d9e1d0c2548 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -309,30 +309,21 @@ static const internalPQconninfoOption PQconninfoOptions[] = { offsetof(struct pg_conn, requirepeer)}, /* - * Expose gssencmode similarly to sslmode - we can still handle "disable" - * and "prefer". + * As with SSL, all GSS options are exposed even in builds that don't have + * support. */ {"gssencmode", "PGGSSENCMODE", DefaultGSSMode, NULL, "GSSENC-Mode", "", 7, /* sizeof("disable") == 7 */ offsetof(struct pg_conn, gssencmode)}, -#if defined(ENABLE_GSS) || defined(ENABLE_SSPI) /* Kerberos and GSSAPI authentication support specifying the service name */ {"krbsrvname", "PGKRBSRVNAME", PG_KRB_SRVNAM, NULL, "Kerberos-service-name", "", 20, offsetof(struct pg_conn, krbsrvname)}, -#endif - -#if defined(ENABLE_GSS) && defined(ENABLE_SSPI) - /* - * GSSAPI and SSPI both enabled, give a way to override which is used by - * default - */ {"gsslib", "PGGSSLIB", NULL, NULL, "GSS-library", "", 7, /* sizeof("gssapi") = 7 */ offsetof(struct pg_conn, gsslib)}, -#endif {"replication", NULL, NULL, NULL, "Replication", "D", 5, @@ -3966,14 +3957,14 @@ freePGconn(PGconn *conn) free(conn->sslcompression); if (conn->requirepeer) free(conn->requirepeer); - if (conn->connip) - free(conn->connip); if (conn->gssencmode) free(conn->gssencmode); -#if defined(ENABLE_GSS) || defined(ENABLE_SSPI) if (conn->krbsrvname) free(conn->krbsrvname); -#endif + if (conn->gsslib) + free(conn->gsslib); + if (conn->connip) + free(conn->connip); #ifdef ENABLE_GSS if (conn->gcred != GSS_C_NO_CREDENTIAL) { @@ -3990,10 +3981,6 @@ freePGconn(PGconn *conn) conn->gctx = NULL; } #endif -#if defined(ENABLE_GSS) && defined(ENABLE_SSPI) - if (conn->gsslib) - free(conn->gsslib); -#endif /* Note that conn->Pfdebug is not ours to close or free */ if (conn->last_query) free(conn->last_query); |