mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Don't putenv() a string that is allocated in a context that will go away
soon. I suspect this explains bug #3902, though I'm still not able to reproduce that.
This commit is contained in:
parent
65b39ec347
commit
b58d8c9a53
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.162 2008/01/01 19:45:49 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.163 2008/01/30 04:11:19 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -384,7 +384,6 @@ pg_GSS_recvauth(Port *port)
|
|||||||
min_stat,
|
min_stat,
|
||||||
lmin_s,
|
lmin_s,
|
||||||
gflags;
|
gflags;
|
||||||
char *kt_path;
|
|
||||||
int mtype;
|
int mtype;
|
||||||
int ret;
|
int ret;
|
||||||
StringInfoData buf;
|
StringInfoData buf;
|
||||||
@ -398,11 +397,19 @@ pg_GSS_recvauth(Port *port)
|
|||||||
* setenv("KRB5_KTNAME", pg_krb_server_keyfile, 0); except setenv()
|
* setenv("KRB5_KTNAME", pg_krb_server_keyfile, 0); except setenv()
|
||||||
* not always available.
|
* not always available.
|
||||||
*/
|
*/
|
||||||
if (!getenv("KRB5_KTNAME"))
|
if (getenv("KRB5_KTNAME") == NULL)
|
||||||
{
|
{
|
||||||
kt_path = palloc(MAXPGPATH + 13);
|
size_t kt_len = strlen(pg_krb_server_keyfile) + 14;
|
||||||
snprintf(kt_path, MAXPGPATH + 13,
|
char *kt_path = malloc(kt_len);
|
||||||
"KRB5_KTNAME=%s", pg_krb_server_keyfile);
|
|
||||||
|
if (!kt_path)
|
||||||
|
{
|
||||||
|
ereport(LOG,
|
||||||
|
(errcode(ERRCODE_OUT_OF_MEMORY),
|
||||||
|
errmsg("out of memory")));
|
||||||
|
return STATUS_ERROR;
|
||||||
|
}
|
||||||
|
snprintf(kt_path, kt_len, "KRB5_KTNAME=%s", pg_krb_server_keyfile);
|
||||||
putenv(kt_path);
|
putenv(kt_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user