From: <ale...@us...> - 2013-10-28 10:27:43
|
Revision: 58728 http://sourceforge.net/p/firebird/code/58728 Author: alexpeshkoff Date: 2013-10-28 10:27:40 +0000 (Mon, 28 Oct 2013) Log Message: ----------- Convert legacy auth server to non-builtin plugin on posix Modified Paths: -------------- firebird/trunk/builds/posix/Makefile.in firebird/trunk/builds/posix/make.shared.variables firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp firebird/trunk/src/remote/server/os/posix/inet_server.cpp firebird/trunk/src/yvalve/MasterImplementation.cpp firebird/trunk/src/yvalve/MasterImplementation.h firebird/trunk/src/yvalve/PluginManager.cpp Modified: firebird/trunk/builds/posix/Makefile.in =================================================================== --- firebird/trunk/builds/posix/Makefile.in 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/builds/posix/Makefile.in 2013-10-28 10:27:40 UTC (rev 58728) @@ -411,9 +411,10 @@ # plugins - some of them are required to build examples, use separate entry for them # -.PHONY: udr legacy_user_management trace auth_debug +.PHONY: udr legacy_user_management legacy_auth_server trace auth_debug UDR_PLUGIN = $(call makePluginName,udr_engine) LEGACY_USER_MANAGER = $(call makePluginName,Legacy_UserManager) +LEGACY_AUTH_SERVER = $(call makePluginName,Legacy_Auth) SRP_USER_MANAGER = $(call makePluginName,Srp) FBTRACE = $(call makePluginName,fbtrace) AUTH_DEBUGGER = $(call makePluginName,Auth_Debug) @@ -423,7 +424,7 @@ BUILD_DEBUG:=auth_debug endif -plugins: udr legacy_user_management srp_user_management trace $(BUILD_DEBUG) +plugins: udr legacy_user_management legacy_auth_server srp_user_management trace $(BUILD_DEBUG) udr: $(UDR_PLUGIN) $(PLUGINS)/udr_engine.conf @@ -438,6 +439,11 @@ $(LEGACY_USER_MANAGER): $(LEGACY_USERS_MANAGE_Objects) $(COMMON_LIB) $(LINK_PLUGIN) $(call LIB_LINK_SONAME,$(notdir $@).0) -o $@ $^ $(LINK_PLUG_LIBS) $(FIREBIRD_LIBRARY_LINK) +legacy_auth_server: $(LEGACY_AUTH_SERVER) + +$(LEGACY_AUTH_SERVER): $(LEGACY_AUTH_SERVER_Objects) $(COMMON_LIB) + $(LINK_PLUGIN) $(call LIB_LINK_SONAME,$(notdir $@).0) -o $@ $^ $(LINK_PLUG_LIBS) $(FIREBIRD_LIBRARY_LINK) + trace: $(FBTRACE) $(FBTRACE): $(FBTRACE_UTIL_Objects) $(COMMON_LIB) Modified: firebird/trunk/builds/posix/make.shared.variables =================================================================== --- firebird/trunk/builds/posix/make.shared.variables 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/builds/posix/make.shared.variables 2013-10-28 10:27:40 UTC (rev 58728) @@ -53,9 +53,7 @@ # Remote Remote_Common:= $(call dirObjects,remote) $(call dirObjects,auth/SecureRemotePassword) -Remote_Server:= $(call dirObjects,remote/server) $(call dirObjects,auth/SecureRemotePassword/server) \ - $(call makeObjects,auth/SecurityDatabase,LegacyServer.cpp) - # legacy security database LegacyServer.cpp should become plugin soon +Remote_Server:= $(call dirObjects,remote/server) $(call dirObjects,auth/SecureRemotePassword/server) Remote_Client:= $(call dirObjects,remote/client) $(call dirObjects,auth/SecureRemotePassword/client) \ $(call makeObjects,auth/SecurityDatabase,LegacyClient.cpp) \ $(call dirObjects,plugins/crypt/arc4) @@ -171,6 +169,12 @@ AllObjects += $(LEGACY_USERS_MANAGE_Objects) +# Legacy authentication on server +LEGACY_AUTH_SERVER_Objects:= $(call makeObjects,auth/SecurityDatabase,LegacyServer.cpp) + +AllObjects += $(LEGACY_AUTH_SERVER_Objects) + + # SRP-based users management in security database SRP_USERS_MANAGE_Objects:= $(call dirObjects,auth/SecureRemotePassword/manage) \ $(call dirObjects,auth/SecureRemotePassword) Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2013-10-28 10:27:40 UTC (rev 58728) @@ -44,6 +44,10 @@ #include "../common/classes/ImplementHelper.h" #include "firebird/Timer.h" +#ifndef WIN_NT +#define PLUG_MODULE 1 +#endif + using namespace Firebird; namespace { @@ -128,8 +132,18 @@ public: int verify(IWriter* authBlock, IServerBlock* sBlock); - static int shutdown(const int, const int, void*); + // This 2 are needed to satisfy temporarily different calling requirements + static int shutdown(const int, const int, void*) + { + return shutdown(); + } + static void cleanup() + { + shutdown(); + } + static int shutdown(); + char secureDbName[MAXPATHLEN]; SecurityDatabase() @@ -246,7 +260,9 @@ return; } +#ifndef PLUG_MODULE fb_shutdown_callback(status, shutdown, fb_shut_preproviders, 0); +#endif lookup_db = lookup_req = 0; @@ -417,7 +433,7 @@ } } -int SecurityDatabase::shutdown(const int, const int, void*) +int SecurityDatabase::shutdown() { try { @@ -427,6 +443,7 @@ { if (curInstances[i]) { + TimerInterfacePtr()->stop(curInstances[i]); curInstances[i]->release(); curInstances[i] = NULL; } @@ -530,3 +547,17 @@ } } // namespace Auth + + +#ifdef PLUG_MODULE + +extern "C" void FB_DLL_EXPORT FB_PLUGIN_ENTRY_POINT(IMaster* master) +{ + CachedMasterInterface::set(master); + + myModule->setCleanup(Auth::SecurityDatabase::cleanup); + Auth::registerLegacyServer(PluginManagerInterfacePtr()); + myModule->registerMe(); +} + +#endif // PLUG_MODULE Modified: firebird/trunk/src/remote/server/os/posix/inet_server.cpp =================================================================== --- firebird/trunk/src/remote/server/os/posix/inet_server.cpp 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/src/remote/server/os/posix/inet_server.cpp 2013-10-28 10:27:40 UTC (rev 58728) @@ -385,11 +385,7 @@ { // scope for interface ptr Firebird::PluginManagerInterfacePtr pi; - Auth::registerLegacyServer(pi); Auth::registerSrpServer(pi); -#ifdef TRUSTED_AUTH - Auth::registerTrustedServer(pi); -#endif } if (super) Modified: firebird/trunk/src/yvalve/MasterImplementation.cpp =================================================================== --- firebird/trunk/src/yvalve/MasterImplementation.cpp 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/src/yvalve/MasterImplementation.cpp 2013-10-28 10:27:40 UTC (rev 58728) @@ -457,7 +457,7 @@ return allStrings->alloc(s, len, (ThreadId) thr); } -} // namespace Firebird +} // namespace Why // @@ -468,7 +468,12 @@ namespace { +// Protects timerQueue array GlobalPtr<Mutex> timerAccess; +// Protects from races during module unload process +// Should be taken before timerAccess +GlobalPtr<Mutex> timerPause; + GlobalPtr<Semaphore> timerWakeup; // Should use atomic flag for thread stop to provide correct membar AtomicCounter stopTimerThread(0); @@ -547,6 +552,7 @@ TimerDelay microSeconds = 0; { + MutexLockGuard pauseGuard(timerPause, FB_FUNCTION); MutexLockGuard guard(timerAccess, FB_FUNCTION); const TimerDelay cur = curTime(); @@ -653,6 +659,11 @@ timerHolder.cleanup(); } +Mutex& pauseTimer() +{ + return timerPause; +} + } // namespace Why Modified: firebird/trunk/src/yvalve/MasterImplementation.h =================================================================== --- firebird/trunk/src/yvalve/MasterImplementation.h 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/src/yvalve/MasterImplementation.h 2013-10-28 10:27:40 UTC (rev 58728) @@ -34,6 +34,11 @@ #include "../yvalve/YObjects.h" #include "../common/classes/ImplementHelper.h" +namespace Firebird +{ + class Mutex; +} + namespace Why { class Dtc : public Firebird::AutoIface<Firebird::IDtc, FB_DTC_VERSION> @@ -73,6 +78,8 @@ void shutdownTimers(); void releaseUpgradeTabs(Firebird::IPluginModule* module); + + Firebird::Mutex& pauseTimer(); } // namespace Why #endif // YVALVE_MASTER_IMPLEMENTATION_H Modified: firebird/trunk/src/yvalve/PluginManager.cpp =================================================================== --- firebird/trunk/src/yvalve/PluginManager.cpp 2013-10-27 14:36:12 UTC (rev 58727) +++ firebird/trunk/src/yvalve/PluginManager.cpp 2013-10-28 10:27:40 UTC (rev 58728) @@ -353,6 +353,9 @@ if (cleanup) { + // Pause timer thread for cleanup period + MutexLockGuard timerPause(Why::pauseTimer(), FB_FUNCTION); + cleanup->doClean(); Why::releaseUpgradeTabs(cleanup); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |