@@ -149,6 +149,11 @@ class SecurityDatabase : public VSecDb
149149public:
150150 bool lookup (void * inMsg, void * outMsg);
151151
152+ bool test () override
153+ {
154+ return fb_ping (status, &lookup_db) == FB_SUCCESS;
155+ }
156+
152157 // This 2 are needed to satisfy temporarily different calling requirements
153158 static int shutdown (const int , const int , void *)
154159 {
@@ -326,32 +331,20 @@ int SecurityDatabaseServer::authenticate(CheckStatusWrapper* status, IServerBloc
326331 bool found = false ;
327332 char pw1[MAX_LEGACY_PASSWORD_LENGTH + 1 ];
328333 PathName secureDbName;
329- { // reference & mutex scope scope
334+ { // instance scope
330335 // Get database block from cache
331- RefPtr< CachedSecurityDatabase> instance;
336+ CachedSecurityDatabase::Instance instance;
332337 instances->getInstance (iParameter, instance);
333338
334- try
335- {
336- MutexLockGuard g (instance->mutex , FB_FUNCTION);
337-
338- secureDbName = instance->secureDbName ;
339- if (!instance->secDb )
340- instance->secDb = FB_NEW SecurityDatabase (instance->secureDbName );
341-
342- user_name uname; // user name buffer
343- login.copyTo (uname, sizeof uname);
344- user_record user_block; // user record
345- found = instance->secDb ->lookup (uname, &user_block);
346- fb_utils::copy_terminate (pw1, user_block.password , MAX_LEGACY_PASSWORD_LENGTH + 1 );
347- }
348- catch (const Exception&)
349- {
350- instance->close ();
351- throw ;
352- }
339+ secureDbName = instance->secureDbName ;
340+ if (!instance->secDb )
341+ instance->secDb = FB_NEW SecurityDatabase (instance->secureDbName );
353342
354- instance->close ();
343+ user_name uname; // user name buffer
344+ login.copyTo (uname, sizeof uname);
345+ user_record user_block; // user record
346+ found = instance->secDb ->lookup (uname, &user_block);
347+ fb_utils::copy_terminate (pw1, user_block.password , MAX_LEGACY_PASSWORD_LENGTH + 1 );
355348 }
356349 if (!found)
357350 {
0 commit comments