mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Back out SSL changes. Newer patch available.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# Makefile for libpq subsystem (backend half of libpq interface)
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.31 2002/06/14 03:56:46 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.32 2002/06/14 04:09:36 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -14,8 +14,7 @@ include $(top_builddir)/src/Makefile.global
|
||||
|
||||
# be-fsstubs is here for historical reasons, probably belongs elsewhere
|
||||
|
||||
OBJS = be-fsstubs.o be-ssl.o auth.o crypt.o hba.o md5.o pqcomm.o \
|
||||
pqformat.o pqsignal.o
|
||||
OBJS = be-fsstubs.o auth.o crypt.o hba.o md5.o pqcomm.o pqformat.o pqsignal.o
|
||||
|
||||
|
||||
all: SUBSYS.o
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pqcomm.c,v 1.134 2002/06/14 03:56:46 momjian Exp $
|
||||
* $Id: pqcomm.c,v 1.135 2002/06/14 04:09:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -81,14 +81,6 @@
|
||||
#include "miscadmin.h"
|
||||
#include "storage/ipc.h"
|
||||
|
||||
/* these functions are misnamed - they handle both SSL and non-SSL case */
|
||||
extern ssize_t read_SSL(Port *, void *ptr, size_t len);
|
||||
extern ssize_t write_SSL(Port *, const void *ptr, size_t len);
|
||||
|
||||
#ifdef USE_SSL
|
||||
extern void close_SSL(Port *);
|
||||
#endif /* USE_SSL */
|
||||
|
||||
|
||||
static void pq_close(void);
|
||||
|
||||
@@ -146,9 +138,6 @@ pq_close(void)
|
||||
{
|
||||
if (MyProcPort != NULL)
|
||||
{
|
||||
#ifdef USE_SSL
|
||||
close_SSL(MyProcPort);
|
||||
#endif /* USE_SSL */
|
||||
close(MyProcPort->sock);
|
||||
/* make sure any subsequent attempts to do I/O fail cleanly */
|
||||
MyProcPort->sock = -1;
|
||||
@@ -427,7 +416,6 @@ StreamConnection(int server_fd, Port *port)
|
||||
void
|
||||
StreamClose(int sock)
|
||||
{
|
||||
/* FIXME - what about closing SSL connections? */
|
||||
close(sock);
|
||||
}
|
||||
|
||||
@@ -469,8 +457,14 @@ pq_recvbuf(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = read_SSL(MyProcPort, PqRecvBuffer + PqRecvLength,
|
||||
PQ_BUFFER_SIZE - PqRecvLength);
|
||||
#ifdef USE_SSL
|
||||
if (MyProcPort->ssl)
|
||||
r = SSL_read(MyProcPort->ssl, PqRecvBuffer + PqRecvLength,
|
||||
PQ_BUFFER_SIZE - PqRecvLength);
|
||||
else
|
||||
#endif
|
||||
r = recv(MyProcPort->sock, PqRecvBuffer + PqRecvLength,
|
||||
PQ_BUFFER_SIZE - PqRecvLength, 0);
|
||||
|
||||
if (r < 0)
|
||||
{
|
||||
@@ -486,11 +480,7 @@ pq_recvbuf(void)
|
||||
elog(COMMERROR, "pq_recvbuf: recv() failed: %m");
|
||||
return EOF;
|
||||
}
|
||||
#ifdef USE_SSL
|
||||
if (r == 0 && !MyProcPort->ssl)
|
||||
#else /* USE_SSL */
|
||||
if (r == 0)
|
||||
#endif /* USE_SSL */
|
||||
{
|
||||
/* as above, only write to postmaster log */
|
||||
elog(COMMERROR, "pq_recvbuf: unexpected EOF on client connection");
|
||||
@@ -661,13 +651,14 @@ pq_flush(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = write_SSL(MyProcPort, bufptr, bufend - bufptr);
|
||||
|
||||
#ifdef USE_SSL
|
||||
if (r < 0 || (r == 0 && !MyProcPort->ssl))
|
||||
#else /* USE_SSL */
|
||||
if (MyProcPort->ssl)
|
||||
r = SSL_write(MyProcPort->ssl, bufptr, bufend - bufptr);
|
||||
else
|
||||
#endif
|
||||
r = send(MyProcPort->sock, bufptr, bufend - bufptr, 0);
|
||||
|
||||
if (r <= 0)
|
||||
#endif /* USE_SSL */
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue; /* Ok if we were interrupted */
|
||||
@@ -712,9 +703,8 @@ int
|
||||
pq_eof(void)
|
||||
{
|
||||
char x;
|
||||
int res = 1;
|
||||
int res;
|
||||
|
||||
#ifndef USE_SSL /* not a good solution, but better than nothing */
|
||||
res = recv(MyProcPort->sock, &x, 1, MSG_PEEK);
|
||||
|
||||
if (res < 0)
|
||||
@@ -723,8 +713,6 @@ pq_eof(void)
|
||||
elog(COMMERROR, "pq_eof: recv() failed: %m");
|
||||
return EOF;
|
||||
}
|
||||
#endif /* USE_SSL */
|
||||
|
||||
if (res == 0)
|
||||
return EOF;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user