示例#1
0
// Process as a SOAP message
bool
WebServiceServer::ProcessPost(SOAPMessage* p_message)
{
  CString action = p_message->GetSoapAction();
  int code = GetCommandCode(action);

  if(code == 0)
  {
    m_errorMessage.Format("Message to process NOT FOUND: %s",action.GetString());
    m_log->AnalysisLog(__FUNCTION__,LogType::LOG_ERROR,false,m_errorMessage);
    p_message->Reset();
    p_message->SetFault("Critical","Server","Failed to process the message.",m_errorMessage);
    return false;

  }

  try
  {
    // Check request with WSDL
    if(m_checkIncoming)
    {
      if(m_wsdl->CheckIncomingMessage(p_message,m_checkFieldvalues) == false)
      {
        return false;
      }
    }

    // Process in a derived class a la MFC interface mappings
    // Calls the WEBSERVICE_MAP for the derived class
    OnProcessPost(code,p_message);

    // Check answer with WSDL
    if(m_checkOutgoing)
    {
      if(m_wsdl->CheckOutgoingMessage(p_message,m_checkFieldvalues) == false)
      {
        return false;
      }
    }
  }
  catch(StdException& ex)
  {
    ReThrowSafeException(ex);
    m_errorMessage.Format("Error in processing the message: %s : %s",action.GetString(),ex.GetErrorMessage().GetString());
    m_log->AnalysisLog(__FUNCTION__, LogType::LOG_ERROR,false,m_errorMessage);
    p_message->Reset();
    p_message->SetFault("Critical","Server","Failed to process the message.",m_errorMessage);
    return false;
  }
  // Try next handler
  return true;
}  
示例#2
0
/* TPM_RC_OBJECT_MEMORY no object slot */
TPM_RC
ObjectLoadEvict(
		TPM_HANDLE      *handle,        // IN:OUT: evict object handle.  If success, it
		// will be replace by the loaded object handle
		COMMAND_INDEX    commandIndex   // IN: the command being processed
		)
{
    TPM_RC          result;
    TPM_HANDLE      evictHandle = *handle;   // Save the evict handle
    OBJECT          *object;
    // If this is an index that references a persistent object created by
    // the platform, then return TPM_RH_HANDLE if the phEnable is FALSE
    if(*handle >= PLATFORM_PERSISTENT)
	{
	    // belongs to platform
	    if(g_phEnable == CLEAR)
		return TPM_RC_HANDLE;
	}
    // belongs to owner
    else if(gc.shEnable == CLEAR)
	return TPM_RC_HANDLE;
    // Try to allocate a slot for an object
    object = ObjectAllocateSlot(handle);
    if(object == NULL)
	return TPM_RC_OBJECT_MEMORY;
    // Copy persistent object to transient object slot.  A TPM_RC_HANDLE
    // may be returned at this point. This will mark the slot as containing
    // a transient object so that it will be flushed at the end of the
    // command
    result = NvGetEvictObject(evictHandle, object);
    // Bail out if this failed
    if(result != TPM_RC_SUCCESS)
	return result;
    // check the object to see if it is in the endorsement hierarchy
    // if it is and this is not a TPM2_EvictControl() command, indicate
    // that the hierarchy is disabled.
    // If the associated hierarchy is disabled, make it look like the
    // handle is not defined
    if(ObjectGetHierarchy(object) == TPM_RH_ENDORSEMENT
       && gc.ehEnable == CLEAR
       && GetCommandCode(commandIndex) != TPM_CC_EvictControl)
	return TPM_RC_HANDLE;
    return result;
}