m3 Security Fixes

This commit is contained in:
Mark Gregory
2026-09-17 10:31:34 +01:00
parent c9856d58c1
commit a094477840
6 changed files with 251 additions and 379 deletions
@@ -85,27 +85,7 @@ class userControlController extends Controller
} catch (\Throwable $e) {
// Determine reason for failure.
// Probably database authentication error or invalid or unreachable database.
$code = $e->getCode();
$msg = $e->getMessage();
switch ($code) {
case 8001:
// "Authorization failure on distributed database connection attempt"
// Usually means a wrong DB2 user or password
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
return 'error profile3';
break;
case 42705:
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
return 'error profile4';
break;
default:
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
return 'error profile5';
break;
}
return self::programBridgeConnectionError($e);
}
$conn->setOptions(['persistent' => false, 'stateless' => true, 'debug' => true, 'debugLogFile' => '/www/sentm3test/htdocs/M3/storage/logs/toolkit_debug.log']);
// Add LIB
@@ -343,4 +323,15 @@ class userControlController extends Controller
}
}
private static function programBridgeConnectionError(\Throwable $exception): string
{
$code = (int) $exception->getCode();
return match ($code) {
8001 => 'error profile3',
42705 => 'error profile4',
default => 'error profile5',
};
}
}