Ejemplo n.º 1
0
 public GreyListSettings(GreyListSettings other)
 {
     this.ConfirmedMaxAge = other.ConfirmedMaxAge;
     this.UnconfirmedMaxAge = other.UnconfirmedMaxAge;
     this.GreylistingPeriod = other.GreylistingPeriod;
     this.CleanRowCount = other.CleanRowCount;
     this.IpNetmask = other.IpNetmask;
     this.WhitelistClients = other.WhitelistClients;
     this.WhitelistIPs = other.WhitelistIPs;
     this.LogLevel = other.LogLevel;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a Greylist agent for use
        /// </summary>
        /// <param name="settings">Settings object with populated settings</param>
        /// <param name="greylistDatabase">Greylist database to use for triplet management</param>
        /// <param name="hashManager">hash manager</param>
        /// <param name="server">Exchange server instance</param>
        public GreyListAgent(GreyListSettings settings, GreyListDatabase greylistDatabase, SHA256Managed hashManager, SmtpServer server, String logPath)
        {
            // Initialize instance variables.
            this.settings = settings;
            this.server = server;
            this.greylistDatabase = greylistDatabase;
            this.testOnEndOfHeaders = false;
            this.hashManager = hashManager;
            this.logPath = logPath;

            // Set up the hooks to have your functions called when certain events occur.
            this.OnRcptCommand += new RcptCommandEventHandler(this.OnRcptCommandHandler);
            this.OnEndOfHeaders += new EndOfHeadersEventHandler(this.OnEndOfHeaderHandler);
        }
        public GreyListAgentFactory()
        {
            // Initialize the hashing engine
            hashManager = new SHA256Managed();

            // Fetch the assembly, and populate paths
            Assembly currAssembly = Assembly.GetAssembly(this.GetType());
            string assemblyPath = Path.GetDirectoryName(currAssembly.Location);
            this.dataPath = Path.Combine(assemblyPath, RelativeDataPath);

            // Load GreyList settings from file
            this.greylistSettings = new GreyListSettings(Path.Combine(this.dataPath, ConfigFileName));

            // Load the database. The database will end up empty if the file doesn't exist or becomes corrupted
            this.greylistDatabase = GreyListDatabase.Load(Path.Combine(this.dataPath, DatabaseFile));
        }
Ejemplo n.º 4
0
        public GreyListAgentFactory()
        {
            // Initialize the hashing engine
            _hashManager = new SHA256Managed();

            // Fetch the assembly, and populate paths
            var currAssembly = Assembly.GetAssembly(GetType());
            var assemblyPath = Path.GetDirectoryName(currAssembly.Location);
            _configPath = Path.Combine(assemblyPath, Constants.RelativeConfigPath);

            // Configuring Log4Net
            XmlConfigurator.Configure(new FileInfo(Path.Combine(_configPath, Constants.LoggerConfigFileName)));

            // Load GreyList settings from file
            _greylistSettings = GreyListSettings.Load(Path.Combine(_configPath, Constants.AgentConfigFileName));

            // Load the database. The database will end up empty if the file doesn't exist or becomes corrupted
            _greylistDatabase = GreyListDatabase.Load(Path.Combine(_configPath, Constants.DatabaseFile));
        }
Ejemplo n.º 5
0
 public static GreyListSettings Load(string path)
 {
     var retval = new GreyListSettings();
     if (File.Exists(path))
     {
         var serializer = new XmlSerializer(typeof (GreyListSettings));
         using (var stream = new FileStream(path, FileMode.Open))
         {
             retval = serializer.Deserialize(stream) as GreyListSettings;
         }
     }
     return retval;
 }