view src/dnsbl.h @ 202:ae0585d64dd2

Added tag stable-6-0-16 for changeset 752d4315675c
author Carl Byington <carl@five-ten-sg.com>
date Sat, 02 Feb 2008 12:32:59 -0800
parents 8f4a9a37d4d9
children 82886d4dd71f
line wrap: on
line source

/*

Copyright (c) 2007 Carl Byington - 510 Software Group, released under
the GPL version 3 or any later version at your choice available at
http://www.gnu.org/licenses/gpl-3.0.txt

*/

#ifndef dnsbl_include
#define dnsbl_include

#include "context.h"
#include "spamass.h"
#include "dccifd.h"

extern int debug_syslog;
#define dccbulk 1000

class recorder;
class url_scanner;

////////////////////////////////////////////////
// mail filter private data, held for us by sendmail
//
struct mlfiPriv
{
    // callback specific data
    SMFICTX *ctx;                           // updated everytime we fetch this priv pointer from the ctx
    bool    eom;                            // are we in eom function, so progress function can be called?
	// connection specific data
	CONFIG	*pc;							// global filtering configuration
	int 	fd; 							// to talk to dns resolver process
	bool	err;							// did we get any errors on the resolver socket?
	int 	ip; 							// ip4 address of the smtp client
	char	*helo;							// helo from client
	map<DNSBLP, bool> checked;				// map of dnsblp to result of (ip listed on that dnsbl)
	// message specific data
	char			*mailaddr;				// envelope from value
	char			*queueid;				// sendmail queue id
	char			*authenticated; 		// client authenticated? if so, suppress all dnsbl checks, but check rate limits
	char			*client_name;			// fully qualified host name of the smtp client
	bool			have_whites;			// have at least one whitelisted recipient? need to accept content and remove all non-whitelisted recipients if it fails
	bool			only_whites;			// every recipient is whitelisted?
	bool			want_spamassassin;		// at least one non-whitelisted recipient has a non zero spamassassin limit
	bool			want_dccgrey;			// at least one non-whitelisted recipient wants dcc greylisting
	bool			want_dccbulk;			// at least one non-whitelisted recipient wants dcc bulk filtering
    bool            is_bulk_precedence;     // have precedence:bulk header to prevent autowhitelisting
    delay_whitelist delayer;                // to remember autowhitelisting until we see headers
	CONTEXT 		*content_context;		// first non-whitelisted recipient with a content filtering context
	context_map 	env_to; 				// map each non-whitelisted recipient to their filtering context
	recorder		*memory;				// memory for the content scanner
	url_scanner 	*scanner;				// object to handle body scanning
	char			*content_suffix;		// for url body filtering based on ip addresses of hostnames in the body
	char			*content_message;		// ""
	char			*uribl_suffix;			// for uribl body filtering based on hostnames in the body
	char			*uribl_message; 		// ""
	string_set		*content_host_ignore;	// ""
	SpamAssassin	*assassin;
	DccInterface	*dccifd;


	mlfiPriv();
	~mlfiPriv();
	void reset(bool final = false); // for a new message
	void get_fd();
	void return_fd();
	size_t my_read(char *buf, size_t len);
	size_t my_write(const char *buf, size_t len);
	void need_content_filter(char *rcpt, CONTEXT &con);
};

void my_syslog(mlfiPriv *priv, char *text);
void my_syslog(mlfiPriv *priv, string text);
void my_syslog(char *text);

#endif