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

Commitd831990

Browse files
committed
verify_password() leaked a file descriptor if it failed to find the given
userid in the flat password file. Do it enough times and the postmasterpanicked :-(
1 parent90e0b66 commitd831990

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

‎src/backend/libpq/password.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 1994, Regents of the University of California
33
*
4-
* $Id: password.c,v 1.26 1999/10/2303:13:21 tgl Exp $
4+
* $Id: password.c,v 1.27 1999/11/2301:04:38 tgl Exp $
55
*
66
*/
77

@@ -45,6 +45,8 @@ verify_password(char *auth_arg, char *user, char *password)
4545
returnSTATUS_ERROR;
4646
}
4747

48+
pfree(pw_file_fullname);
49+
4850
while (!feof(pw_file))
4951
{
5052
charpw_file_line[255],
@@ -67,15 +69,12 @@ verify_password(char *auth_arg, char *user, char *password)
6769

6870
if (strcmp(user,test_user)==0)
6971
{
70-
/* we're outta here one way or the other. */
72+
/* we're outta here one way or the other, so close file */
7173
FreeFile(pw_file);
7274

7375
if (strcmp(crypt(password,test_pw),test_pw)==0)
7476
{
7577
/* it matched. */
76-
77-
pfree(pw_file_fullname);
78-
7978
returnSTATUS_OK;
8079
}
8180

@@ -85,19 +84,17 @@ verify_password(char *auth_arg, char *user, char *password)
8584
fputs(PQerrormsg,stderr);
8685
pqdebug("%s",PQerrormsg);
8786

88-
pfree(pw_file_fullname);
89-
9087
returnSTATUS_ERROR;
9188
}
9289
}
9390

91+
FreeFile(pw_file);
92+
9493
snprintf(PQerrormsg,PQERRORMSG_LENGTH,
9594
"verify_password: user '%s' not found in password file.\n",
9695
user);
9796
fputs(PQerrormsg,stderr);
9897
pqdebug("%s",PQerrormsg);
9998

100-
pfree(pw_file_fullname);
101-
10299
returnSTATUS_ERROR;
103100
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp