view src/dnsbl.h @ 143:ecb40aa3eaa5 stable-5-23

require two periods for ip addresses
author carl
date Tue, 10 Oct 2006 19:12:16 -0700
parents f4746d8a12a3
children c7fc218686f5
line wrap: on
line source

/*

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

*/

#ifndef dnsbl_include
#define dnsbl_include

#include "context.h"

extern int debug_syslog;

class recorder;
class url_scanner;

////////////////////////////////////////////////
// mail filter private data, held for us by sendmail
//
struct mlfiPriv
{
	// connection specific data
	CONFIG	*pc;					// global filtering configuration
	int 	fd; 					// to talk to dns resolvers process
	bool	err;					// did we get any errors on the resolver socket?
	int 	ip; 					// ip4 address of the smtp 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
	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?
	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;	// ""


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

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

#endif