Skip to content

Commit

Permalink
Fixed bug CORE-2729 : Current connection may be used by EXECUTE STATE…
Browse files Browse the repository at this point in the history
…MENT instead of creation of new attachment
  • Loading branch information
hvlad committed Nov 4, 2009
1 parent 05e8b66 commit b18ffff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/jrd/extds/InternalDS.cpp
Expand Up @@ -121,6 +121,7 @@ void InternalConnection::attach(thread_db* tdbb, const Firebird::string& dbName,

Jrd::Attachment* attachment = tdbb->getAttachment();
if ((user.isEmpty() || user == attachment->att_user->usr_user_name) &&
pwd.isEmpty() &&
(role.isEmpty() || role == attachment->att_user->usr_sql_role_name))
{
m_isCurrent = true;
Expand Down Expand Up @@ -208,8 +209,14 @@ bool InternalConnection::isSameDatabase(thread_db* tdbb, const Firebird::string&
const Firebird::string& user, const Firebird::string& pwd,
const Firebird::string& role) const
{
const UserId *attUser = m_attachment->att_user;

if (m_isCurrent)
return (tdbb->getAttachment() == m_attachment);
{
return ((user.isEmpty() || user == attUser->usr_user_name) &&
pwd.isEmpty() &&
(role.isEmpty() || role == attUser->usr_sql_role_name));
}

return Connection::isSameDatabase(tdbb, dbName, user, pwd, role);
}
Expand Down

0 comments on commit b18ffff

Please sign in to comment.