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

Commit50036e8

Browse files
committed
Add a check for end of client connection before expecting a password
response, to avoid noise in the server log.
1 parent2f4759d commit50036e8

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

‎src/backend/libpq/auth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.55 2001/08/01 23:25:39 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.56 2001/08/07 10:44:13 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -554,7 +554,7 @@ recv_and_check_password_packet(Port *port)
554554
int32len;
555555
intresult;
556556

557-
if (pq_getint(&len,4)==EOF)
557+
if (pq_eof()==EOF||pq_getint(&len,4)==EOF)
558558
returnSTATUS_ERROR;/* client didn't want to send password */
559559
initStringInfo(&buf);
560560
pq_getstr(&buf);

‎src/backend/libpq/pqcomm.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
3030
* Portions Copyright (c) 1994, Regents of the University of California
3131
*
32-
*$Id: pqcomm.c,v 1.119 2001/08/05 01:22:16 tgl Exp $
32+
*$Id: pqcomm.c,v 1.120 2001/08/07 10:44:15 petere Exp $
3333
*
3434
*-------------------------------------------------------------------------
3535
*/
@@ -695,6 +695,26 @@ pq_flush(void)
695695
}
696696

697697

698+
/*
699+
* Return EOF if the connection has been broken, else 0.
700+
*/
701+
int
702+
pq_eof(void)
703+
{
704+
charx;
705+
intres;
706+
707+
res=recv(MyProcPort->sock,&x,1,MSG_PEEK);
708+
709+
if (res==-1)
710+
fprintf(stderr,"pq_eof: recv() failed: %s\n",strerror(errno));
711+
elseif (res==0)
712+
returnEOF;
713+
else
714+
return0;
715+
}
716+
717+
698718
/* --------------------------------
699719
* Message-level I/O routines begin here.
700720
*

‎src/include/libpq/libpq.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: libpq.h,v 1.44 2001/03/22 04:00:48 momjian Exp $
10+
* $Id: libpq.h,v 1.45 2001/08/07 10:44:16 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -65,6 +65,7 @@ extern intpq_getstring(StringInfo s);
6565
externintpq_peekbyte(void);
6666
externintpq_putbytes(constchar*s,size_tlen);
6767
externintpq_flush(void);
68+
externintpq_eof(void);
6869
externintpq_putmessage(charmsgtype,constchar*s,size_tlen);
6970
externvoidpq_startcopyout(void);
7071
externvoidpq_endcopyout(boolerrorAbort);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp