Files
Rodrigo Cortés Cano a9b561506d doveadm: accept valid results with stderr warnings (#1121)
When using dovecot: passwords, and calling the doveadm binary,, ignore stderr as long as the exit code is 0.
Switch _pacrypt_dovecot() to use the Exec class (instead of calling proc_popen directly).

fixes #1119

thanks @TrapoSAMA
2026-08-22 15:07:33 +01:00

27 lines
660 B
PHP

<?php
$method_index = array_search('-s', $argv, true);
$method = $method_index === false ? '' : ($argv[$method_index + 1] ?? '');
$test_index = array_search('-t', $argv, true);
$stored_password = $test_index === false ? '' : ($argv[$test_index + 1] ?? '');
stream_get_contents(STDIN);
if ($method === 'FIXTUREEMPTY') {
exit(0);
}
if ($method === 'FIXTUREINVALID') {
echo "not a password hash\n";
exit(0);
}
$password = empty($stored_password) ? "{{$method}}fixture-hash" : "$stored_password (verified)";
echo "$password\n";
if ($method === 'FIXTUREWARN') {
fwrite(STDERR, "fixture warning\n");
}
exit($method === 'FIXTUREFAIL' ? 1 : 0);