8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:43:03 +01:00

Fixed #7365: Client side aliases do not work in databases.conf

(cherry picked from commit 07bb38977e)
(cherry picked from commit 3119592223)
This commit is contained in:
AlexPeshkoff 2022-10-27 20:15:24 +03:00
parent 0e990acb86
commit 68aed134d2
3 changed files with 13 additions and 6 deletions

View File

@ -285,10 +285,10 @@ namespace
PathName file(par->value.ToPathName());
replace_dir_sep(file);
if (PathUtils::isRelative(file))
if (PathUtils::isRelative(file) && !ISC_check_if_remote(file, false))
{
gds__log("Value %s configured for alias %s "
"is not a fully qualified path name, ignored",
"is not a fully qualified path name nor remote server reference, ignored",
file.c_str(), par->name.c_str());
continue;
}
@ -416,9 +416,9 @@ static inline bool hasSeparator(const PathName& name)
return false;
}
// Search for 'alias' in databases.conf, return its value in 'file' if found. Else set file to alias.
// Search for 'alias' in databases.conf, return its value in 'file' if found.
// Returns true if alias is found in databases.conf.
static bool resolveAlias(const PathName& alias, PathName& file, RefPtr<const Config>* config)
bool resolveAlias(const PathName& alias, PathName& file, RefPtr<const Config>* config)
{
PathName correctedAlias = alias;
replace_dir_sep(correctedAlias);

View File

@ -28,6 +28,10 @@
class Config;
bool resolveAlias(const Firebird::PathName& alias,
Firebird::PathName& file,
Firebird::RefPtr<const Config>* config);
bool expandDatabaseName(Firebird::PathName alias,
Firebird::PathName& file,
Firebird::RefPtr<const Config>* config);

View File

@ -63,6 +63,7 @@
#include "firebird/Interface.h"
#include "../common/StatementMetadata.h"
#include "../common/IntlParametersBlock.h"
#include "../common/db_alias.h"
#include "../auth/SecurityDatabase/LegacyClient.h"
#include "../auth/SecureRemotePassword/client/SrpClient.h"
@ -844,9 +845,10 @@ IAttachment* RProvider::attach(CheckStatusWrapper* status, const char* filename,
flags |= ANALYZE_LOOPBACK;
PathName expanded_name(filename);
PathName node_name;
resolveAlias(filename, expanded_name, NULL);
ClntAuthBlock cBlock(&expanded_name, &newDpb, &dpbParam);
PathName node_name;
rem_port* port = analyze(cBlock, expanded_name, flags, newDpb, dpbParam, node_name, NULL, cryptCallback);
if (!port)
@ -1466,9 +1468,10 @@ Firebird::IAttachment* RProvider::create(CheckStatusWrapper* status, const char*
flags |= ANALYZE_LOOPBACK;
PathName expanded_name(filename);
PathName node_name;
resolveAlias(filename, expanded_name, NULL);
ClntAuthBlock cBlock(&expanded_name, &newDpb, &dpbParam);
PathName node_name;
rem_port* port = analyze(cBlock, expanded_name, flags, newDpb, dpbParam, node_name, NULL, cryptCallback);
if (!port)