Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
6b52dc74
Commit
6b52dc74
authored
Feb 07, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repair postmaster memory leakage during password authentication.
parent
6aa0821b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
src/backend/libpq/crypt.c
src/backend/libpq/crypt.c
+16
-7
No files found.
src/backend/libpq/crypt.c
View file @
6b52dc74
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Dec 17, 1997 - Todd A. Brandys
* Dec 17, 1997 - Todd A. Brandys
* Orignal Version Completed.
* Orignal Version Completed.
*
*
* $Id: crypt.c,v 1.
29 2000/08/27 21:50:1
8 tgl Exp $
* $Id: crypt.c,v 1.
30 2001/02/07 23:31:3
8 tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -30,8 +30,11 @@
...
@@ -30,8 +30,11 @@
char
**
pwd_cache
=
NULL
;
char
**
pwd_cache
=
NULL
;
int
pwd_cache_count
=
0
;
int
pwd_cache_count
=
0
;
/*-------------------------------------------------------------------------*/
/*
* crypt_getpwdfilename --- get name of password file
*
* Note that result string is palloc'd, and should be freed by the caller.
*/
char
*
char
*
crypt_getpwdfilename
(
void
)
crypt_getpwdfilename
(
void
)
{
{
...
@@ -45,8 +48,11 @@ crypt_getpwdfilename(void)
...
@@ -45,8 +48,11 @@ crypt_getpwdfilename(void)
return
pfnam
;
return
pfnam
;
}
}
/*-------------------------------------------------------------------------*/
/*
* crypt_getpwdreloadfilename --- get name of password-reload-needed flag file
*
* Note that result string is palloc'd, and should be freed by the caller.
*/
char
*
char
*
crypt_getpwdreloadfilename
(
void
)
crypt_getpwdreloadfilename
(
void
)
{
{
...
@@ -58,6 +64,7 @@ crypt_getpwdreloadfilename(void)
...
@@ -58,6 +64,7 @@ crypt_getpwdreloadfilename(void)
bufsize
=
strlen
(
pwdfilename
)
+
strlen
(
CRYPT_PWD_RELOAD_SUFX
)
+
1
;
bufsize
=
strlen
(
pwdfilename
)
+
strlen
(
CRYPT_PWD_RELOAD_SUFX
)
+
1
;
rpfnam
=
(
char
*
)
palloc
(
bufsize
);
rpfnam
=
(
char
*
)
palloc
(
bufsize
);
snprintf
(
rpfnam
,
bufsize
,
"%s%s"
,
pwdfilename
,
CRYPT_PWD_RELOAD_SUFX
);
snprintf
(
rpfnam
,
bufsize
,
"%s%s"
,
pwdfilename
,
CRYPT_PWD_RELOAD_SUFX
);
pfree
(
pwdfilename
);
return
rpfnam
;
return
rpfnam
;
}
}
...
@@ -77,6 +84,8 @@ crypt_openpwdfile(void)
...
@@ -77,6 +84,8 @@ crypt_openpwdfile(void)
fprintf
(
stderr
,
"Couldn't read %s: %s
\n
"
,
fprintf
(
stderr
,
"Couldn't read %s: %s
\n
"
,
filename
,
strerror
(
errno
));
filename
,
strerror
(
errno
));
pfree
(
filename
);
return
pwdfile
;
return
pwdfile
;
}
}
...
@@ -119,7 +128,6 @@ compar_user(const void *user_a, const void *user_b)
...
@@ -119,7 +128,6 @@ compar_user(const void *user_a, const void *user_b)
static
void
static
void
crypt_loadpwdfile
(
void
)
crypt_loadpwdfile
(
void
)
{
{
char
*
filename
;
char
*
filename
;
int
result
;
int
result
;
FILE
*
pwd_file
;
FILE
*
pwd_file
;
...
@@ -127,6 +135,7 @@ crypt_loadpwdfile(void)
...
@@ -127,6 +135,7 @@ crypt_loadpwdfile(void)
filename
=
crypt_getpwdreloadfilename
();
filename
=
crypt_getpwdreloadfilename
();
result
=
unlink
(
filename
);
result
=
unlink
(
filename
);
pfree
(
filename
);
/*
/*
* We want to delete the flag file before reading the contents of the
* We want to delete the flag file before reading the contents of the
...
@@ -134,7 +143,7 @@ crypt_loadpwdfile(void)
...
@@ -134,7 +143,7 @@ crypt_loadpwdfile(void)
* successful. This means that a backend performed a COPY of the
* successful. This means that a backend performed a COPY of the
* pg_shadow file to pg_pwd. Therefore we must now do a reload.
* pg_shadow file to pg_pwd. Therefore we must now do a reload.
*/
*/
if
(
!
pwd_cache
||
!
result
)
if
(
!
pwd_cache
||
result
==
0
)
{
{
if
(
pwd_cache
)
if
(
pwd_cache
)
{
/* free the old data only if this is a
{
/* free the old data only if this is a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment