Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd09cfa3

Browse files
committed
libpq should expose GSS-related parameters even when not implemented.
We realized years ago that it's better for libpq to accept allconnection parameters syntactically, even if some are ignored orrestricted due to lack of the feature in a particular build.However, that lesson from the SSL support was for some reason neverapplied to the GSSAPI support. This is causing various buildfarmmembers to have problems with a test case added by commit6136e94,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 infrastructurewas added with the aid of a dartboard, or perhaps with the aid ofthe anti-pattern "add new stuff at the end". It should be safeto rearrange the contents of struct pg_conn even in releasedbranches, since that's private to libpq (and we'd have to movesome 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
1 parentd6eca49 commitd09cfa3

File tree

5 files changed

+21
-32
lines changed

5 files changed

+21
-32
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ ALTER TABLE ft_pg_type SET WITH OIDS;
134134
-- ===================================================================
135135
-- tests for validator
136136
-- ===================================================================
137-
-- requiressl, krbsrvnameandgsslibare omitted because they depend on
138-
-- configure options
137+
-- requiresslandsome other parametersare omitted because
138+
--valid values for them depend onconfigure options
139139
ALTER SERVER testserver1 OPTIONS (
140140
use_remote_estimate 'false',
141141
updatable 'true',
@@ -159,10 +159,10 @@ ALTER SERVER testserver1 OPTIONS (
159159
sslcert 'value',
160160
sslkey 'value',
161161
sslrootcert 'value',
162-
sslcrl 'value'
162+
sslcrl 'value',
163163
--requirepeer 'value',
164-
--krbsrvname 'value',
165-
--gsslib 'value',
164+
krbsrvname 'value',
165+
gsslib 'value'
166166
--replication 'value'
167167
);
168168
-- Error, invalid list syntax

‎contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ ALTER TABLE ft_pg_type SET WITH OIDS;
147147
-- ===================================================================
148148
-- tests for validator
149149
-- ===================================================================
150-
-- requiressl, krbsrvnameandgsslibare omitted because they depend on
151-
-- configure options
150+
-- requiresslandsome other parametersare omitted because
151+
--valid values for them depend onconfigure options
152152
ALTER SERVER testserver1 OPTIONS (
153153
use_remote_estimate'false',
154154
updatable'true',
@@ -172,10 +172,10 @@ ALTER SERVER testserver1 OPTIONS (
172172
sslcert'value',
173173
sslkey'value',
174174
sslrootcert'value',
175-
sslcrl'value'
175+
sslcrl'value',
176176
--requirepeer 'value',
177-
--krbsrvname 'value',
178-
--gsslib 'value',
177+
krbsrvname'value',
178+
gsslib'value'
179179
--replication 'value'
180180
);
181181

‎doc/src/sgml/libpq.sgml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,8 +1487,10 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
14871487
<term><literal>gsslib</literal></term>
14881488
<listitem>
14891489
<para>
1490-
GSS library to use for GSSAPI authentication. Only used on Windows.
1491-
Set to <literal>gssapi</literal> to force libpq to use the GSSAPI
1490+
GSS library to use for GSSAPI authentication.
1491+
Currently this is disregarded except on Windows builds that include
1492+
both GSSAPI and SSPI support. In that case, set
1493+
this to <literal>gssapi</literal> to cause libpq to use the GSSAPI
14921494
library for authentication instead of the default SSPI.
14931495
</para>
14941496
</listitem>

‎src/interfaces/libpq/fe-connect.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,19 @@ static const internalPQconninfoOption PQconninfoOptions[] = {
296296
"Require-Peer","",10,
297297
offsetof(structpg_conn,requirepeer)},
298298

299-
#if defined(ENABLE_GSS)||defined(ENABLE_SSPI)
299+
/*
300+
* As with SSL, all GSS options are exposed even in builds that don't have
301+
* support.
302+
*/
303+
300304
/* Kerberos and GSSAPI authentication support specifying the service name */
301305
{"krbsrvname","PGKRBSRVNAME",PG_KRB_SRVNAM,NULL,
302306
"Kerberos-service-name","",20,
303307
offsetof(structpg_conn,krbsrvname)},
304-
#endif
305-
306-
#if defined(ENABLE_GSS)&&defined(ENABLE_SSPI)
307308

308-
/*
309-
* GSSAPI and SSPI both enabled, give a way to override which is used by
310-
* default
311-
*/
312309
{"gsslib","PGGSSLIB",NULL,NULL,
313310
"GSS-library","",7,/* sizeof("gssapi") = 7 */
314311
offsetof(structpg_conn,gsslib)},
315-
#endif
316312

317313
{"replication",NULL,NULL,NULL,
318314
"Replication","D",5,
@@ -3605,14 +3601,10 @@ freePGconn(PGconn *conn)
36053601
free(conn->sslcompression);
36063602
if (conn->requirepeer)
36073603
free(conn->requirepeer);
3608-
#if defined(ENABLE_GSS)|| defined(ENABLE_SSPI)
36093604
if (conn->krbsrvname)
36103605
free(conn->krbsrvname);
3611-
#endif
3612-
#if defined(ENABLE_GSS)&& defined(ENABLE_SSPI)
36133606
if (conn->gsslib)
36143607
free(conn->gsslib);
3615-
#endif
36163608
/* Note that conn->Pfdebug is not ours to close or free */
36173609
if (conn->last_query)
36183610
free(conn->last_query);

‎src/interfaces/libpq/libpq-int.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,9 @@ struct pg_conn
357357
char*sslrootcert;/* root certificate filename */
358358
char*sslcrl;/* certificate revocation list filename */
359359
char*requirepeer;/* required peer credentials for local sockets */
360-
361-
#if defined(ENABLE_GSS)|| defined(ENABLE_SSPI)
362360
char*krbsrvname;/* Kerberos service name */
363-
#endif
361+
char*gsslib;/* What GSS library to use ("gssapi" or
362+
* "sspi") */
364363

365364
/* Type of connection to make. Possible values: any, read-write. */
366365
char*target_session_attrs;
@@ -479,10 +478,6 @@ struct pg_conn
479478
#endif
480479

481480
#ifdefENABLE_SSPI
482-
#ifdefENABLE_GSS
483-
char*gsslib;/* What GSS library to use ("gssapi" or
484-
* "sspi") */
485-
#endif
486481
CredHandle*sspicred;/* SSPI credentials handle */
487482
CtxtHandle*sspictx;/* SSPI context */
488483
char*sspitarget;/* SSPI target name */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp