Skip to content

Commit 4e86f1b

Browse files
committed
Put SSL_pending() call behind the new internal SSL API.
It seems likely that any SSL implementation will need a similar call, not just OpenSSL.
1 parent 6d6cade commit 4e86f1b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/interfaces/libpq/fe-misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,9 +1054,9 @@ pqSocketCheck(PGconn *conn, int forRead, int forWrite, time_t end_time)
10541054
return -1;
10551055
}
10561056

1057-
#ifdef USE_OPENSSL
1057+
#ifdef USE_SSL
10581058
/* Check for SSL library buffering read bytes */
1059-
if (forRead && conn->ssl && SSL_pending(conn->ssl) > 0)
1059+
if (forRead && conn->ssl_in_use && pgtls_read_pending(conn) > 0)
10601060
{
10611061
/* short-circuit the select */
10621062
return 1;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ pgtls_open_client(PGconn *conn)
186186
return open_client_SSL(conn);
187187
}
188188

189+
/*
190+
* Is there unread data waiting in the SSL read buffer?
191+
*/
192+
bool
193+
pgtls_read_pending(PGconn *conn)
194+
{
195+
return SSL_pending(conn->ssl);
196+
}
197+
189198
/*
190199
* Read data from a secure connection.
191200
*

src/interfaces/libpq/libpq-int.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ extern int pgtls_init(PGconn *conn);
641641
extern PostgresPollingStatusType pgtls_open_client(PGconn *conn);
642642
extern void pgtls_close(PGconn *conn);
643643
extern ssize_t pgtls_read(PGconn *conn, void *ptr, size_t len);
644+
extern bool pgtls_read_pending(PGconn *conn);
644645
extern ssize_t pgtls_write(PGconn *conn, const void *ptr, size_t len);
645646

646647
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy