Beispiel #1
0
void CManagePasswordPolicies::OnEditPpClick( wxCommandEvent& )
{
  int row = GetSelectedRow();
  if (row < 0)
    return;
  wxString policyname = m_PolicyNames->GetCellValue(row, 0);
  PWPolicy st_pp;

  if (row == 0) { // 1st row is default
    st_pp = m_st_default_pp;
  } else {
    PSWDPolicyMapIter mapIter = m_MapPSWDPLC.find(StringX(policyname.c_str()));
    if (row != 0 && mapIter == m_MapPSWDPLC.end()) {
      ASSERT(0);
      return;
    }
    st_pp = mapIter->second;
  }

  CPasswordPolicy ppdlg(this, m_core, m_MapPSWDPLC);

  ppdlg.SetPolicyData(policyname, st_pp);
  if (ppdlg.ShowModal() == wxID_OK) {
    ppdlg.GetPolicyData(policyname, st_pp);
    ASSERT(!policyname.IsEmpty());
    UpdatePolicy(policyname, st_pp, CPP_MODIFIED);
  }
}
void CRTSecMgrSession::DispatchMessageL(const RMessage2& aMessage)
	{
	// First check for session-relative requests
	switch (aMessage.Function ())
		{
		case ESetPolicy:
			SetPolicy (aMessage);
			return;
		case EUpdatePolicy:
			UpdatePolicy (aMessage);
			return;
		case EUnsetPolicy:
			UnsetPolicy (aMessage);
			return;
		case ERegisterScript:
			RegisterScript (aMessage);
			return;
		case ERegisterScriptWithHash:
			RegisterScript (aMessage, ETrue);
			return;
		case EUnRegisterScript:
			UnregisterScript (aMessage);
			return;
		case EGetScriptSession:
			GetScriptSessionL (aMessage);
			return;
		case EGetTrustedUnRegScriptSession:
			GetTrustedUnRegScriptSessionL (aMessage);
			return;
		case ESecServCloseSession:
			CloseSession ();
			return;
			}

	// All other function codes must be subsession relative.
	// We need to find the appropriate server side subsession
	// i.e. the CRTSecMgrSubSession object. 
	// The handle value is passed as the 4th aregument.
	CRTSecMgrSubSession* subSession = SubSessionFromHandle (aMessage,
			aMessage.Int3 ());
	switch (aMessage.Function ())
		{
		case ECloseScriptSession:
			DeleteSubSession (aMessage.Int3 ());
			return;
		case EUpdatePermanentGrant:
			subSession->UpdatePermGrantL (aMessage);
			return;
		case EGetScriptFile:
			subSession->GetScriptFile (aMessage);
			return;
		case EUpdatePermanentGrantProvider:
		    subSession->UpdatePermGrantProviderL (aMessage);
		    return;
		default:
			PanicClient (aMessage, EBadRequest);
			return;
		}
	}
Beispiel #3
0
void CPasswordPolicy::OnOkClick( wxCommandEvent& )
{
  if (m_core.IsReadOnly())
    return;
  if (!UpdatePolicy())
    return;
  EndModal(wxID_OK);
}
void CPolicyHandler::SetTransitionPolicies(TControlPolicy* aPolicies, TInt aNum)
	{
	iPolicies.ResetAndDestroy();
	for(TInt i = 0;i < aNum; i++)
		{
		UpdatePolicy(aPolicies[i].iId, aPolicies[i].iAction, aPolicies[i].iPolicy);
		}
	delete aPolicies;
	}
TPolicyID RSecMgrSession::UpdatePolicy(TPolicyID aPolicyID,
		const TDesC8& aPolicyBuffer)
	{
	TInt ret(ErrInvalidParameters);
	if(0==aPolicyBuffer.CompareC(KNullDesC8))
		{
		return ret;
		}
		
		TFileName tempDirPath;
		TFileName tempPath;
	
		{
		RFs fileSession;
		if ( KErrNone==fileSession.Connect ())
			{
			fileSession.PrivatePath (tempDirPath);
			BaflUtils::EnsurePathExistsL (fileSession, tempDirPath);

			RFile secPolicyFile;
			secPolicyFile.Temp (fileSession, tempDirPath, tempPath, EFileWrite);
			secPolicyFile.Write(aPolicyBuffer);
			secPolicyFile.Close();			
			}		
		fileSession.Close();
		}
		
	RFs fileSession;
	if ( KErrNone==fileSession.Connect ())
		{
		CleanupClosePushL (fileSession);
		if ( KErrNone==fileSession.ShareProtected ())
			{
			RFile secPolicyFile;
					
			if(KErrNone == secPolicyFile.Open(fileSession,tempPath,EFileRead))
				{
				
				ret = UpdatePolicy (aPolicyID, secPolicyFile);
			
				secPolicyFile.Close();
			
				}

			fileSession.Delete (tempPath);
			}
		
		CleanupStack::PopAndDestroy (&fileSession);//fileSession
		}

	fileSession.Close();
	
	return ret;
	}
Beispiel #6
0
void CManagePasswordPolicies::OnNewClick( wxCommandEvent& )
{
  CPasswordPolicy ppdlg(this, m_core, m_MapPSWDPLC);
  PWPolicy st_pp = m_st_default_pp;
  ppdlg.SetPolicyData(wxEmptyString, st_pp);
  if (ppdlg.ShowModal() == wxID_OK) {
    wxString policyname;

    ppdlg.GetPolicyData(policyname, st_pp);
    UpdatePolicy(policyname, st_pp, CPP_ADD);
  }
}