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

Commitccc9073

Browse files
committed
Make psql report "SSL connection (unknown cipher)" when libpq has set
up a SSL connection, but psql is compiled without support for it.Not a really realistic use-case, but the patch also cuts down onthe number of places with #ifdef's...
1 parentcad3a26 commitccc9073

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎src/bin/psql/command.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.196 2008/09/15 12:18:00 petere Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.197 2008/11/11 15:01:53 mha Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -64,9 +64,7 @@ static bool lookup_function_oid(PGconn *conn, const char *desc, Oid *foid);
6464
staticboolget_create_function_cmd(PGconn*conn,Oidoid,PQExpBufferbuf);
6565
staticvoidminimal_error_message(PGresult*res);
6666

67-
#ifdefUSE_SSL
6867
staticvoidprintSSLInfo(void);
69-
#endif
7068

7169
#ifdefWIN32
7270
staticvoidcheckWin32Codepage(void);
@@ -1327,9 +1325,7 @@ connection_warnings(void)
13271325
#ifdefWIN32
13281326
checkWin32Codepage();
13291327
#endif
1330-
#ifdefUSE_SSL
13311328
printSSLInfo();
1332-
#endif
13331329
}
13341330
}
13351331

@@ -1339,10 +1335,10 @@ connection_warnings(void)
13391335
*
13401336
* Prints information about the current SSL connection, if SSL is in use
13411337
*/
1342-
#ifdefUSE_SSL
13431338
staticvoid
13441339
printSSLInfo(void)
13451340
{
1341+
#ifdefUSE_SSL
13461342
intsslbits=-1;
13471343
SSL*ssl;
13481344

@@ -1353,8 +1349,16 @@ printSSLInfo(void)
13531349
SSL_get_cipher_bits(ssl,&sslbits);
13541350
printf(_("SSL connection (cipher: %s, bits: %i)\n"),
13551351
SSL_get_cipher(ssl),sslbits);
1356-
}
1352+
#else
1353+
/*
1354+
* If psql is compiled without SSL but is using a libpq with SSL,
1355+
* we cannot figure out the specifics about the connection. But
1356+
* we know it's SSL secured.
1357+
*/
1358+
if (PQgetssl(pset.db))
1359+
printf(_("SSL connection (unknown cipher)\n"));
13571360
#endif
1361+
}
13581362

13591363

13601364
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp