From a965ee09958cbe5a23af38d949846cb43a36d9f0 Mon Sep 17 00:00:00 2001 From: Alex Peshkoff Date: Thu, 2 Aug 2018 19:01:20 +0300 Subject: [PATCH] Fixed CORE-5884: Initial global mapping from srp plugin does not work --- src/jrd/Mapping.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/jrd/Mapping.cpp b/src/jrd/Mapping.cpp index e0dbd3ff8b..007b33e421 100644 --- a/src/jrd/Mapping.cpp +++ b/src/jrd/Mapping.cpp @@ -564,7 +564,7 @@ void locate(RefPtr& cache, const NoCaseString& alias, const NoCa class Found { public: - enum What {FND_NOTHING, FND_SEC, FND_DB}; + enum What {FND_NOTHING, FND_PLUG, FND_SEC, FND_DB}; Found() : found(FND_NOTHING) @@ -572,8 +572,13 @@ public: void set(What find, const AuthReader::Info& val) { + fb_assert(find != FND_NOTHING); + + if (val.plugin.hasData()) + find = FND_PLUG; if (find == found && value != val.name) Arg::Gds(isc_map_undefined).raise(); + if (find > found) { found = find; @@ -1316,17 +1321,23 @@ void Mapping::setInternalFlags() if (!securityAlias) internalFlags |= FLAG_SEC; - // detect presence of this databases mapping in authBlock + // detect presence of non-plugin databases mapping in authBlock // in that case mapUser was already invoked for it if (authBlock) { AuthReader::Info info; for (AuthReader rdr(*authBlock); rdr.getInfo(info); rdr.moveNext()) { - if (mainDb && info.secDb == mainDb) - internalFlags |= FLAG_DB; - if (securityAlias && info.secDb == secExpanded.c_str()) - internalFlags |= FLAG_SEC; + MAP_DEBUG(fprintf(stderr, "info.plugin=%s info.secDb=%s db=%s securityDb=%s\n", + info.plugin.c_str(), info.secDb.c_str(), mainDb ? mainDb : "NULL", secExpanded.c_str())); + + if (info.plugin.isEmpty()) + { + if (mainDb && info.secDb == mainDb) + internalFlags |= FLAG_DB; + if (securityAlias && info.secDb == secExpanded.c_str()) + internalFlags |= FLAG_SEC; + } } } }