Browse Source

Check for null HostAddr in mlfi_connect.


git-svn-id: https://svn.microneil.com/svn/SNFMilter/trunk@12 2c985dca-31e6-41a4-b4a2-d8f5b7f8e074
master
adeniz 15 years ago
parent
commit
dd4a0b4809
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      SNFMilter.cpp

+ 16
- 1
SNFMilter.cpp View File

sockaddr_in *SaIn = (sockaddr_in *) HostAddr; // Fetch the IP address. sockaddr_in *SaIn = (sockaddr_in *) HostAddr; // Fetch the IP address.
Context->ConnectionData.HostName = HostName; // Load the info. Context->ConnectionData.HostName = HostName; // Load the info.
Context->ConnectionData.HostIP = ntohl(SaIn->sin_addr.s_addr);
if (0 == SaIn) { // If HostAddr is 0...
Context->ConnectionData.HostIP = "127.0.0.1"; // Set to a valid value.
} else {
Context->ConnectionData.HostIP = ntohl(SaIn->sin_addr.s_addr);
}
if (MilterDebugMode) { if (MilterDebugMode) {
ostringstream Temp; ostringstream Temp;
logInfo(ContextName, InfoCode, Temp.str()); logInfo(ContextName, InfoCode, Temp.str());
} }
if (0 == SaIn) { // If HostAddr is 0, don't do a scan.
return FailSafeMilterResponse;
}
SNFMilterAction IpScanResult; // Perform IP scan. SNFMilterAction IpScanResult; // Perform IP scan.
IpScanResult = Context->milterEngine.scanIP(Context->ConnectionData.HostIP); IpScanResult = Context->milterEngine.scanIP(Context->ConnectionData.HostIP);

Loading…
Cancel
Save