Exemple #1
0
void wxDebugReport::AddAll(Context context)
{
#if wxUSE_STACKWALKER
    AddContext(context);
#endif // wxUSE_STACKWALKER

#if wxUSE_CRASHREPORT
    AddDump(context);
#endif // wxUSE_CRASHREPORT

#if !wxUSE_STACKWALKER && !wxUSE_CRASHREPORT
    wxUnusedVar(context);
#endif
}
Exemple #2
0
int CSSLContext::AddServerContext(int iVerifyMode, LPCTSTR lpszPemCertFile, LPCTSTR lpszPemKeyFile, LPCTSTR lpszKeyPasswod, LPCTSTR lpszCAPemCertFileOrPath)
{
	ASSERT(IsValid());

	if(!IsValid())
	{
		::SetLastError(ERROR_INVALID_STATE);
		return FALSE;
	}

	if(m_enSessionMode != SSL_SM_SERVER)
	{
		::SetLastError(ERROR_INVALID_OPERATION);
		return FALSE;
	}

	return AddContext(iVerifyMode, lpszPemCertFile, lpszPemKeyFile, lpszKeyPasswod, lpszCAPemCertFileOrPath);
}
Exemple #3
0
BOOL CSSLContext::Initialize(EnSSLSessionMode enSessionMode, int iVerifyMode, LPCTSTR lpszPemCertFile, LPCTSTR lpszPemKeyFile, LPCTSTR lpszKeyPasswod, LPCTSTR lpszCAPemCertFileOrPath, HP_Fn_SNI_ServerNameCallback fnServerNameCallback)
{
	ASSERT(!IsValid());

	if(IsValid())
	{
		::SetLastError(ERROR_INVALID_STATE);
		return FALSE;
	}

	m_enSessionMode	= enSessionMode;

	if(AddContext(iVerifyMode, lpszPemCertFile, lpszPemKeyFile, lpszKeyPasswod, lpszCAPemCertFileOrPath) == 0)
		m_sslCtx = GetContext(0);
	else
	{
		Cleanup();
		return FALSE;
	}

	SetServerNameCallback(fnServerNameCallback);

	return TRUE;
}
SECURITY_STATUS SEC_ENTRY
AcceptSecurityContext(
    PCredHandle                 phCredential,       // Cred to base context
    PCtxtHandle                 phContext,          // Existing context (OPT)
    PSecBufferDesc              pInput,             // Input buffer
    unsigned long               fContextReq,        // Context Requirements
    unsigned long               TargetDataRep,      // Target Data Rep
    PCtxtHandle                 phNewContext,       // (out) New context handle
    PSecBufferDesc              pOutput,            // (inout) Output buffers
    unsigned long SEC_FAR *     pfContextAttr,      // (out) Context attributes
    PTimeStamp                  ptsExpiry           // (out) Life span (OPT)
    )
{
    PCREDENTIAL Credential = NULL;
    PSEC_CONTEXT Context = NULL;
    PMESSAGE Message = NULL;
    PSecBuffer OutputBuffer;
    PSecBuffer InputBuffer;
    MESSAGE SampleMessage;


    if (fContextReq & ISC_REQ_ALLOCATE_MEMORY)
    {
        return(SEC_E_INSUFFICIENT_MEMORY);
    }

    InputBuffer = LocateSecBuffer(pInput);
    if (InputBuffer == NULL)
    {
        return(SEC_E_INVALID_TOKEN);
    }

    if (phContext == NULL)
    {

        Credential = LocateCredential(phCredential->dwUpper);
        if (Credential == NULL)
        {
            return(SEC_E_UNKNOWN_CREDENTIALS);
        }

        if ((Credential->Use & SECPKG_CRED_INBOUND) == 0)
        {
            return(SEC_E_UNKNOWN_CREDENTIALS);
        }

    }

    //
    // If the context is NULL, create a new one.
    //

    if (phContext == NULL)
    {
        //
        // Make sure the output buffer exists.
        //

        OutputBuffer = LocateSecBuffer(pOutput);
        if (OutputBuffer == NULL)
        {
            return(SEC_E_INVALID_TOKEN);
        }



        //
        // Check that the input message is what we expected.
        //

        Message = (PMESSAGE) InputBuffer->pvBuffer;
        SampleMessage.MessageType = Negotiate;
        memset(SampleMessage.Buffer, 'x', MESSAGE_SIZE);

        if (memcmp(&SampleMessage,Message,MESSAGE_SIZE) != 0)
        {
            return(SEC_E_INVALID_TOKEN);
        }

        //
        // Build a new context.
        //

        Context = (PSEC_CONTEXT) LocalAlloc(0,sizeof(SEC_CONTEXT));
        if (Context == NULL)
        {
            return(SEC_E_INSUFFICIENT_MEMORY);
        }
        Context->ContextId = GetNewId();
        phNewContext->dwUpper = Context->ContextId;
        Context->CredentialId = phCredential->dwUpper;
        Context->State = FirstAccept;
        Context->Nonce = 0;
        Context->ContextFlags = fContextReq;
        *pfContextAttr = fContextReq;
        *ptsExpiry = Forever;

        //
        // Build an output token.
        //

        Message = (PMESSAGE) OutputBuffer->pvBuffer;
        Message->MessageType = Challenge;
        memset(Message->Buffer,'y',MESSAGE_SIZE);
        OutputBuffer->cbBuffer = sizeof(MESSAGE);

        AddContext(Context);

        return(SEC_I_CONTINUE_NEEDED);

    } else {
        //
        // This is the second call. Lookup the old context.
        //

        Context = LocateContext(phContext->dwUpper);
        if (Context == NULL)
        {
            return(SEC_E_INVALID_HANDLE);
        }
        if ((Context->State != FirstAccept) &&
            (Context->State != SecondAccept))
        {
            return(SEC_E_INVALID_HANDLE);
        }

        Message = (PMESSAGE) InputBuffer->pvBuffer;

        //
        // Check that the input message is what we expected.
        //

        if (Context->State == FirstAccept)
        {
            SampleMessage.MessageType = ChallengeResponse;
            memset(SampleMessage.Buffer, 'z', MESSAGE_SIZE);
        }
        else
        {
            SampleMessage.MessageType = ReAuthenticate;
            memset(SampleMessage.Buffer, 'q', MESSAGE_SIZE);
        }

        if (memcmp(&SampleMessage,Message,MESSAGE_SIZE) != 0)
        {
            return(SEC_E_INVALID_TOKEN);
        }

        Context->State = SecondAccept;
        return(SEC_E_OK);
    }
}
Exemple #5
0
	/// Called to add one piece of context to assertion, such as filename, line, or function name.
	SmartAssert & Add( const AssertContext & info )
	{
		return static_cast< SmartAssert & >( AddContext( info ) );
	}