Commit 1ff38e1d authored by David Edmundson's avatar David Edmundson
Browse files

Initialise pam response in all converse conditions

This turned out to be an issue for pam_python when sending an info/error
message that shouldn't have a response some code still tried to free the
result of any prompt. Somewhat questionable, but we should still be
returning a valid struct full of nulls.

BUG: 455608
parent 880a5df5
Pipeline #193826 passed with stage
in 4 minutes and 9 seconds
......@@ -61,6 +61,12 @@ int PamWorker::converse(int n, const struct pam_message **msg, struct pam_respon
{
PamWorker *c = static_cast<PamWorker *>(data);
*resp = (struct pam_response *)calloc(n, sizeof(struct pam_response));
if (!*resp) {
return PAM_BUF_ERR;
}
Q_ASSERT(resp);
for (int i = 0; i < n; i++) {
bool isSecret = false;
switch (msg[i]->msg_style) {
......@@ -68,12 +74,6 @@ int PamWorker::converse(int n, const struct pam_message **msg, struct pam_respon
isSecret = true;
Q_FALLTHROUGH();
case PAM_PROMPT_ECHO_ON:
Q_ASSERT(resp);
*resp = (struct pam_response *)calloc(n, sizeof(struct pam_response));
if (!*resp) {
return PAM_BUF_ERR;
}
const QString prompt = QString::fromLocal8Bit(msg[i]->msg);
if (isSecret) {
Q_EMIT c->promptForSecret(prompt);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment