1
0
mirror of https://github.com/vrana/adminer.git synced 2025-09-03 19:32:36 +02:00

Fix server URL validation for Oracle connections

Every driver can validate URL host and path by its own rules. Path is forbidden by default, HTTP-based drivers allow only '/' as path and Oracle driver validates path according to the EasyConnect URL format.
This commit is contained in:
Peter Knut
2024-08-13 19:32:36 +02:00
parent bff6f8ca93
commit 43a0305a23
5 changed files with 50 additions and 5 deletions

View File

@@ -167,7 +167,14 @@ if (isset($_GET["oracle"])) {
}
}
/**
* @param string $hostPath
* @return bool
*/
function is_server_host_valid($hostPath) {
// EasyConnect host+path format: host[/[service_name][:server_type][/instance_name]]
return (bool)preg_match('~^[^/]+(/([^/:]+)?(:[^/:]+)?(/[^/:]+)?)?$~', $hostPath);
}
function idf_escape($idf) {
return '"' . str_replace('"', '""', $idf) . '"';