This documentation is archived and is not being maintained.

Exchange 2000 Sample Gateway Known Issues

Exchange Server 2003

Exchange 2000 Sample Gateway Known Issues

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The Sample Gateway is provided as an example of how to create gateways for Microsoft® Exchange Server 2003, and is supported for use with Exchange 2000 Server and Exchange Server 2003. However, the Sample Gateway provided with the SDK is not intended for use in a production environment.

Important  There are known issues in the Exchange Sample Gateway code. To ensure high quality, any gateway created based on this sample should be verified for the necessary levels of reliability, performance, security and so on. The Sample Gateway as shipped should be considered an example of how you might create your own gateway, and should not be used in a production messaging environment.

The following are known issues in the Sample Gateway when this SDK was released:

  • The Sample Gateway can only be compiled with Microsoft Visual Studio® 6. The Sample Gateway should not be compiled using Visual Studio .NET.
  • The Sample Gateway snap-in for Microsoft Management Console (MMC) requires the Visual Studio 6 MMC snap-in designer. Later versions of MMC use a different method for creating snap-ins.
  • Some commands that appear available in the Sample Gateway User Interface are not implemented.
  • Do not install the Sample Gateway on a front-End Exchange server. The gateway should only be installed on a back-end Exchange server.
  • The Sample Gatway must be run with Exchange 2000 Service Pack 3 and later, or Exchange 2003.
  • When installing the Sample Gateway on Windows Server 2003 you might encounter the error message "Automation Error", and the gateway installation will fail. To resolve this issue, make the following change to the file modWMI.bas, before compiling SgwAdmin.vbp. Line 82 in modWMI.bas currently reads:

        Set objWmi = GetObject("winmgmts::Win32_Service")

    Change line 82 to read:

        Set objWmi = GetObject("winmgmts:{authenticationLevel=pkt}!Win32_Service")

    After making the change, recompile the Gateway.

Viewing the Sample Gateway Queue

The following are required for the Exchange Server 2003 Queue Viewer to properly display queue information for the Sample Gateway

  1. The Microsoft Active Directory® object for the Sample Gateway queue must be derived from the mailGateway Active Directory class.
  2. The "computername" Active Directory attribute must exactly match the Network Basic Input/Output System (NetBIOS) name for the computer where the gateway is running.
  3. The "legacyExchangeDN" Active Directory attribute must be set on the connector object.
  4. The "heuristics" Active Directory attribute must have the HAS_EDK_MAPI_CONNECTOR (0x01000000) bit set.

Items 1-3 above are set by the Sample Gateway installation procedure. The last criteria above is not set by during installation. The Exchange Server 2003 SDK provides a script for you to perform this. You can read more about the script in the topic Viewing a Custom Connector in the Queue Viewer.

Known Security Issues

Important  Do not use the unmodified Sample Gateway in a production environment. The following are known security issues, but you should assume that this list is not complete. There might be other similar issues in the Sample Gateway code.

Sample Gateway Performance Counters (GWPerf.c), at approximately lines 755, 787 and 1262

Although the code does check for a buffer overrun, it does so after the damage may have already been done, and does not properly handle such a problem. The buffers (wszMutexName, szKeyName) should be allocated using standard dynamic memory-allocation techniques. The size of the data being placed in the buffers should be verified before the assignment, and safer library functions should be used.

Sample Gateway Performance Counters (GWPerf.c), at approximately lines 831 and 868

The code at these locations creates a named Mutex (line 831) and a file mapping (line 868) with no associated permissions. Creating named objects with NULL DACLs presents Operating System-level named objects with no permissions, but that have the full privileges of the account running the software. These objects should be created with restrictions to ensure only the local system can access them.

Sample Gateway Message Emitter (MsgEmit.cpp), at approximately line 709 and 821

Message tracing text is being added to the allocated buffers without checking whether the buffer has sufficient room. Although this would not cause a buffer overrun on the stack, other data corruptions in the heap could occur. The code should verify there is enough space in the buffer before adding more text to the string. The code should also verify that the source strings, and the final concatenated string are properly terminated.

Sample Gateway Exchange Objects Installer code (MsgEmit.c), line 683

The call to DsGetDcName Online link does not specifiy mutual authentication. This can allow a spoofed Domain Name System (DNS) server to return incorrect information about the device context (DC) that Exchange should communicate with. This can potentially allow information disclosure and escalation of priviledge attacks. To learn more about using mutual authentication, read the DsGetDcName Online link topic on MSDN®.

Sample Gateway Exchange Objects Installer Code (ExchProf.c), at approximately line 718

The MAPI profile created is set to negotiate the authentication method (RPC_C_AUTHN_GSS_NEGOTIATE). MAPI profiles should use Kerberos authentication.

Sample Gateway Message Translation (ConvDllc.cpp), at approximately line 118

The LoadLibrary function call does not specify the full path name to the dynamic-link library (DLL). Depending on where the code executes from, this can potentially allow malicious code to be run under the security context of the Sample Gateway. The code should be modified to only load the DLL that from the expected location.

Sample Gateway Message Emitter (MsgParse.cpp), at approximately line 633

The sample code assumes that the lpTemp variable contains enough characters to copy into szTempBuffer. However, if lpTemp does not have enough text, the function could copy past the end of the string. The code should be modified so it only copies what is available, and generates an error if there is not enough text.

Show: