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

Commit9cb5518

Browse files
committed
Clean up error message reported after \password encryption failure.
Experimenting with FIPS mode enabled, I sawregression=# \password joeEnter new password for user "joe":Enter it again:could not encrypt password: disabled for FIPSout of memorybecause PQencryptPasswordConn was still of the opinion that "out ofmemory" is always appropriate to print.Minor oversight inb69aba7. Like that one, back-patch to v14.
1 parent790fbda commit9cb5518

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/interfaces/libpq/fe-auth.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,10 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
12901290
if (strcmp(algorithm,"scram-sha-256")==0)
12911291
{
12921292
crypt_pwd=pg_fe_scram_build_secret(passwd);
1293+
/* We assume the only possible failure is OOM */
1294+
if (!crypt_pwd)
1295+
appendPQExpBufferStr(&conn->errorMessage,
1296+
libpq_gettext("out of memory\n"));
12931297
}
12941298
elseif (strcmp(algorithm,"md5")==0)
12951299
{
@@ -1307,6 +1311,9 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
13071311
crypt_pwd=NULL;
13081312
}
13091313
}
1314+
else
1315+
appendPQExpBufferStr(&conn->errorMessage,
1316+
libpq_gettext("out of memory\n"));
13101317
}
13111318
else
13121319
{
@@ -1316,9 +1323,5 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
13161323
returnNULL;
13171324
}
13181325

1319-
if (!crypt_pwd)
1320-
appendPQExpBufferStr(&conn->errorMessage,
1321-
libpq_gettext("out of memory\n"));
1322-
13231326
returncrypt_pwd;
13241327
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp