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

Commitab27df2

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 parent3a0cced commitab27df2

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
@@ -1265,6 +1265,10 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
12651265
if (strcmp(algorithm,"scram-sha-256")==0)
12661266
{
12671267
crypt_pwd=pg_fe_scram_build_secret(passwd);
1268+
/* We assume the only possible failure is OOM */
1269+
if (!crypt_pwd)
1270+
appendPQExpBufferStr(&conn->errorMessage,
1271+
libpq_gettext("out of memory\n"));
12681272
}
12691273
elseif (strcmp(algorithm,"md5")==0)
12701274
{
@@ -1282,6 +1286,9 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
12821286
crypt_pwd=NULL;
12831287
}
12841288
}
1289+
else
1290+
appendPQExpBufferStr(&conn->errorMessage,
1291+
libpq_gettext("out of memory\n"));
12851292
}
12861293
else
12871294
{
@@ -1291,9 +1298,5 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
12911298
returnNULL;
12921299
}
12931300

1294-
if (!crypt_pwd)
1295-
appendPQExpBufferStr(&conn->errorMessage,
1296-
libpq_gettext("out of memory\n"));
1297-
12981301
returncrypt_pwd;
12991302
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp