head 1.21; access; symbols milter-greylist-4-3-1:1.21 milter-greylist-2-2-2:1.21 milter-greylist-4-2-2:1.21 milter-greylist-4-2-1:1.21 milter-greylist-4-2:1.21 milter-greylist-4-2-rc1:1.21 milter-greylist-4-2-beta1:1.21 milter-greylist-4-2-branch:1.21.0.6 milter-greylist-4-2-base:1.21 milter-greylist-4-2-0-base:1.21 milter-greylist-4-1-12:1.21 milter-greylist-4-1-11:1.21 milter-greylist-4-1-10:1.21 milter-greylist-4-1-9:1.21 milter-greylist-4-1-8:1.21 milter-greylist-4-1-7:1.21 milter-greylist-4-1-6:1.21 milter-greylist-4-0-1:1.21 milter-greylist-4-0-1-rc1:1.21 milter-greylist-4-1-5:1.21 milter-greylist-4-1-4:1.21 milter-greylist-4-1-3:1.21 milter-greylist-4-1-2:1.21 milter-greylist-4-1-1:1.21 milter-greylist-4-0-branch:1.21.0.4 milter-greylist-4-0-base:1.21 milter-greylist-4-0:1.21 milter-greylist-4-0-rc2:1.21 milter-greylist-4-0-rc1:1.21 milter-greylist-4-0-beta4:1.21 milter-greylist-4-0-beta3:1.21 milter-greylist-4-0-beta2:1.21 milter-greylist-4-0-beta1:1.21 milter-greylist-4-0-alpha6:1.21 milter-greylist-4-0-alpha5:1.21 milter-greylist-4-0-alpha4:1.21 milter-greylist-4-0-alpha3:1.21 milter-greylist-4-0-alpha2:1.21 milter-greylist-4-0-alpha1:1.21 milter-greylist-3-1-8:1.21 milter-greylist-3-1-7:1.21 milter-greylist-3-1-6:1.21 milter-greylist-3-1-5:1.21 milter-greylist-3-1-5-alpha1:1.21 milter-greylist-3-0-1-beta1:1.21.2.1 milter-greylist-3-1-4:1.21 milter-greylist-3-1-3:1.21 milter-greylist-3-1-2:1.21 milter-greylist-3-1-1:1.21 milter-greylist-3-0:1.21.2.1 milter-greylist-3-0-rc7:1.21.2.1 milter-greylist-3-0-rc6:1.21.2.1 milter-greylist-3-0-rc5:1.21.2.1 milter-greylist-3-0-rc4:1.21.2.1 milter-greylist-3-0-rc3:1.21.2.1 milter-greylist-3-0-rc2:1.21.2.1 milter-greylist-3-0-rc1:1.21.2.1 milter-greylist-3-0-alpha6:1.21.2.1 milter-greylist-3-0-branch:1.21.0.2 milter-greylist-3-0-base:1.21 milter-greylist-3-0-alpha5:1.21 milter-greylist-3-0-alpha4:1.20 milter-greylist-3-0-alpha3:1.20 milter-greylist-3-0-alpha2:1.20 milter-greylist-3-0-alpha1:1.19 milter-greylist-2-1-12:1.19 milter-greylist-2-1-11:1.19 milter-greylist-2-1-10:1.18 milter-greylist-2-1-9:1.18 milter-greylist-2-1-9a1:1.18 milter-greylist-2-1-8:1.18 milter-greylist-2-1-7:1.18 milter-greylist-2-1-6:1.18 milter-greylist-2-1-5:1.17 milter-greylist-2-1-4:1.17 milter-greylist-2-1-3:1.17 milter-greylist-2-1-2:1.17 milter-greylist-2-1-1:1.17 milter-greylist-2-0-2:1.16 milter-greylist-2-0-1:1.16 milter-greylist-2-0-1-b1:1.16 milter-greylist-2-0-release:1.16 milter-greylist-2-0-rc5:1.16 milter-greylist-2-0-rc4:1.16 milter-greylist-2-0-rc3:1.16 milter-grey-list-2-0-rc3:1.16 milter-grey-list-2-0-rc2:1.16 milter-grey-list-2-0-rc1:1.16 milter-greylist-2-0-beta7:1.16 milter-greylist-2-0-beta6:1.16 milter-gre-ylist-2-0-beta5:1.16 milter-greylist-2-0-beta5:1.16 milter-greylist-2-0-beta4:1.16 milter-greylist-2-0-beta3:1.16 milter-greylist-2-0-beta2:1.16 milter-greylist-2-0:1.16.0.4 milter-greylist-2-0-base:1.16 milter-greylist-2-0-beta1:1.16 milter-greylist-1-7-5:1.16 before_delayed_tempfail:1.16 milter-greylist-1-7-4:1.16 milter-greylist-1-7-3:1.16 milter-greylist-1-7-2:1.16 milter-greylist-1-6-0:1.16 milter-greylist-1-7-1:1.16 milter-greylist-1-6rc1:1.16 milter-greylist-1-6:1.16.0.2 milter-greylist-1-6-base:1.16 milter-greylist-1-5-12:1.16 milter-greylist-1-5-11:1.16 milter-greylist-1-5-10:1.16 milter-greylist-1-5-9:1.16 milter-greylist-1-5-8:1.16 milter-greylist-1-5-7:1.16 milter-greylist-1-5-6:1.15 milter-greylist-1-5-5:1.15 milter-greylist-1-5-4:1.15 milter-greylist-1-5-3:1.14 milter-greylist-1-5-2:1.14 milter-greylist-1-5-1:1.14 milter-greylist-1-4:1.14.0.2 milter-greylist-1-4-base:1.14 milter-greylist-1-3-9:1.14 milter-greylist-1-3-8:1.14 milter-greylist-1-3-7:1.14 milter-greylist-1-3-6:1.14 milter-greylist-1-3-5:1.14 milter-greylist-1-3-4:1.14 milter-greylist-1-3-3:1.14 BDB:1.13.0.2 BDB-base:1.13 before_BDB:1.10 milter-greylist-1-2-2:1.9.2.1 milter-greylist-1-3-2:1.9 milter-greylist-1-2-1:1.9 milter-greylist-1-2-0:1.9 milter-greylist-1-2:1.9.0.2 milter-greylist-1-2-base:1.9 milter-greylist-1-1-16:1.9 milter-greylist-1-1-15:1.9 milter-greylis-1-1-15:1.9 milter-greylis-1-1-16:1.9 milter-greylist-1-1-14:1.9 milter-greylist-1-1-13:1.9 milter-greylist-1-1-12:1.9 milter-greylist-1-1-11:1.9 milter-greylist-1-1-10:1.9 milter-greylist-1-10rc1:1.9 milter-greylist-1-1-9:1.9 milter-greylist-1-1-8:1.9 milter-greylist-1-1-7:1.9 milter-greylist-1-1-6:1.9 milter-greylist-1-1-5:1.9 milter-greylist-1-1-4:1.9 milter-greylist-1-1-3:1.8 milter-greylist-1-1-2:1.8 milter-greylist-1-0-2:1.8 rmilter-greylist-1-0-1:1.8 milter-greylist-1-0-1:1.8 milter-greylist-1-1-1:1.8 milter-greylist-1-0-base:1.8 milter-greylist-1-0:1.8.0.2 milter-greylist-1-0-0:1.8 milter-greylist-0-27:1.8 milter-greylist-0-26:1.8 milter-greylist-0-25:1.8 milter-greylist-0-24:1.8 milter-greylist-0-23:1.8 milter-greylist-0-22:1.8 milter-greylist-0-21:1.7 milter-greylist-0-20:1.6 milter-greylist-0-19:1.5; locks; strict; comment @ * @; 1.21 date 2006.08.30.04.57.58; author manu; state Exp; branches 1.21.2.1; next 1.20; 1.20 date 2006.08.20.05.53.26; author manu; state Exp; branches; next 1.19; 1.19 date 2006.08.01.14.55.20; author manu; state Exp; branches; next 1.18; 1.18 date 2006.07.24.22.49.43; author manu; state Exp; branches; next 1.17; 1.17 date 2006.01.08.00.38.25; author manu; state Exp; branches; next 1.16; 1.16 date 2004.09.13.18.41.54; author manu; state Exp; branches; next 1.15; 1.15 date 2004.08.01.09.27.03; author manu; state Exp; branches; next 1.14; 1.14 date 2004.05.24.21.22.02; author manu; state Exp; branches; next 1.13; 1.13 date 2004.05.23.13.03.41; author manu; state Exp; branches; next 1.12; 1.12 date 2004.05.21.10.22.08; author manu; state Exp; branches; next 1.11; 1.11 date 2004.05.15.08.41.54; author manu; state Exp; branches; next 1.10; 1.10 date 2004.05.06.13.50.55; author manu; state Exp; branches; next 1.9; 1.9 date 2004.03.31.09.49.16; author manu; state Exp; branches 1.9.2.1; next 1.8; 1.8 date 2004.03.20.17.22.42; author manu; state Exp; branches; next 1.7; 1.7 date 2004.03.20.07.19.03; author manu; state Exp; branches; next 1.6; 1.6 date 2004.03.18.11.08.51; author manu; state Exp; branches; next 1.5; 1.5 date 2004.03.17.22.28.57; author manu; state Exp; branches; next 1.4; 1.4 date 2004.03.17.22.21.36; author manu; state Exp; branches; next 1.3; 1.3 date 2004.03.17.17.33.40; author manu; state Exp; branches; next 1.2; 1.2 date 2004.03.17.15.36.19; author manu; state Exp; branches; next 1.1; 1.1 date 2004.03.16.23.16.52; author manu; state Exp; branches; next ; 1.9.2.1 date 2004.05.06.13.54.00; author manu; state Exp; branches; next ; 1.21.2.1 date 2006.09.04.22.05.58; author manu; state Exp; branches; next ; desc @@ 1.21 log @Fix various race conditions (AIDA Shinra) @ text @/* $Id: autowhite.h,v 1.20 2006/08/20 05:53:26 manu Exp $ */ /* vim: set sw=8 ts=8 sts=8 noet cino=(0: */ /* * Copyright (c) 2004 Emmanuel Dreyfus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _AUTOWHITE_H_ #define _AUTOWHITE_H_ #include "milter-greylist.h" #ifndef AUTOWHITE_VALIDITY #define AUTOWHITE_VALIDITY (24 * 3600) /* 1 day */ #endif #ifndef AUTOWHITE_BUCKETS #define AUTOWHITE_BUCKETS 512 #endif TAILQ_HEAD(autowhitelist, autowhite); struct autowhite { struct sockaddr *a_sa; socklen_t a_salen; char *a_from; char *a_rcpt; struct timeval a_tv; TAILQ_ENTRY(autowhite) a_list; TAILQ_ENTRY(autowhite) ab_list; }; struct autowhite_bucket { TAILQ_HEAD(, autowhite) b_autowhite_head; }; #define AUTOWHITE_LOCK pthread_mutex_lock(&autowhite_lock) #define AUTOWHITE_UNLOCK pthread_mutex_unlock(&autowhite_lock) extern pthread_mutex_t autowhite_lock; void autowhite_init(void); struct autowhite *autowhite_get(struct sockaddr *, socklen_t, char *, char *, time_t); void autowhite_put(struct autowhite *); void autowhite_add(struct sockaddr *, socklen_t, char *, char *, time_t *, char *); int autowhite_check(struct sockaddr *, socklen_t, char *, char *, char *, time_t, time_t); int autowhite_textdump(FILE *); int autowhite_del_addr(struct sockaddr *, socklen_t); #endif /* _AUTOWHITE_H_ */ @ 1.21.2.1 log @Back out race conditions fixes (too intrusive, will be back in 3.1.x) @ text @d2 1 a45 4 #define AUTOWHITE_WRLOCK WRLOCK(autowhite_lock) #define AUTOWHITE_RDLOCK RDLOCK(autowhite_lock) #define AUTOWHITE_UNLOCK UNLOCK(autowhite_lock) a58 1 pthread_mutex_t bucket_mtx; d62 3 a64 2 extern pthread_rwlock_t autowhite_lock; extern pthread_mutex_t autowhite_change_lock; @ 1.20 log @From Fabien Tassin Add more log output for blackist and flushaddr Allow rejecting by tempfail on blacklist configuration @ text @d1 2 a2 1 /* $Id: autowhite.h,v 1.19 2006/08/01 14:55:20 manu Exp $ */ a45 4 #define AUTOWHITE_WRLOCK WRLOCK(autowhite_lock) #define AUTOWHITE_RDLOCK RDLOCK(autowhite_lock) #define AUTOWHITE_UNLOCK UNLOCK(autowhite_lock) a58 1 pthread_mutex_t bucket_mtx; d62 3 a64 2 extern pthread_rwlock_t autowhite_lock; extern pthread_mutex_t autowhite_change_lock; @ 1.19 log @flushaddr @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.18 2006/07/24 22:49:43 manu Exp $ */ d78 1 a78 1 void autowhite_del_addr(struct sockaddr *, socklen_t); @ 1.18 log @per-acl greylist and autowhitelist setting @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.17 2006/01/08 00:38:25 manu Exp $ */ d78 1 @ 1.17 log @From Ranko Zivojnovic : * Bucketed search of autowhitelisted and pending entries rather than write-locked only-one-at-the-time search * Large buffer for writing the dump file * Disabled having the time comment by default next to each line in the dump (improves dump performance by order of magnitude on my Solaris). If "verbose" enabled - behavior will be as before * 'mxsync' client connection is set non-blocking, but there were no checks if fprintf actually delivers the complete sync message to the peer or just the part of it. * Also, when reading the 'mxsync' client connection, being non- blocking, fgets() can bail out with NULL and EAGAIN which is not fatal error for the connection. @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.16 2004/09/13 18:41:54 manu Exp $ */ d71 1 a71 1 time_t *); d75 2 a76 1 int autowhite_check(struct sockaddr *, socklen_t, char *, char *, char *); @ 1.16 log @malloc e-mail addresses, avoids truncation at 32 chars, from Hajimu Umemoto @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.15 2004/08/01 09:27:03 manu Exp $ */ d41 4 d58 6 d67 1 @ 1.15 log @Full blown IPv6 support, from Hajimu Umemoto Correctly clean rc-debian.sh @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.14 2004/05/24 21:22:02 manu Exp $ */ d50 2 a51 2 char a_from[ADDRLEN + 1]; char a_rcpt[ADDRLEN + 1]; @ 1.14 log @Back out Berkeley DB stuff, it will now live on the BDB branch. @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.10 2004/05/06 13:50:55 manu Exp $ */ d48 2 a49 1 struct in_addr a_in; d59 2 a60 1 struct autowhite *autowhite_get(struct in_addr *, char *, char *, time_t *); d62 3 a64 2 void autowhite_add(struct in_addr *, char *, char *, time_t *, char *); int autowhite_check(struct in_addr *, char *, char *, char *); @ 1.13 log @Don't use an external lockfile, use a field in the database instead @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.12 2004/05/21 10:22:08 manu Exp $ */ a36 11 #include #include #include #include #ifdef HAVE_DB_185_H #include #else #include #endif d45 1 a45 3 #ifndef KEYLEN #define KEYLEN 1024 #endif d51 2 a52 1 time_t a_expire; a54 3 typedef enum {AS_COLD, AS_WARM} autowhite_startup_t; extern DB *aw_db; d57 3 a59 4 int autowhite_init(void); void autowhite_get(struct in_addr *, char *, char *, time_t *, struct autowhite *); void autowhite_put(char *); d62 1 a62 5 char *autowhite_makekey(char *, size_t, struct in_addr *, char *, char *); int autowhite_update(int, FILE *); int autowhite_db_options(autowhite_startup_t); void autowhite_destroy(void); void autowhite_shutdown(void); @ 1.12 log @Correctly rebuild the database when option change: create a brand new one and populate it with record with updated keys. This is to workaround the incapacity of Berkeley DB to update the keys while walking the database @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.11 2004/05/15 08:41:54 manu Exp $ */ d67 2 d72 1 a72 1 void autowhite_init(void); d79 4 a82 2 int autowhite_update(DB *, FILE *); void autowhite_db_options(void); @ 1.11 log @First attempt with Berkeley DB. Some remaining bugs on dynamic modification of options. @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.10 2004/05/06 13:50:55 manu Exp $ */ d77 1 a77 1 int autowhite_update(int, FILE *); @ 1.10 log @Ignore pthread_*_init return values as they are broken on some libpthread. The test were wrong to support those libs, and this prevented NetBSD 2.0 libpthread to work @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.9 2004/03/31 09:49:16 manu Exp $ */ d37 11 d56 3 a58 1 TAILQ_HEAD(autowhitelist, autowhite); d64 1 a64 2 struct timeval a_tv; TAILQ_ENTRY(autowhite) a_list; d67 1 d71 3 a73 2 struct autowhite *autowhite_get(struct in_addr *, char *, char *, time_t *); void autowhite_put(struct autowhite *); d76 3 a78 1 int autowhite_textdump(FILE *); @ 1.9 log @Add flag equivalents to the config file @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.8 2004/03/20 17:22:42 manu Exp $ */ d57 1 a57 1 int autowhite_init(void); @ 1.9.2.1 log @pull-up bugfix to run on NetBSD-2.0: ignore pthread_*_init return values as the tests were broken to support broken libtphread @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.9 2004/03/31 09:49:16 manu Exp $ */ d57 1 a57 1 void autowhite_init(void); @ 1.8 log @Locking problems in autowhite code: add one more layer of function to avoid taking the lock twice in dump_reload code path @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.7 2004/03/20 07:19:03 manu Exp $ */ a54 1 extern time_t autowhite_validity; @ 1.7 log @Print the message Id with the logs @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.6 2004/03/18 11:08:51 manu Exp $ */ d59 2 @ 1.6 log @One hour is 3600 seconds, not 2600 @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.5 2004/03/17 22:28:57 manu Exp $ */ d59 2 a60 2 void autowhite_add(struct in_addr *, char *, char *, time_t *); int autowhite_check(struct in_addr *, char *, char *); @ 1.5 log @When reloading the whitelist, don't change the time @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.4 2004/03/17 22:21:36 manu Exp $ */ d38 1 a38 1 #define AUTOWHITE_VALIDITY (24 * 2600) /* 1 day */ @ 1.4 log @save and reload the auto-whitelist @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.3 2004/03/17 17:33:40 manu Exp $ */ d59 1 a59 1 void autowhite_add(struct in_addr *, char *, char *); @ 1.3 log @Move away the dumper thread from pending.c as it will also dump the autowhitelist now @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.2 2004/03/17 15:36:19 manu Exp $ */ d61 1 @ 1.2 log @Fix auto-whitelisting bugs Enable user selection of the whitelist delay @ text @d1 1 a1 1 /* $Id: autowhite.h,v 1.1 2004/03/16 23:16:52 manu Exp $ */ d56 1 @ 1.1 log @Autowhitelisting. Not saved upon restarts, not user settable. @ text @d1 1 a1 1 /* $Id$ */ d37 1 d39 1 d54 2 @