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

Commit5241a62

Browse files
committed
Remove support for version-0 FE/BE protocol, per pghackers discussion.
This breaks support for 6.2 or older client libraries.
1 parent8a24a55 commit5241a62

File tree

6 files changed

+21
-248
lines changed

6 files changed

+21
-248
lines changed

‎doc/src/sgml/release.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.153 2002/08/2900:17:01 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.154 2002/08/2903:22:00 tgl Exp $
33
-->
44

55
<appendix id="release">
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
2424
worries about funny characters.
2525
-->
2626
<literallayout><![CDATA[
27+
Client libraries older than 6.3 no longer supported (version 0 protocol removed)
2728
PREPARE statement allows caching query plans for interactive statements
2829
Type OPAQUE is now deprecated in favor of pseudo-types cstring, trigger, etc
2930
Standalone composite types can now be created with CREATE TYPE

‎src/backend/libpq/auth.c

Lines changed: 1 addition & 181 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.85 2002/08/27 16:21:50 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.86 2002/08/29 03:22:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -37,11 +37,8 @@
3737

3838

3939
staticvoidsendAuthRequest(Port*port,AuthRequestareq);
40-
staticintold_be_recvauth(Port*port);
41-
staticintmap_old_to_new(Port*port,UserAuthold,intstatus);
4240
staticvoidauth_failed(Port*port,intstatus);
4341
staticintrecv_and_check_password_packet(Port*port);
44-
staticintrecv_and_check_passwordv0(Port*port);
4542

4643
char*pg_krb_server_keyfile;
4744

@@ -318,86 +315,6 @@ pg_krb5_recvauth(Port *port)
318315
#endif/* KRB5 */
319316

320317

321-
/*
322-
* Handle a v0 password packet.
323-
*/
324-
staticint
325-
recv_and_check_passwordv0(Port*port)
326-
{
327-
int32len;
328-
char*buf;
329-
PasswordPacketV0*pp;
330-
char*user,
331-
*password,
332-
*cp,
333-
*start;
334-
intstatus;
335-
336-
if (pq_getint(&len,4)==EOF)
337-
returnSTATUS_EOF;
338-
len-=4;
339-
buf=palloc(len);
340-
if (pq_getbytes(buf,len)==EOF)
341-
{
342-
pfree(buf);
343-
returnSTATUS_EOF;
344-
}
345-
346-
pp= (PasswordPacketV0*)buf;
347-
348-
/*
349-
* The packet is supposed to comprise the user name and the password
350-
* as C strings. Be careful to check that this is the case.
351-
*/
352-
user=password=NULL;
353-
354-
len-=sizeof(pp->unused);
355-
356-
cp=start=pp->data;
357-
358-
while (len-->0)
359-
if (*cp++=='\0')
360-
{
361-
if (user==NULL)
362-
user=start;
363-
else
364-
{
365-
password=start;
366-
break;
367-
}
368-
369-
start=cp;
370-
}
371-
372-
if (user==NULL||password==NULL)
373-
{
374-
elog(LOG,"pg_password_recvauth: badly formed password packet");
375-
status=STATUS_ERROR;
376-
}
377-
else
378-
{
379-
UserAuthsaved;
380-
381-
/* Check the password. */
382-
383-
saved=port->auth_method;
384-
port->auth_method=uaPassword;
385-
386-
status=md5_crypt_verify(port,user,password);
387-
388-
port->auth_method=saved;
389-
390-
/* Adjust the result if necessary. */
391-
if (map_old_to_new(port,uaPassword,status)!=STATUS_OK)
392-
status=STATUS_ERROR;
393-
}
394-
395-
pfree(buf);
396-
397-
returnstatus;
398-
}
399-
400-
401318
/*
402319
* Tell the user the authentication failed, but not (much about) why.
403320
*
@@ -481,16 +398,6 @@ ClientAuthentication(Port *port)
481398
if (hba_getauthmethod(port)!=STATUS_OK)
482399
elog(FATAL,"Missing or erroneous pg_hba.conf file, see postmaster log for details");
483400

484-
/* Handle old style authentication. */
485-
if (PG_PROTOCOL_MAJOR(port->proto)==0)
486-
{
487-
status=old_be_recvauth(port);
488-
if (status!=STATUS_OK)
489-
auth_failed(port,status);
490-
return;
491-
}
492-
493-
/* Handle new style authentication. */
494401
switch (port->auth_method)
495402
{
496403
caseuaReject:
@@ -828,90 +735,3 @@ recv_and_check_password_packet(Port *port)
828735
pfree(buf.data);
829736
returnresult;
830737
}
831-
832-
833-
/*
834-
* Server demux routine for incoming authentication information for protocol
835-
* version 0.
836-
*/
837-
staticint
838-
old_be_recvauth(Port*port)
839-
{
840-
intstatus;
841-
MsgTypemsgtype= (MsgType)port->proto;
842-
843-
/* Handle the authentication that's offered. */
844-
switch (msgtype)
845-
{
846-
caseSTARTUP_KRB4_MSG:
847-
status=map_old_to_new(port,uaKrb4,pg_krb4_recvauth(port));
848-
break;
849-
850-
caseSTARTUP_KRB5_MSG:
851-
status=map_old_to_new(port,uaKrb5,pg_krb5_recvauth(port));
852-
break;
853-
854-
caseSTARTUP_MSG:
855-
status=map_old_to_new(port,uaTrust,STATUS_OK);
856-
break;
857-
858-
caseSTARTUP_PASSWORD_MSG:
859-
status=recv_and_check_passwordv0(port);
860-
break;
861-
862-
default:
863-
elog(LOG,"Invalid startup message type: %u",msgtype);
864-
865-
returnSTATUS_ERROR;
866-
}
867-
868-
returnstatus;
869-
}
870-
871-
872-
/*
873-
* The old style authentication has been done.Modify the result of this (eg.
874-
* allow the connection anyway, disallow it anyway, or use the result)
875-
* depending on what authentication we really want to use.
876-
*/
877-
staticint
878-
map_old_to_new(Port*port,UserAuthold,intstatus)
879-
{
880-
switch (port->auth_method)
881-
{
882-
caseuaMD5:
883-
caseuaCrypt:
884-
caseuaReject:
885-
#ifdefUSE_PAM
886-
caseuaPAM:
887-
#endif/* USE_PAM */
888-
status=STATUS_ERROR;
889-
break;
890-
891-
caseuaKrb4:
892-
if (old!=uaKrb4)
893-
status=STATUS_ERROR;
894-
break;
895-
896-
caseuaKrb5:
897-
if (old!=uaKrb5)
898-
status=STATUS_ERROR;
899-
break;
900-
901-
caseuaTrust:
902-
status=STATUS_OK;
903-
break;
904-
905-
caseuaIdent:
906-
status=authident(port);
907-
break;
908-
909-
caseuaPassword:
910-
if (old!=uaPassword)
911-
status=STATUS_ERROR;
912-
913-
break;
914-
}
915-
916-
returnstatus;
917-
}

‎src/backend/libpq/pqformat.c

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1717
* Portions Copyright (c) 1994, Regents of the University of California
1818
*
19-
*$Id: pqformat.c,v 1.22 2002/08/08 06:32:26 ishii Exp $
19+
*$Id: pqformat.c,v 1.23 2002/08/29 03:22:01 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -57,41 +57,6 @@
5757
#include<endian.h>
5858
#endif
5959

60-
#ifndefBYTE_ORDER
61-
#error BYTE_ORDER must be defined as LITTLE_ENDIAN, BIG_ENDIAN or PDP_ENDIAN
62-
#endif
63-
64-
#ifBYTE_ORDER==LITTLE_ENDIAN
65-
66-
#definentoh_s(n)n
67-
#definentoh_l(n)n
68-
#definehton_s(n)n
69-
#definehton_l(n)n
70-
71-
#else
72-
#ifBYTE_ORDER==BIG_ENDIAN
73-
74-
#definentoh_s(n)(uint16)((((uint16)n & 0x00ff) << 8) | \
75-
(((uint16)n & 0xff00) >> 8))
76-
#definentoh_l(n)(uint32)((((uint32)n & 0x000000ff) << 24) | \
77-
(((uint32)n & 0x0000ff00) << 8) | \
78-
(((uint32)n & 0x00ff0000) >> 8) | \
79-
(((uint32)n & 0xff000000) >> 24))
80-
#definehton_s(n)(ntoh_s(n))
81-
#definehton_l(n)(ntoh_l(n))
82-
83-
#else
84-
#ifBYTE_ORDER==PDP_ENDIAN
85-
86-
#error PDP_ENDIAN macros not written yet
87-
88-
#else
89-
90-
#error BYTE_ORDER not defined as anything understood
91-
#endif
92-
#endif
93-
#endif
94-
9560

9661
/* --------------------------------
9762
*pq_sendbyte- append a raw byte to a StringInfo buffer
@@ -183,11 +148,11 @@ pq_sendint(StringInfo buf, int i, int b)
183148
appendBinaryStringInfo(buf, (char*)&n8,1);
184149
break;
185150
case2:
186-
n16=((PG_PROTOCOL_MAJOR(FrontendProtocol)==0) ?hton_s(i) :htons((uint16)i));
151+
n16=htons((uint16)i);
187152
appendBinaryStringInfo(buf, (char*)&n16,2);
188153
break;
189154
case4:
190-
n32=((PG_PROTOCOL_MAJOR(FrontendProtocol)==0) ?hton_l(i) :htonl((uint32)i));
155+
n32=htonl((uint32)i);
191156
appendBinaryStringInfo(buf, (char*)&n32,4);
192157
break;
193158
default:
@@ -261,13 +226,11 @@ pq_getint(int *result, int b)
261226
break;
262227
case2:
263228
status=pq_getbytes((char*)&n16,2);
264-
*result= (int) ((PG_PROTOCOL_MAJOR(FrontendProtocol)==0) ?
265-
ntoh_s(n16) :ntohs(n16));
229+
*result= (int) (ntohs(n16));
266230
break;
267231
case4:
268232
status=pq_getbytes((char*)&n32,4);
269-
*result= (int) ((PG_PROTOCOL_MAJOR(FrontendProtocol)==0) ?
270-
ntoh_l(n32) :ntohl(n32));
233+
*result= (int) (ntohl(n32));
271234
break;
272235
default:
273236

‎src/include/libpq/libpq-be.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $Id: libpq-be.h,v 1.33 2002/08/18 03:03:26 momjian Exp $
14+
* $Id: libpq-be.h,v 1.34 2002/08/29 03:22:01 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -29,17 +29,8 @@
2929
#endif
3030

3131

32-
/* Protocol v0 password packet. */
33-
34-
typedefstructPasswordPacketV0
35-
{
36-
uint32unused;
37-
chardata[288];/* User and password as strings. */
38-
}PasswordPacketV0;
39-
40-
4132
/*
42-
* This is used by the postmaster in its communication with frontends.It is
33+
* This is used by the postmaster in its communication with frontends.It
4334
* contains all state information needed during this communication before the
4435
* backend is run.
4536
*/

‎src/include/libpq/pqcomm.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Id: pqcomm.h,v 1.68 2002/08/27 16:21:51 momjian Exp $
12+
* $Id: pqcomm.h,v 1.69 2002/08/29 03:22:01 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -93,7 +93,7 @@ typedef union SockAddr
9393

9494
/* The earliest and latest frontend/backend protocol version supported. */
9595

96-
#definePG_PROTOCOL_EARLIESTPG_PROTOCOL(0,0)
96+
#definePG_PROTOCOL_EARLIESTPG_PROTOCOL(1,0)
9797
#definePG_PROTOCOL_LATESTPG_PROTOCOL(2,0)
9898

9999
/*
@@ -127,6 +127,9 @@ typedef uint32 PacketLen;
127127

128128
typedefuint32ProtocolVersion;/* Fe/Be protocol version number */
129129

130+
typedefProtocolVersionMsgType;
131+
132+
130133
typedefstructStartupPacket
131134
{
132135
ProtocolVersionprotoVersion;/* Protocol version */
@@ -153,16 +156,6 @@ extern bool Db_user_namespace;
153156
typedefuint32AuthRequest;
154157

155158

156-
/* This next section is to maintain compatibility with protocol v0.0. */
157-
158-
#defineSTARTUP_MSG7/* Initialise a connection */
159-
#defineSTARTUP_KRB4_MSG10/* krb4 session follows */
160-
#defineSTARTUP_KRB5_MSG11/* krb5 session follows */
161-
#defineSTARTUP_PASSWORD_MSG14/* Password follows */
162-
163-
typedefProtocolVersionMsgType;
164-
165-
166159
/* A client can also send a cancel-current-operation request to the postmaster.
167160
* This is uglier than sending it directly to the client's backend, but it
168161
* avoids depending on out-of-band communication facilities.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp