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

Appearance settings

Commit 9cb5518

Browse filesBrowse files
committed
Clean up error message reported after \password encryption failure.
Experimenting with FIPS mode enabled, I saw regression=# \password joe Enter new password for user "joe": Enter it again: could not encrypt password: disabled for FIPS out of memory because PQencryptPasswordConn was still of the opinion that "out of memory" is always appropriate to print. Minor oversight in b69aba7. Like that one, back-patch to v14.
1 parent 790fbda commit 9cb5518
Copy full SHA for 9cb5518

File tree

Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed

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

Copy file name to clipboardExpand all lines: src/interfaces/libpq/fe-auth.c
+7-4Lines 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
else if (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
return NULL;
13171324
}
13181325

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.