[BACK]Return to grey.h CVS log [TXT][DIR] Up to [local] / src / libexec / spamd

File: [local] / src / libexec / spamd / grey.h (download)

Revision 1.10, Wed Aug 21 16:13:29 2013 UTC (10 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, HEAD
Changes since 1.9: +16 -6 lines

Remove the use of time_t in the greylist db file and use int64_t instead
with backwards compatibility for records with 32-bit times.
OK deraadt@ beck@

/*	$OpenBSD: grey.h,v 1.10 2013/08/21 16:13:29 millert Exp $	*/

/*
 * Copyright (c) 2004 Bob Beck.  All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#define MAX_MAIL 1024 /* how big an email address will we consider */
#define PASSTIME (60 * 25) /* pass after first retry seen after 25 mins */
#define GREYEXP (60 * 60 * 4) /* remove grey entries after 4 hours */
#define WHITEEXP (60 * 60 * 24 * 36) /* remove white entries after 36 days */
#define TRAPEXP (60 * 60 * 24) /* hitting a spamtrap blacklists for a day */
#define PATH_PFCTL "/sbin/pfctl"
#define PATH_SPAMD_ALLOWEDDOMAINS "/etc/mail/spamd.alloweddomains"
#define DB_SCAN_INTERVAL 60
#define DB_TRAP_INTERVAL 60 * 10
#define PATH_SPAMD_DB "/var/db/spamd"

/* Obsolete grey data format. */
struct ogdata {
	int32_t first;  /* when did we see it first */
	int32_t pass;   /* when was it whitelisted */
	int32_t expire; /* when will we get rid of this entry */
	int bcount;     /* how many times have we blocked it */
	int pcount;     /* how many times passed, or -1 for spamtrap */
};

struct gdata {
	int64_t first;  /* when did we see it first */
	int64_t pass;   /* when was it whitelisted */
	int64_t expire; /* when will we get rid of this entry */
	int bcount;     /* how many times have we blocked it */
	int pcount;     /* how many times passed, or -1 for spamtrap */
};

extern int greywatcher(void);
extern int greyupdate(char *, char *, char *, char *, char *, int, char *);
extern int gdcopyin(const void *, struct gdata *);