aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-11-23 01:04:38 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-11-23 01:04:38 +0000
commitd831990167e76be8c833d75b6a6a508ebdcf9fde (patch)
tree3c3ebc92505e4ffe75da7269e66e459ab1412378 /src
parent90e0b668a4def471fe4cced06d5ca6605046f828 (diff)
downloadpostgresql-d831990167e76be8c833d75b6a6a508ebdcf9fde.tar.gz
postgresql-d831990167e76be8c833d75b6a6a508ebdcf9fde.zip
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 postmaster panicked :-(
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/password.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c
index 3722d2bd7f5..d18fcca475b 100644
--- a/src/backend/libpq/password.c
+++ b/src/backend/libpq/password.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: password.c,v 1.26 1999/10/23 03:13:21 tgl Exp $
+ * $Id: password.c,v 1.27 1999/11/23 01:04:38 tgl Exp $
*
*/
@@ -45,6 +45,8 @@ verify_password(char *auth_arg, char *user, char *password)
return STATUS_ERROR;
}
+ pfree(pw_file_fullname);
+
while (!feof(pw_file))
{
char pw_file_line[255],
@@ -67,15 +69,12 @@ verify_password(char *auth_arg, char *user, char *password)
if (strcmp(user, test_user) == 0)
{
- /* we're outta here one way or the other. */
+ /* we're outta here one way or the other, so close file */
FreeFile(pw_file);
if (strcmp(crypt(password, test_pw), test_pw) == 0)
{
/* it matched. */
-
- pfree(pw_file_fullname);
-
return STATUS_OK;
}
@@ -85,19 +84,17 @@ verify_password(char *auth_arg, char *user, char *password)
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- pfree(pw_file_fullname);
-
return STATUS_ERROR;
}
}
+ FreeFile(pw_file);
+
snprintf(PQerrormsg, PQERRORMSG_LENGTH,
"verify_password: user '%s' not found in password file.\n",
user);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
- pfree(pw_file_fullname);
-
return STATUS_ERROR;
}