|
11 | 11 | *
|
12 | 12 | *
|
13 | 13 | * IDENTIFICATION
|
14 |
| - * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.5 2002/06/14 04:36:58 momjian Exp $ |
| 14 | + * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.6 2002/06/14 04:38:04 momjian Exp $ |
15 | 15 | *
|
16 | 16 | * Since the server static private key ($DataDir/server.key)
|
17 | 17 | * will normally be stored unencrypted so that the database
|
|
65 | 65 | * [*] server verifies client certificates
|
66 | 66 | *
|
67 | 67 | * milestone 5: provide informational callbacks
|
68 |
| - * [] provide informational callbacks |
| 68 | + * [*] provide informational callbacks |
69 | 69 | *
|
70 | 70 | * other changes
|
71 | 71 | * [ ] tcp-wrappers
|
@@ -125,6 +125,7 @@ static DH *load_dh_file(int keylength);
|
125 | 125 | staticDH*load_dh_buffer(constchar*,size_t);
|
126 | 126 | staticDH*tmp_dh_cb(SSL*s,intis_export,intkeylength);
|
127 | 127 | staticintverify_cb(int,X509_STORE_CTX*);
|
| 128 | +staticvoidinfo_cb(SSL*ssl,inttype,intargs); |
128 | 129 | staticintinitialize_SSL(void);
|
129 | 130 | staticvoiddestroy_SSL(void);
|
130 | 131 | staticintopen_server_SSL(Port*);
|
@@ -539,6 +540,45 @@ verify_cb (int ok, X509_STORE_CTX *ctx)
|
539 | 540 | returnok;
|
540 | 541 | }
|
541 | 542 |
|
| 543 | +/* |
| 544 | + *This callback is used to copy SSL information messages |
| 545 | + *into the PostgreSQL log. |
| 546 | + */ |
| 547 | +staticvoid |
| 548 | +info_cb (SSL*ssl,inttype,intargs) |
| 549 | +{ |
| 550 | +if (DebugLvl<2) |
| 551 | +return; |
| 552 | + |
| 553 | +switch (type) |
| 554 | +{ |
| 555 | +caseSSL_CB_HANDSHAKE_START: |
| 556 | +elog(DEBUG,"SSL: handshake start"); |
| 557 | +break; |
| 558 | +caseSSL_CB_HANDSHAKE_DONE: |
| 559 | +elog(DEBUG,"SSL: handshake done"); |
| 560 | +break; |
| 561 | +caseSSL_CB_ACCEPT_LOOP: |
| 562 | +if (DebugLvl >=3) |
| 563 | +elog(DEBUG,"SSL: accept loop"); |
| 564 | +break; |
| 565 | +caseSSL_CB_ACCEPT_EXIT: |
| 566 | +elog(DEBUG,"SSL: accept exit (%d)",args); |
| 567 | +break; |
| 568 | +caseSSL_CB_CONNECT_LOOP: |
| 569 | +elog(DEBUG,"SSL: connect loop"); |
| 570 | +break; |
| 571 | +caseSSL_CB_CONNECT_EXIT: |
| 572 | +elog(DEBUG,"SSL: connect exit (%d)",args); |
| 573 | +break; |
| 574 | +caseSSL_CB_READ_ALERT: |
| 575 | +elog(DEBUG,"SSL: read alert (0x%04x)",args); |
| 576 | +break; |
| 577 | +caseSSL_CB_WRITE_ALERT: |
| 578 | +elog(DEBUG,"SSL: write alert (0x%04x)",args); |
| 579 | +break; |
| 580 | +} |
| 581 | +} |
542 | 582 |
|
543 | 583 | /*
|
544 | 584 | *Initialize global SSL context.
|
@@ -663,6 +703,9 @@ open_server_SSL (Port *port)
|
663 | 703 | }
|
664 | 704 | elog(DEBUG,"secure connection from '%s'",port->peer_cn);
|
665 | 705 |
|
| 706 | +/* set up debugging/info callback */ |
| 707 | +SSL_CTX_set_info_callback(SSL_context,info_cb); |
| 708 | + |
666 | 709 | return0;
|
667 | 710 | }
|
668 | 711 |
|
|