Esempio n. 1
0
bool 
UserManager::Logout( User *pUser, SsapiResponder *pResponder ){
	
	pUser->BuildYourselfFromYourValueSet();

	DesignatorId		id =  pUser->GetDesignatorId();
	User				*pManagedObject = (User *)GetManagedObject( &id );
	U32					rc;
	ValueSet			*pReturnSet = new ValueSet;

	if( pManagedObject ){
		rc = SSAPI_RC_SUCCESS;
		pManagedObject->DeleteOpenSession( pResponder->GetSessionID() );
		//TBDGAI if we want to show who is present, we need an event here
	}
	else
		rc = SSAPI_EXCEPTION_SECURITY;

	ValueSet	*pRc = new ValueSet;
	pRc->AddInt(rc, SSAPI_RETURN_STATUS );
	if( rc != SSAPI_RC_SUCCESS )
		pRc->AddInt( CTS_SSAPI_USER_WAS_NOT_LOGGED_IN, SSAPI_EXCEPTION_STRING_ID );
	pReturnSet->AddValue( pRc, SSAPI_RETURN_STATUS_SET );

	pResponder->Respond( pReturnSet, TRUE );

	// username as a parameter
	LogEvent( CTS_SSAPI_EVENT_USER_LOGGED_OUT, pManagedObject->GetUserName() );

	delete pReturnSet;
	delete pRc;
	return true;
}
Esempio n. 2
0
STATUS 
UserManager::UpdateWrongLoginCountCallback( void *pContext, STATUS status ){

	UPDATE_INVALID_LOGIN_CELL	*pCell = (UPDATE_INVALID_LOGIN_CELL *)pContext;
	User						*pUser = (User *)GetManagedObject( &pCell->userId );
	ValueSet					*pRc = new ValueSet, *pReturnSet = new ValueSet;

	if( pUser ){
		if( !pCell->numberOfWrongLogins ){
			pUser->AddOpenSession( pCell->pResponder->GetSessionID() );
			pUser->BuildYourValueSet();
			pRc->AddInt( SSAPI_RC_SUCCESS, SSAPI_RETURN_STATUS );
			pReturnSet->AddValue( pUser, SSAPI_USER_MANAGER_LOGIN_USER_OBJECT );
			pReturnSet->AddValue( pRc, SSAPI_RETURN_STATUS_SET );
			pCell->pResponder->Respond( pReturnSet, TRUE );
		}
		else
			pCell->pResponder->RespondToRequest( SSAPI_EXCEPTION_SECURITY, CTS_SSAPI_USERNAME_PASSWORD_INVALID );
		
		pUser->SetNumberOfWrongLogins( pCell->numberOfWrongLogins );

		delete pRc;
		delete pReturnSet;
	}

	SetIsReadyToServiceRequests( true );
	delete pCell;
	return OK;
}
bool 
StatusReporterInterface::BuildYourValueSet( ValueSet &vs ){

	int		rc = 1;

	rc &= vs.AddInt( m_state, SSAPI_OBJECT_FID_STATE );
	rc &= vs.AddU32( m_stateString, SSAPI_OBJECT_FID_STATE_STRING );

	return rc? true : false;
}