Microsoft Internet Security and Acceleration Server 2000

Reading Configuration from Vendor Parameter Sets

To make the filter configurable with respect to changing the string it seeks, you need storage that the filter and the administrator can access to read and write configuration data. This kind of storage is provided by ISA administration COM objects — specifically, the FPCVendorParametersSet object. When you use FPCVendorParametersSet, configuration backup and restore operations are done automatically, together with the rest of the ISA configuration operations. FPCVendorParametersSet also allows for configuration data to be shared across an ISA Server array.

To read configuration data from vendor parameter sets

  1. Add the public method Initialize to the CSMTPDataFilter class in SMTPDataFilter.h. This method allows information to be passed to the data filter object.
    	HRESULT Initialize(CComPtr<IFWXFirewall> pCallback);
    

    This initialization method would be called by the CFWXSessionFilter::FwxFirewallEventHandler method.

  2. Add a private member to CSMTPDataFilter class in SMTPDataFilter.h:
    char *m_StringToLookFor;
    
  3. Add the following implementation code to SMTPDataFilter.cpp:
    HRESULT CSMTPDataFilter::Initialize(CComPtr<IFWXFirewall> pCallback)
    {
     
    	HRESULT hr=S_OK;
    	_bstr_t Value;  //Value from ISA storage
    	CComPtr<IFWXFilterAdmin> pIFWXFilterAdmin;
    	MSFPCCOM::IFPCVendorParametersSetPtr comptrIFPCVendorParametersSet;
    	struct IFPCVendorParametersSet * pIFPCVendorParametersSet;
     
    	hr = CoCreateInstance (CLSID_FWXFilterAdmin,
    						 NULL,
    						 CLSCTX_SERVER,
    						 IID_IFWXFilterAdmin,
    						 (LPVOID *) &pIFWXFilterAdmin);
    	if (FAILED(hr))
    		return hr;
     
    	hr =pIFWXFilterAdmin->GetFilterParameterSet(CLSID_SMTPFilter, fwx_DefaultScope, &pIFPCVendorParametersSet);
    	if (FAILED(hr))
    		return hr;
     
    	comptrIFPCVendorParametersSet.Attach((MSFPCCOM::IFPCVendorParametersSet*) pIFPCVendorParametersSet, true);
    
    	try
    	{
    		//Read the string to find
    		Value=comptrIFPCVendorParametersSet->Value[_bstr_t("StringValue")];
    		m_StringToLookFor =new char [strlen(Value)+1];
    		if (m_StringToLookFor ==NULL)
    			return E_OUTOFMEMORY;
    		strcpy(m_StringToLookFor,Value);
    }
    	catch(_com_error& /*err*/)
    	{
    		//Set default value to m_StringToLookFor
    		m_StringToLookFor = new char[12];
    		strcpy(m_StringToLookFor,"Virus Virus");
    }
    	return  S_OK;
    }
    
  4. In SMTPDataFilter.h, add the following code to the constructor of the class CSMTPDataFilter:
    m_StringToLookFor = NULL;
    

    and add the following destructor of class CSMTPDataFilter:

    	~CSMTPDataFilter()
    	{
    		delete [] m_StringToLookFor;
    }