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

Commitaf0e79c

Browse files
committed
Move SSL information callback earlier to capture more information
The callback for retrieving state change information during connectionsetup was only installed when the connection was mostly set up, andthus didn't provide much information and missed all the details relatedto the handshake.This also extends the callback with SSL_state_string_long() to printmore information about the state change within the SSL object handled.While there, fix some comments which were incorrectly referring to thecallback and its previous location in fe-secure.c.Author: Daniel GustafssonDiscussion:https://postgr.es/m/232CF476-94E1-42F1-9408-719E2AEC5491@yesql.se
1 parent27a48e5 commitaf0e79c

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

‎src/backend/libpq/be-secure-openssl.c‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ be_tls_open_server(Port *port)
381381
return-1;
382382
}
383383

384+
/* set up debugging/info callback */
385+
SSL_CTX_set_info_callback(SSL_context,info_cb);
386+
384387
if (!(port->ssl=SSL_new(SSL_context)))
385388
{
386389
ereport(COMMERROR,
@@ -562,9 +565,6 @@ be_tls_open_server(Port *port)
562565
port->peer_cert_valid= true;
563566
}
564567

565-
/* set up debugging/info callback */
566-
SSL_CTX_set_info_callback(SSL_context,info_cb);
567-
568568
return0;
569569
}
570570

@@ -999,39 +999,43 @@ verify_cb(int ok, X509_STORE_CTX *ctx)
999999
staticvoid
10001000
info_cb(constSSL*ssl,inttype,intargs)
10011001
{
1002+
constchar*desc;
1003+
1004+
desc=SSL_state_string_long(ssl);
1005+
10021006
switch (type)
10031007
{
10041008
caseSSL_CB_HANDSHAKE_START:
10051009
ereport(DEBUG4,
1006-
(errmsg_internal("SSL: handshake start")));
1010+
(errmsg_internal("SSL: handshake start: \"%s\"",desc)));
10071011
break;
10081012
caseSSL_CB_HANDSHAKE_DONE:
10091013
ereport(DEBUG4,
1010-
(errmsg_internal("SSL: handshake done")));
1014+
(errmsg_internal("SSL: handshake done: \"%s\"",desc)));
10111015
break;
10121016
caseSSL_CB_ACCEPT_LOOP:
10131017
ereport(DEBUG4,
1014-
(errmsg_internal("SSL: accept loop")));
1018+
(errmsg_internal("SSL: accept loop: \"%s\"",desc)));
10151019
break;
10161020
caseSSL_CB_ACCEPT_EXIT:
10171021
ereport(DEBUG4,
1018-
(errmsg_internal("SSL: accept exit (%d)",args)));
1022+
(errmsg_internal("SSL: accept exit (%d): \"%s\"",args,desc)));
10191023
break;
10201024
caseSSL_CB_CONNECT_LOOP:
10211025
ereport(DEBUG4,
1022-
(errmsg_internal("SSL: connect loop")));
1026+
(errmsg_internal("SSL: connect loop: \"%s\"",desc)));
10231027
break;
10241028
caseSSL_CB_CONNECT_EXIT:
10251029
ereport(DEBUG4,
1026-
(errmsg_internal("SSL: connect exit (%d)",args)));
1030+
(errmsg_internal("SSL: connect exit (%d): \"%s\"",args,desc)));
10271031
break;
10281032
caseSSL_CB_READ_ALERT:
10291033
ereport(DEBUG4,
1030-
(errmsg_internal("SSL: read alert (0x%04x)",args)));
1034+
(errmsg_internal("SSL: read alert (0x%04x): \"%s\"",args,desc)));
10311035
break;
10321036
caseSSL_CB_WRITE_ALERT:
10331037
ereport(DEBUG4,
1034-
(errmsg_internal("SSL: write alert (0x%04x)",args)));
1038+
(errmsg_internal("SSL: write alert (0x%04x): \"%s\"",args,desc)));
10351039
break;
10361040
}
10371041
}

‎src/interfaces/libpq/fe-secure-openssl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* NOTES
1515
*
1616
* We don't provide informational callbacks here (like
17-
* info_cb() in be-secure.c), since there's no good mechanism to
17+
* info_cb() in be-secure-openssl.c), since there's no good mechanism to
1818
* display such information to the user.
1919
*
2020
*-------------------------------------------------------------------------

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
* IDENTIFICATION
1414
* src/interfaces/libpq/fe-secure.c
1515
*
16-
* NOTES
17-
*
18-
* We don't provide informational callbacks here (like
19-
* info_cb() in be-secure.c), since there's no good mechanism to
20-
* display such information to the user.
21-
*
2216
*-------------------------------------------------------------------------
2317
*/
2418

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp