diff --git a/workstation-setup/src/ProvisioningBackend.cpp b/workstation-setup/src/ProvisioningBackend.cpp index 0902b4c..5b74eea 100644 --- a/workstation-setup/src/ProvisioningBackend.cpp +++ b/workstation-setup/src/ProvisioningBackend.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -501,12 +502,22 @@ void ProvisioningBackend::startHelper(Operation operation, message = safeMessageForFailure(operation, exitCode, combinedOutput, timedOut); } + QString helperToken = QString::fromUtf8(combinedOutput).trimmed(); + helperToken.remove(QRegularExpression(QStringLiteral("[^A-Za-z0-9_\\-]"))); + if (helperToken.size() > 80) { + helperToken.truncate(80); + } + if (helperToken.isEmpty()) { + helperToken = QStringLiteral("none"); + } + appendLog(operationName(operation) - + QStringLiteral(" helper finished exitCode=%1 normalExit=%2 timeout=%3 marker=%4") + + QStringLiteral(" helper finished exitCode=%1 normalExit=%2 timeout=%3 marker=%4 token=%5") .arg(exitCode) .arg(exitStatus == QProcess::NormalExit ? QStringLiteral("yes") : QStringLiteral("no")) .arg(timedOut ? QStringLiteral("yes") : QStringLiteral("no")) - .arg(markerCreated ? QStringLiteral("yes") : QStringLiteral("no"))); + .arg(markerCreated ? QStringLiteral("yes") : QStringLiteral("no")) + .arg(helperToken)); secureClear(stderrData); secureClear(stdoutData); @@ -537,14 +548,27 @@ QString ProvisioningBackend::safeMessageForFailure(Operation operation, if (timedOut || exitCode == 124 || output.contains(QStringLiteral("timeout"))) { if (operation == Operation::Password) { - return QStringLiteral("Le changement de mot de passe n'a pas reçu la réponse attendue du système. Réessayez et, si le problème persiste, contactez le service informatique."); + if (output.contains(QStringLiteral("timeout_current_prompt"))) { + return QStringLiteral("Le système n'a pas présenté l'invite d'authentification du mot de passe actuel."); + } + if (output.contains(QStringLiteral("timeout_new_prompt"))) { + return QStringLiteral("Le mot de passe actuel a été envoyé, mais le système n'a pas demandé le nouveau mot de passe."); + } + if (output.contains(QStringLiteral("timeout_confirm_prompt"))) { + return QStringLiteral("Le nouveau mot de passe a été envoyé, mais le système n'a pas demandé sa confirmation."); + } + if (output.contains(QStringLiteral("timeout_finish"))) { + return QStringLiteral("Le système a reçu les mots de passe mais n'a pas terminé l'opération."); + } + return QStringLiteral("Le changement de mot de passe a expiré avant la fin de l'opération."); } return QStringLiteral("L'opération YubiKey a expiré. Vérifiez que la clé est connectée puis réessayez."); } if (operation == Operation::Password) { if (output.contains(QStringLiteral("current_rejected")) - || output.contains(QStringLiteral("current_prompt_missing"))) { + || output.contains(QStringLiteral("current_prompt_missing")) + || output.contains(QStringLiteral("current_reprompt"))) { return QStringLiteral("Le mot de passe temporaire actuel est incorrect ou n'a pas pu être vérifié."); } if (output.contains(QStringLiteral("new_rejected"))) {