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

Fixed CORE-6362: Better diagnostic when 'Missing security context'

This commit is contained in:
AlexPeshkoff 2020-07-15 19:11:41 +03:00
parent 23accd03d1
commit c932ec8159

View File

@ -1520,6 +1520,45 @@ ULONG Mapping::mapUser(string& name, string& trustedRole)
{
if (flags & MAP_THROW_NOT_FOUND)
{
NoCaseString msg = "Missing security context required for ";
if (mainDb)
msg += mainDb;
if (mainDb && securityAlias)
msg += " or ";
if (securityAlias)
msg += secExpanded.c_str();
msg += "\n\tAvailable context(s): ";
bool fstCtx = true;
for (AuthReader scan(newBlock); scan.getInfo(info); scan.moveNext())
{
if (info.type == NM_USER || info.type == NM_ROLE)
{
if (!fstCtx)
msg += "\n\t\t";
else
fstCtx = false;
msg += info.type;
msg += ' ';
msg += info.name;
if (info.secDb.hasData())
{
msg += " in ";
msg += info.secDb;
}
if (info.plugin.hasData())
{
msg += " plugin ";
msg += info.plugin;
}
}
}
if (fstCtx)
msg += "<none>";
gds__log("%s", msg.c_str());
Arg::Gds v(isc_sec_context);
v << (errorMessagesContext ? errorMessagesContext : mainAlias ? mainAlias : "<unknown object>");
if (rc & MAP_DOWN)