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

Commit6cdba03

Browse files
committed
Fix password code to deal with new quoting code.
1 parent39e77dd commit6cdba03

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

‎src/backend/libpq/crypt.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Header: /cvsroot/pgsql/src/backend/libpq/crypt.c,v 1.45 2002/04/04 04:25:47 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/libpq/crypt.c,v 1.46 2002/04/25 00:56:36 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -31,18 +31,26 @@
3131
int
3232
md5_crypt_verify(constPort*port,constchar*user,constchar*pgpass)
3333
{
34-
char*passwd,
35-
*valuntil,
34+
char*passwd=NULL,
35+
*valuntil=NULL,
3636
*crypt_pwd;
3737
intretval=STATUS_ERROR;
3838
List**line;
39-
39+
List*token;
40+
4041
if ((line=get_user_line(user))==NULL)
4142
returnSTATUS_ERROR;
4243

43-
passwd=lfirst(lnext(lnext(*line)));
44-
valuntil=lfirst(lnext(lnext(lnext(*line))));
45-
44+
/* Skip over line number and username */
45+
token=lnext(lnext(*line));
46+
if (token)
47+
{
48+
passwd=lfirst(token);
49+
token=lnext(token);
50+
if (token)
51+
valuntil=lfirst(token);
52+
}
53+
4654
if (passwd==NULL||*passwd=='\0')
4755
{
4856
if (passwd)
@@ -120,7 +128,7 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
120128
AbsoluteTimevuntil,
121129
current;
122130

123-
if (!valuntil||strcmp(valuntil,"\\N")==0)
131+
if (!valuntil)
124132
vuntil=INVALID_ABSTIME;
125133
else
126134
vuntil=DatumGetAbsoluteTime(DirectFunctionCall1(nabstimein,

‎src/backend/libpq/hba.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.81 2002/04/04 04:25:47 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.82 2002/04/25 00:56:36 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -109,9 +109,6 @@ next_token(FILE *fp, char *buf, const int bufsz)
109109
while (c!=EOF&&c!='\n'&&
110110
(!isblank(c)||in_quote== true))
111111
{
112-
if (c=='"')
113-
in_quote= !in_quote;
114-
115112
/* skip comments to EOL */
116113
if (c=='#'&& !in_quote)
117114
{
@@ -138,11 +135,14 @@ next_token(FILE *fp, char *buf, const int bufsz)
138135
break;
139136

140137
/* Literal double-quote is two double-quotes */
141-
if (c=='"')
138+
if (in_quote&&c=='"')
142139
was_quote= !was_quote;
143140
else
144141
was_quote= false;
145142

143+
if (c=='"')
144+
in_quote= !in_quote;
145+
146146
c=getc(fp);
147147
}
148148

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp