8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 09:20:39 +01:00

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

This commit is contained in:
AlexPeshkoff 2022-10-27 20:15:24 +03:00
parent da523d17f8
commit 07bb38977e
3 changed files with 13 additions and 6 deletions

View File

@ -279,10 +279,10 @@ namespace
PathName file(par->value.ToPathName());
PathUtils::fixupSeparators(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;
}
@ -410,9 +410,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;
PathUtils::fixupSeparators(correctedAlias);

View File

@ -27,6 +27,10 @@
#include "../common/classes/RefCounted.h"
#include "../common/config/config.h"
bool resolveAlias(const Firebird::PathName& alias,
Firebird::PathName& file,
Firebird::RefPtr<const Firebird::Config>* config);
bool expandDatabaseName(Firebird::PathName alias,
Firebird::PathName& file,
Firebird::RefPtr<const Firebird::Config>* config);

View File

@ -65,6 +65,7 @@
#include "../common/StatementMetadata.h"
#include "../common/IntlParametersBlock.h"
#include "../common/status.h"
#include "../common/db_alias.h"
#include "../auth/SecurityDatabase/LegacyClient.h"
#include "../auth/SecureRemotePassword/client/SrpClient.h"
@ -1189,9 +1190,10 @@ IAttachment* RProvider::attach(CheckStatusWrapper* status, const char* filename,
flags |= ANALYZE_LOOPBACK;
PathName expanded_name(filename);
PathName node_name;
resolveAlias(filename, expanded_name, nullptr);
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)
@ -1868,9 +1870,10 @@ Firebird::IAttachment* RProvider::create(CheckStatusWrapper* status, const char*
flags |= ANALYZE_LOOPBACK;
PathName expanded_name(filename);
PathName node_name;
resolveAlias(filename, expanded_name, nullptr);
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)