From 8bdea51951cf720d2cfb6d0ea0cbd81e3780704f Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Tue, 4 May 2010 14:45:08 +0000 Subject: [PATCH] Fixed unregistered bug (added by me at RC3 stage): wrong mutex when shutting down security database --- src/jrd/jrd_pwd.h | 5 ++--- src/jrd/pwd.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/jrd/jrd_pwd.h b/src/jrd/jrd_pwd.h index b5059195c4..4f86322d24 100644 --- a/src/jrd/jrd_pwd.h +++ b/src/jrd/jrd_pwd.h @@ -111,9 +111,8 @@ private: static int onShutdown(const int, const int, void*); - static SecurityDatabase instance; - - SecurityDatabase() +public: + SecurityDatabase(Firebird::MemoryPool&) : lookup_db(0), lookup_req(0), counter(0), server_shutdown(false) {} diff --git a/src/jrd/pwd.cpp b/src/jrd/pwd.cpp index e52811888f..313c2635e3 100644 --- a/src/jrd/pwd.cpp +++ b/src/jrd/pwd.cpp @@ -105,12 +105,12 @@ const UCHAR SecurityDatabase::TPB[4] = isc_tpb_wait }; -// Static instance of the database - -SecurityDatabase SecurityDatabase::instance; - #ifndef EMBEDDED namespace { + // Static instance of the database + + GlobalPtr instance; + // Disable attempts to brute-force logins/passwords class FailedLogin { @@ -397,12 +397,12 @@ void SecurityDatabase::prepare() void SecurityDatabase::initialize() { - instance.init(); + instance->init(); } void SecurityDatabase::shutdown() { - instance.fini(); + instance->fini(); } int SecurityDatabase::onShutdown(const int, const int, void* me) @@ -455,7 +455,7 @@ void SecurityDatabase::verifyUser(string& name, // that means the current context must be saved and restored. TEXT pw1[MAX_PASSWORD_LENGTH + 1]; - const bool found = instance.lookupUser(name.c_str(), uid, gid, pw1); + const bool found = instance->lookupUser(name.c_str(), uid, gid, pw1); pw1[MAX_PASSWORD_LENGTH] = 0; string storedHash(pw1, MAX_PASSWORD_LENGTH); storedHash.rtrim();