📄 svrauth.cpp
字号:
*m_ListOfIUnknownIteratorCurrent ).wrapped_ptr(); if (!spAuthenticationDBManagerPlugin) { m_spAuthenticationDBManagerResponseRequester->AddPrincipalDone ( HXR_NOINTERFACE, pBufferPrincipalID ); // Must explicitly release this to prevent possible circular // references. m_spAuthenticationDBManagerResponseRequester.Release();// printf("CServerAuthenticator: Exit - AddPrincipal (this auth plugin does not support user management)\n"); return HXR_NOINTERFACE; } spAuthenticationDBManagerPlugin->AddPrincipal ( this, pBufferPrincipalID );// printf("CServerAuthenticator: Exit - AddPrincipal (Success)\n"); return HXR_OK;}STDMETHODIMPCServerAuthenticator::RemovePrincipal( IHXAuthenticationDBManagerResponse* pAuthenticationDBManagerResponseNew, IHXBuffer* pBufferPrincipalID){ if(!pAuthenticationDBManagerResponseNew) { return HXR_UNEXPECTED; } m_spAuthenticationDBManagerResponseRequester = pAuthenticationDBManagerResponseNew; if (m_ListOfIUnknownPlugins.begin() == m_ListOfIUnknownPlugins.end()) { m_spAuthenticationDBManagerResponseRequester->RemovePrincipalDone ( HXR_UNEXPECTED, pBufferPrincipalID ); // Must explicitly release this to prevent possible circular // references. m_spAuthenticationDBManagerResponseRequester.Release(); return HXR_UNEXPECTED; } DECLARE_SMART_POINTER ( IHXAuthenticationDBManager ) spAuthenticationDBManagerPlugin; m_HX_RESULTStatus = HXR_FAIL; m_ListOfIUnknownIteratorCurrent = m_ListOfIUnknownPlugins.begin(); spAuthenticationDBManagerPlugin = ( *m_ListOfIUnknownIteratorCurrent ).wrapped_ptr(); if (!spAuthenticationDBManagerPlugin) { m_spAuthenticationDBManagerResponseRequester->RemovePrincipalDone ( HXR_NOINTERFACE, pBufferPrincipalID ); // Must explicitly release this to prevent possible circular // references. m_spAuthenticationDBManagerResponseRequester.Release(); return HXR_NOINTERFACE; } spAuthenticationDBManagerPlugin->RemovePrincipal ( this, pBufferPrincipalID ); return HXR_OK;}STDMETHODIMPCServerAuthenticator::SetCredentials( IHXAuthenticationDBManagerResponse* pAuthenticationDBManagerResponseNew, IHXBuffer* pBufferPrincipalID, IHXBuffer* pBufferCredentials){ if(!pAuthenticationDBManagerResponseNew) { return HXR_UNEXPECTED; } m_spAuthenticationDBManagerResponseRequester = pAuthenticationDBManagerResponseNew; if (m_ListOfIUnknownPlugins.begin() == m_ListOfIUnknownPlugins.end()) { m_spAuthenticationDBManagerResponseRequester->SetCredentialsDone ( HXR_UNEXPECTED, pBufferPrincipalID ); // Must explicitly release this to prevent possible circular // references. m_spAuthenticationDBManagerResponseRequester.Release(); return HXR_UNEXPECTED; } DECLARE_SMART_POINTER ( IHXAuthenticationDBManager ) spAuthenticationDBManagerPlugin; m_HX_RESULTStatus = HXR_FAIL; m_spBufferCredentials = pBufferCredentials; m_ListOfIUnknownIteratorCurrent = m_ListOfIUnknownPlugins.begin(); spAuthenticationDBManagerPlugin = ( *m_ListOfIUnknownIteratorCurrent ).wrapped_ptr(); if (!spAuthenticationDBManagerPlugin) { m_spAuthenticationDBManagerResponseRequester->SetCredentialsDone ( HXR_NOINTERFACE, pBufferPrincipalID ); // Must explicitly release this to prevent possible circular // references. m_spAuthenticationDBManagerResponseRequester.Release(); return HXR_NOINTERFACE; } spAuthenticationDBManagerPlugin->SetCredentials ( this, pBufferPrincipalID, m_spBufferCredentials ); return HXR_OK;}// IHXAuthenticationDBManagerResponseSTDMETHODIMPCServerAuthenticator::AddPrincipalDone( HX_RESULT ResultStatus, IHXBuffer* pBufferPrincipalID){// printf("CServerAuthenticator: Entered - AddPrincipalDone (Result %lx)\n", ResultStatus); DECLARE_SMART_POINTER ( IHXAuthenticationDBManager ) spAuthenticationDBManagerPlugin; HX_RESULT HX_RESULTRet = HXR_FAIL; if(FAILED(m_HX_RESULTStatus) && ResultStatus != HXR_FAIL) { m_HX_RESULTStatus = ResultStatus; } ++m_ListOfIUnknownIteratorCurrent; if(m_ListOfIUnknownIteratorCurrent != m_ListOfIUnknownPlugins.end()) { // Call Next one..// printf("CServerAuthenticator: Call - AddPrincipal on next plugin in list\n"); spAuthenticationDBManagerPlugin = ( *m_ListOfIUnknownIteratorCurrent ).wrapped_ptr(); spAuthenticationDBManagerPlugin->AddPrincipal ( this, pBufferPrincipalID ); } else { // We are done..// printf("CServerAuthenticator: Call - AddPrincipalDone on response interface (Result: %lx)\n", m_HX_RESULTStatus); m_spAuthenticationDBManagerResponseRequester->AddPrincipalDone ( m_HX_RESULTStatus, pBufferPrincipalID ); } // Must explicitly release this to prevent possible circular references. m_spAuthenticationDBManagerResponseRequester.Release();// printf("CServerAuthenticator: Exit - AddPrincipalDone\n"); return HXR_OK;}STDMETHODIMPCServerAuthenticator::RemovePrincipalDone( HX_RESULT ResultStatus, IHXBuffer* pBufferPrincipalID){ DECLARE_SMART_POINTER ( IHXAuthenticationDBManager ) spAuthenticationDBManagerPlugin; HX_RESULT HX_RESULTRet = HXR_FAIL; if(FAILED(m_HX_RESULTStatus) && ResultStatus != HXR_FAIL) { m_HX_RESULTStatus = ResultStatus; } ++m_ListOfIUnknownIteratorCurrent; if(m_ListOfIUnknownIteratorCurrent != m_ListOfIUnknownPlugins.end()) { // Call Next one.. spAuthenticationDBManagerPlugin = ( *m_ListOfIUnknownIteratorCurrent ).wrapped_ptr(); spAuthenticationDBManagerPlugin->RemovePrincipal ( this, pBufferPrincipalID ); } else { // We are done.. m_spAuthenticationDBManagerResponseRequester->RemovePrincipalDone ( m_HX_RESULTStatus, pBufferPrincipalID ); } // Must explicitly release this to prevent possible circular references. m_spAuthenticationDBManagerResponseRequester.Release(); return HXR_OK;}STDMETHODIMPCServerAuthenticator::SetCredentialsDone( HX_RESULT ResultStatus, IHXBuffer* pBufferPrincipalID){ DECLARE_SMART_POINTER ( IHXAuthenticationDBManager ) spAuthenticationDBManagerPlugin; HX_RESULT HX_RESULTRet = HXR_FAIL; if(FAILED(m_HX_RESULTStatus) && ResultStatus != HXR_FAIL) { m_HX_RESULTStatus = ResultStatus; } ++m_ListOfIUnknownIteratorCurrent; if(m_ListOfIUnknownIteratorCurrent != m_ListOfIUnknownPlugins.end()) { // Call Next one.. spAuthenticationDBManagerPlugin = ( *m_ListOfIUnknownIteratorCurrent ).wrapped_ptr(); spAuthenticationDBManagerPlugin->SetCredentials ( this, pBufferPrincipalID, m_spBufferCredentials ); } else { // We are done.. m_spAuthenticationDBManagerResponseRequester->SetCredentialsDone ( m_HX_RESULTStatus, pBufferPrincipalID ); } // Must explicitly release this to prevent possible circular references. m_spAuthenticationDBManagerResponseRequester.Release(); return HXR_OK;}HX_RESULT CServerAuthenticator::_GetRealmSettings( char* pcharRealm, IHXValues** ppIHXValuesRealmProperties){ if(m_spIUnknownContext.IsValid()) { DECLARE_SMART_POINTER(IHXRegistry) spregRegistry; DECLARE_SMART_POINTER(IHXBuffer) spIHXBufferRealmName; DECLARE_SMART_POINTER(IHXValues) spIHXValuesRealms; spregRegistry = m_spIUnknownContext; if ( FAILED ( spregRegistry->GetPropListByName ( "config.AuthenticationRealms", spIHXValuesRealms.ptr_reference() ) ) ) { return HXR_FAIL; } HX_RESULT HX_RESULTRes; const char* pcharPropertyPath; UINT32 ulProperty_id; HX_RESULTRes = spIHXValuesRealms->GetFirstPropertyULONG32 ( pcharPropertyPath, ulProperty_id ); while(SUCCEEDED(HX_RESULTRes)) { spIHXBufferRealmName.Release(); HX_RESULTRes = _GetPluginDataFromID ( pcharPropertyPath, ulProperty_id, "Realm", &spIHXBufferRealmName, ppIHXValuesRealmProperties ); if(SUCCEEDED(HX_RESULTRes)) {// cout << spIHXBufferRealmName->GetBuffer() << endl; if ( !strcasecmp ( pcharRealm, (char*)spIHXBufferRealmName->GetBuffer() ) ) { return HX_RESULTRes; } } HX_RELEASE(*ppIHXValuesRealmProperties); HX_RESULTRes = spIHXValuesRealms->GetNextPropertyULONG32 ( pcharPropertyPath, ulProperty_id ); } } return HXR_FAIL;}HX_RESULT CServerAuthenticator::_GetFirstPlugin( IHXValues* pIHXValuesPluginList, IHXBuffer** ppIHXBufferPluginName, IHXValues** ppIHXValuesPluginProperties){ if(!m_spIUnknownContext.IsValid()) { return HXR_UNEXPECTED; } const char* pcharPropertyPath = NULL; UINT32 ulProperty_id; HX_RESULT HX_RESULTRes = pIHXValuesPluginList->GetFirstPropertyULONG32 ( pcharPropertyPath, ulProperty_id ); while(SUCCEEDED(HX_RESULTRes)) { HX_RESULTRes = _GetPluginDataFromID ( pcharPropertyPath, ulProperty_id, "PluginID", ppIHXBufferPluginName, ppIHXValuesPluginProperties ); if(FAILED(HX_RESULTRes)) { HX_RESULTRes = pIHXValuesPluginList->GetNextPropertyULONG32 ( pcharPropertyPath, ulProperty_id ); HX_RELEASE(*ppIHXBufferPluginName); HX_RELEASE(*ppIHXValuesPluginProperties); } else { return HX_RESULTRes; } } return HXR_FAIL;}HX_RESULT CServerAuthenticator::_GetPluginDataFromID( const char* pcharPropertyPath, UINT32 ulProperty_id, const char* pcharRealPropertyNameLoc, IHXBuffer** ppIHXBufferPluginName, IHXValues** ppIHXValuesPluginProperties){ DECLARE_SMART_POINTER(IHXRegistry) spregRegistry; const char* pcharPropertyName = NULL; CHXString sPluginIDPath; spregRegistry = m_spIUnknownContext; HXPropType ptCurrent = spregRegistry->GetTypeById ( ulProperty_id );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -