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

Commit1a77ea0

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 parent0f8571b commit1a77ea0

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
@@ -139,8 +139,8 @@ ALTER TABLE ft_pg_type SET WITH OIDS;
139139
-- ===================================================================
140140
-- tests for validator
141141
-- ===================================================================
142-
-- requiressl, krbsrvnameandgsslibare omitted because they depend on
143-
-- configure options
142+
-- requiresslandsome other parametersare omitted because
143+
--valid values for them depend onconfigure options
144144
ALTER SERVER testserver1 OPTIONS (
145145
use_remote_estimate 'false',
146146
updatable 'true',
@@ -164,10 +164,10 @@ ALTER SERVER testserver1 OPTIONS (
164164
sslcert 'value',
165165
sslkey 'value',
166166
sslrootcert 'value',
167-
sslcrl 'value'
167+
sslcrl 'value',
168168
--requirepeer 'value',
169-
--krbsrvname 'value',
170-
--gsslib 'value',
169+
krbsrvname 'value',
170+
gsslib 'value'
171171
--replication 'value'
172172
);
173173
-- 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
@@ -153,8 +153,8 @@ ALTER TABLE ft_pg_type SET WITH OIDS;
153153
-- ===================================================================
154154
-- tests for validator
155155
-- ===================================================================
156-
-- requiressl, krbsrvnameandgsslibare omitted because they depend on
157-
-- configure options
156+
-- requiresslandsome other parametersare omitted because
157+
--valid values for them depend onconfigure options
158158
ALTER SERVER testserver1 OPTIONS (
159159
use_remote_estimate'false',
160160
updatable'true',
@@ -178,10 +178,10 @@ ALTER SERVER testserver1 OPTIONS (
178178
sslcert'value',
179179
sslkey'value',
180180
sslrootcert'value',
181-
sslcrl'value'
181+
sslcrl'value',
182182
--requirepeer 'value',
183-
--krbsrvname 'value',
184-
--gsslib 'value',
183+
krbsrvname'value',
184+
gsslib'value'
185185
--replication 'value'
186186
);
187187

‎doc/src/sgml/libpq.sgml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,10 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
15541554
<term><literal>gsslib</literal></term>
15551555
<listitem>
15561556
<para>
1557-
GSS library to use for GSSAPI authentication. Only used on Windows.
1558-
Set to <literal>gssapi</literal> to force libpq to use the GSSAPI
1557+
GSS library to use for GSSAPI authentication.
1558+
Currently this is disregarded except on Windows builds that include
1559+
both GSSAPI and SSPI support. In that case, set
1560+
this to <literal>gssapi</literal> to cause libpq to use the GSSAPI
15591561
library for authentication instead of the default SSPI.
15601562
</para>
15611563
</listitem>

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

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

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

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

318314
{"replication",NULL,NULL,NULL,
319315
"Replication","D",5,
@@ -3606,14 +3602,10 @@ freePGconn(PGconn *conn)
36063602
free(conn->sslcompression);
36073603
if (conn->requirepeer)
36083604
free(conn->requirepeer);
3609-
#if defined(ENABLE_GSS)|| defined(ENABLE_SSPI)
36103605
if (conn->krbsrvname)
36113606
free(conn->krbsrvname);
3612-
#endif
3613-
#if defined(ENABLE_GSS)&& defined(ENABLE_SSPI)
36143607
if (conn->gsslib)
36153608
free(conn->gsslib);
3616-
#endif
36173609
/* Note that conn->Pfdebug is not ours to close or free */
36183610
if (conn->last_query)
36193611
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;
@@ -480,10 +479,6 @@ struct pg_conn
480479
#endif
481480

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp