head 1.97; access; symbols milter-greylist-4-5-13:1.97 milter-greylist-4-5-12:1.97 milter-greylist-4-5-11:1.96 milter-greylist-4-5-10:1.96 milter-greylist-4-9-10:1.96 milter-greylist-4-5-8:1.95 milter-greylist-4-5-9:1.95 milter-greylist-4-5-7:1.94 milter-greylist-4-5-6:1.94 milter-greylist-4-5:1.94 milter-greylist-4-5-5:1.93 milter-greylist-4-5-4:1.93 milter-greylist-4-5-3:1.93 milter-greylist-4-5-2:1.92 milter-greylist-4-5-1:1.92 milter-greylist-4-4-3:1.92 milter-greylist-4-4-2:1.92 milter-greylist-4-4-1:1.92 milter-greylist-4-4:1.92 milter-greylist-4-4-rc1:1.92 milter-greylist-4-4-alpha4:1.92 milter-greylist-4-4-alpha3:1.92 milter-greylist-4-4-alpha2:1.89 milter-greylist-4-4-alpha1:1.89 milter-greylist-4-2-7:1.77.2.2 milter-greylist-4-3-9:1.84 milter-greylist-4-2-6:1.77.2.2 milter-gresylit-4-2-6:1.77.2.2 milter-greylist-4-3-8:1.84 milter-greylist-4-3-7:1.80 milter-greylist-4-2-5:1.77 milter-greylist-4-3-6:1.80 milter-greylist-4-2-4:1.77 milter-greylist-4-3-5:1.80 milter-greylist-4-3-4:1.78 milter-greylist-4-2-3:1.77 milter-greylist-4-3-3:1.77 rmilter-greylist-4-2-3:1.77 milter-greylist-4-3-2:1.77 milter-greylist-4-3-1:1.77 milter-greylist-2-2-2:1.77 milter-greylist-4-2-2:1.77 milter-greylist-4-2-1:1.77 milter-greylist-4-2:1.77 milter-greylist-4-2-rc1:1.77 milter-greylist-4-2-beta1:1.77 milter-greylist-4-2-branch:1.77.0.2 milter-greylist-4-2-base:1.77 milter-greylist-4-2-0-base:1.77 milter-greylist-4-1-12:1.77 milter-greylist-4-1-11:1.77 milter-greylist-4-1-10:1.77 milter-greylist-4-1-9:1.77 milter-greylist-4-1-8:1.77 milter-greylist-4-1-7:1.76 milter-greylist-4-1-6:1.76 milter-greylist-4-0-1:1.69 milter-greylist-4-0-1-rc1:1.69 milter-greylist-4-1-5:1.72 milter-greylist-4-1-4:1.72 milter-greylist-4-1-3:1.71 milter-greylist-4-1-2:1.71 milter-greylist-4-1-1:1.71 milter-greylist-4-0-branch:1.69.0.2 milter-greylist-4-0-base:1.69 milter-greylist-4-0:1.69 milter-greylist-4-0-rc2:1.69 milter-greylist-4-0-rc1:1.69 milter-greylist-4-0-beta4:1.69 milter-greylist-4-0-beta3:1.69 milter-greylist-4-0-beta2:1.68 milter-greylist-4-0-beta1:1.68 milter-greylist-4-0-alpha6:1.68 milter-greylist-4-0-alpha5:1.68 milter-greylist-4-0-alpha4:1.68 milter-greylist-4-0-alpha3:1.68 milter-greylist-4-0-alpha2:1.67 milter-greylist-4-0-alpha1:1.66 milter-greylist-3-1-8:1.65 milter-greylist-3-1-7:1.64 milter-greylist-3-1-6:1.62 milter-greylist-3-1-5:1.62 milter-greylist-3-1-5-alpha1:1.61 milter-greylist-3-0-1-beta1:1.46.2.3 milter-greylist-3-1-4:1.58 milter-greylist-3-1-3:1.53 milter-greylist-3-1-2:1.53 milter-greylist-3-1-1:1.49 milter-greylist-3-0:1.46.2.3 milter-greylist-3-0-rc7:1.46.2.3 milter-greylist-3-0-rc6:1.46.2.2 milter-greylist-3-0-rc5:1.46.2.2 milter-greylist-3-0-rc4:1.46.2.1 milter-greylist-3-0-rc3:1.46.2.1 milter-greylist-3-0-rc2:1.46.2.1 milter-greylist-3-0-rc1:1.46.2.1 milter-greylist-3-0-alpha6:1.46.2.1 milter-greylist-3-0-branch:1.46.0.2 milter-greylist-3-0-base:1.46 milter-greylist-3-0-alpha5:1.46 milter-greylist-3-0-alpha4:1.45 milter-greylist-3-0-alpha3:1.45 milter-greylist-3-0-alpha2:1.44 milter-greylist-3-0-alpha1:1.43 milter-greylist-2-1-12:1.43 milter-greylist-2-1-11:1.42 milter-greylist-2-1-10:1.42 milter-greylist-2-1-9:1.42 milter-greylist-2-1-9a1:1.42 milter-greylist-2-1-8:1.42 milter-greylist-2-1-7:1.42 milter-greylist-2-1-6:1.40 milter-greylist-2-1-5:1.40 milter-greylist-2-1-4:1.40 milter-greylist-2-1-3:1.39 milter-greylist-2-1-2:1.38 milter-greylist-2-1-1:1.38 milter-greylist-2-0-2:1.37 milter-greylist-2-0-1:1.37 milter-greylist-2-0-1-b1:1.37 milter-greylist-2-0-release:1.37 milter-greylist-2-0-rc5:1.37 milter-greylist-2-0-rc4:1.37 milter-greylist-2-0-rc3:1.37 milter-grey-list-2-0-rc3:1.37 milter-grey-list-2-0-rc2:1.37 milter-grey-list-2-0-rc1:1.37 milter-greylist-2-0-beta7:1.37 milter-greylist-2-0-beta6:1.37 milter-gre-ylist-2-0-beta5:1.37 milter-greylist-2-0-beta5:1.37 milter-greylist-2-0-beta4:1.37 milter-greylist-2-0-beta3:1.37 milter-greylist-2-0-beta2:1.37 milter-greylist-2-0:1.37.0.2 milter-greylist-2-0-base:1.37 milter-greylist-2-0-beta1:1.37 milter-greylist-1-7-5:1.37 before_delayed_tempfail:1.36 milter-greylist-1-7-4:1.36 milter-greylist-1-7-3:1.36 milter-greylist-1-7-2:1.36 milter-greylist-1-6-0:1.35 milter-greylist-1-7-1:1.35 milter-greylist-1-6rc1:1.35 milter-greylist-1-6:1.35.0.2 milter-greylist-1-6-base:1.35 milter-greylist-1-5-12:1.35 milter-greylist-1-5-11:1.35 milter-greylist-1-5-10:1.35 milter-greylist-1-5-9:1.35 milter-greylist-1-5-8:1.35 milter-greylist-1-5-7:1.35 milter-greylist-1-5-6:1.35 milter-greylist-1-5-5:1.35 milter-greylist-1-5-4:1.34 milter-greylist-1-5-3:1.33 milter-greylist-1-5-2:1.33 milter-greylist-1-5-1:1.33 milter-greylist-1-4:1.33.0.2 milter-greylist-1-4-base:1.33 milter-greylist-1-3-9:1.33 milter-greylist-1-3-8:1.32 milter-greylist-1-3-7:1.32 milter-greylist-1-3-6:1.32 milter-greylist-1-3-5:1.32 milter-greylist-1-3-4:1.32 milter-greylist-1-3-3:1.31 BDB:1.30.0.4 BDB-base:1.30 before_BDB:1.30 milter-greylist-1-2-2:1.30 milter-greylist-1-3-2:1.30 milter-greylist-1-2-1:1.30 milter-greylist-1-2-0:1.30 milter-greylist-1-2:1.30.0.2 milter-greylist-1-2-base:1.30 milter-greylist-1-1-16:1.30 milter-greylist-1-1-15:1.30 milter-greylis-1-1-15:1.30 milter-greylis-1-1-16:1.30 milter-greylist-1-1-14:1.30 milter-greylist-1-1-13:1.30 milter-greylist-1-1-12:1.30 milter-greylist-1-1-11:1.30 milter-greylist-1-1-10:1.28 milter-greylist-1-10rc1:1.28 milter-greylist-1-1-9:1.28 milter-greylist-1-1-8:1.27 milter-greylist-1-1-7:1.26 milter-greylist-1-1-6:1.26 milter-greylist-1-1-5:1.25 milter-greylist-1-1-4:1.24 milter-greylist-1-1-3:1.22 milter-greylist-1-1-2:1.22 milter-greylist-1-0-2:1.22 rmilter-greylist-1-0-1:1.22 milter-greylist-1-0-1:1.22 milter-greylist-1-1-1:1.22 milter-greylist-1-0-base:1.22 milter-greylist-1-0:1.22.0.2 milter-greylist-1-0-0:1.22 milter-greylist-0-27:1.22 milter-greylist-0-26:1.22 milter-greylist-0-25:1.22 milter-greylist-0-24:1.22 milter-greylist-0-23:1.21 milter-greylist-0-22:1.20 milter-greylist-0-21:1.20 milter-greylist-0-20:1.19 milter-greylist-0-19:1.19 milter-greylist-0-18:1.17 milter-greylist-0-17:1.17 milter-greylist-0-16:1.16 milter-greylist-0-15:1.14 milter-greylist-0-14:1.14 milter-greylist-0-13:1.14 milter-greylist-0-12:1.9 milter-greylist-0-11:1.9 milter-greylist-0-10:1.9 milter-greylist-0-9:1.9 milter-greylist-0-8:1.7 milter-greylist-0-7:1.6 milter-greylist-0-6:1.4 milter-greylist-0-5:1.3 milter-greylist-0-4:1.3 milter-greylist-0-3:1.3 milter-greylist-0-2:1.2 milter-greylist-0-1:1.2 milter-greylist:1.1.1.1 ESPCI:1.1.1; locks; strict; comment @ * @; 1.97 date 2014.12.17.08.36.43; author manu; state Exp; branches; next 1.96; 1.96 date 2014.02.07.13.46.46; author manu; state Exp; branches; next 1.95; 1.95 date 2013.10.04.12.17.38; author manu; state Exp; branches; next 1.94; 1.94 date 2013.09.01.04.59.42; author manu; state Exp; branches; next 1.93; 1.93 date 2013.08.18.04.45.30; author manu; state Exp; branches; next 1.92; 1.92 date 2012.09.20.08.31.49; author manu; state Exp; branches; next 1.91; 1.91 date 2012.09.19.02.04.38; author manu; state Exp; branches; next 1.90; 1.90 date 2012.09.11.04.29.19; author manu; state Exp; branches; next 1.89; 1.89 date 2012.02.21.05.53.44; author manu; state Exp; branches; next 1.88; 1.88 date 2012.02.20.13.49.52; author manu; state Exp; branches; next 1.87; 1.87 date 2012.02.20.13.47.21; author manu; state Exp; branches; next 1.86; 1.86 date 2012.02.18.16.09.29; author manu; state Exp; branches; next 1.85; 1.85 date 2012.02.18.05.14.25; author manu; state Exp; branches; next 1.84; 1.84 date 2010.07.12.01.38.14; author manu; state Exp; branches; next 1.83; 1.83 date 2010.06.22.02.13.04; author manu; state Exp; branches; next 1.82; 1.82 date 2010.06.21.20.20.19; author manu; state Exp; branches; next 1.81; 1.81 date 2010.06.16.01.30.30; author manu; state Exp; branches; next 1.80; 1.80 date 2009.11.01.02.03.33; author manu; state Exp; branches; next 1.79; 1.79 date 2009.10.31.21.28.03; author manu; state Exp; branches; next 1.78; 1.78 date 2009.09.07.12.56.54; author manu; state Exp; branches; next 1.77; 1.77 date 2008.11.26.05.20.13; author manu; state Exp; branches 1.77.2.1; next 1.76; 1.76 date 2008.09.26.23.35.44; author manu; state Exp; branches; next 1.75; 1.75 date 2008.09.26.20.40.01; author manu; state Exp; branches; next 1.74; 1.74 date 2008.09.07.00.13.34; author manu; state Exp; branches; next 1.73; 1.73 date 2008.08.21.21.05.35; author manu; state Exp; branches; next 1.72; 1.72 date 2008.08.03.05.00.06; author manu; state Exp; branches; next 1.71; 1.71 date 2007.11.11.11.57.19; author manu; state Exp; branches; next 1.70; 1.70 date 2007.11.06.11.39.33; author manu; state Exp; branches; next 1.69; 1.69 date 2007.10.03.10.52.23; author manu; state Exp; branches; next 1.68; 1.68 date 2007.05.02.03.36.50; author manu; state Exp; branches; next 1.67; 1.67 date 2007.04.16.02.47.52; author manu; state Exp; branches; next 1.66; 1.66 date 2007.03.29.03.58.51; author manu; state Exp; branches; next 1.65; 1.65 date 2007.03.22.05.39.16; author manu; state Exp; branches; next 1.64; 1.64 date 2007.02.26.04.27.50; author manu; state Exp; branches; next 1.63; 1.63 date 2007.02.24.22.10.21; author manu; state Exp; branches; next 1.62; 1.62 date 2007.02.05.06.05.34; author manu; state Exp; branches; next 1.61; 1.61 date 2007.02.02.07.00.06; author manu; state Exp; branches; next 1.60; 1.60 date 2007.01.29.04.57.18; author manu; state Exp; branches; next 1.59; 1.59 date 2007.01.28.02.16.33; author manu; state Exp; branches; next 1.58; 1.58 date 2007.01.16.05.10.38; author manu; state Exp; branches; next 1.57; 1.57 date 2007.01.10.10.54.26; author manu; state Exp; branches; next 1.56; 1.56 date 2007.01.04.23.01.46; author manu; state Exp; branches; next 1.55; 1.55 date 2007.01.03.05.53.30; author manu; state Exp; branches; next 1.54; 1.54 date 2007.01.01.17.29.29; author manu; state Exp; branches; next 1.53; 1.53 date 2006.12.29.18.32.44; author manu; state Exp; branches; next 1.52; 1.52 date 2006.12.26.21.21.52; author manu; state Exp; branches; next 1.51; 1.51 date 2006.12.24.19.04.08; author manu; state Exp; branches; next 1.50; 1.50 date 2006.12.20.21.57.53; author manu; state Exp; branches; next 1.49; 1.49 date 2006.11.07.05.12.01; author manu; state Exp; branches; next 1.48; 1.48 date 2006.10.05.20.05.56; author manu; state Exp; branches; next 1.47; 1.47 date 2006.09.04.21.28.18; author manu; state Exp; branches; next 1.46; 1.46 date 2006.08.30.04.57.58; author manu; state Exp; branches 1.46.2.1; next 1.45; 1.45 date 2006.08.27.20.54.41; author manu; state Exp; branches; next 1.44; 1.44 date 2006.08.20.06.38.43; author manu; state Exp; branches; next 1.43; 1.43 date 2006.08.01.21.29.36; author manu; state Exp; branches; next 1.42; 1.42 date 2006.07.26.13.03.11; author manu; state Exp; branches; next 1.41; 1.41 date 2006.07.26.08.22.41; author manu; state Exp; branches; next 1.40; 1.40 date 2006.04.13.17.32.25; author manu; state Exp; branches; next 1.39; 1.39 date 2006.01.22.17.15.32; author manu; state Exp; branches; next 1.38; 1.38 date 2006.01.08.00.38.25; author manu; state Exp; branches; next 1.37; 1.37 date 2005.01.29.18.42.53; author manu; state Exp; branches; next 1.36; 1.36 date 2004.12.08.22.23.09; author manu; state Exp; branches; next 1.35; 1.35 date 2004.08.02.12.11.48; author manu; state Exp; branches; next 1.34; 1.34 date 2004.08.01.09.27.03; author manu; state Exp; branches; next 1.33; 1.33 date 2004.06.08.14.47.47; author manu; state Exp; branches; next 1.32; 1.32 date 2004.05.26.21.50.13; author manu; state Exp; branches; next 1.31; 1.31 date 2004.05.25.09.39.49; author manu; state Exp; branches; next 1.30; 1.30 date 2004.04.08.15.06.07; author manu; state Exp; branches; next 1.29; 1.29 date 2004.04.08.11.32.53; author manu; state Exp; branches; next 1.28; 1.28 date 2004.04.02.08.57.18; author manu; state Exp; branches; next 1.27; 1.27 date 2004.04.01.20.36.00; author manu; state Exp; branches; next 1.26; 1.26 date 2004.04.01.07.16.30; author manu; state Exp; branches; next 1.25; 1.25 date 2004.03.31.15.31.59; author manu; state Exp; branches; next 1.24; 1.24 date 2004.03.31.10.07.17; author manu; state Exp; branches; next 1.23; 1.23 date 2004.03.31.09.49.16; author manu; state Exp; branches; next 1.22; 1.22 date 2004.03.22.17.55.25; author manu; state Exp; branches; next 1.21; 1.21 date 2004.03.22.07.01.53; author manu; state Exp; branches; next 1.20; 1.20 date 2004.03.20.07.19.03; author manu; state Exp; branches; next 1.19; 1.19 date 2004.03.18.09.55.15; author manu; state Exp; branches; next 1.18; 1.18 date 2004.03.17.17.33.40; author manu; state Exp; branches; next 1.17; 1.17 date 2004.03.13.15.12.42; author manu; state Exp; branches; next 1.16; 1.16 date 2004.03.13.13.54.30; author manu; state Exp; branches; next 1.15; 1.15 date 2004.03.12.11.00.10; author manu; state Exp; branches; next 1.14; 1.14 date 2004.03.11.14.12.48; author manu; state Exp; branches; next 1.13; 1.13 date 2004.03.10.21.11.45; author manu; state Exp; branches; next 1.12; 1.12 date 2004.03.10.20.36.29; author manu; state Exp; branches; next 1.11; 1.11 date 2004.03.10.14.24.34; author manu; state Exp; branches; next 1.10; 1.10 date 2004.03.08.22.14.12; author manu; state Exp; branches; next 1.9; 1.9 date 2004.03.04.09.40.12; author manu; state Exp; branches; next 1.8; 1.8 date 2004.03.04.08.38.26; author manu; state Exp; branches; next 1.7; 1.7 date 2004.03.03.19.17.39; author manu; state Exp; branches; next 1.6; 1.6 date 2004.03.03.16.52.04; author manu; state Exp; branches; next 1.5; 1.5 date 2004.03.03.16.30.12; author manu; state Exp; branches; next 1.4; 1.4 date 2004.03.02.16.26.40; author manu; state Exp; branches; next 1.3; 1.3 date 2004.02.29.23.01.27; author manu; state Exp; branches; next 1.2; 1.2 date 2004.02.21.09.42.07; author manu; state Exp; branches; next 1.1; 1.1 date 2004.02.21.00.01.17; author manu; state Exp; branches 1.1.1.1; next ; 1.77.2.1 date 2010.06.21.20.21.55; author manu; state Exp; branches; next 1.77.2.2; 1.77.2.2 date 2010.06.22.02.13.41; author manu; state Exp; branches; next ; 1.46.2.1 date 2006.09.04.22.05.59; author manu; state Exp; branches; next 1.46.2.2; 1.46.2.2 date 2006.10.05.20.05.17; author manu; state Exp; branches; next 1.46.2.3; 1.46.2.3 date 2006.11.07.05.12.12; author manu; state Exp; branches; next ; 1.1.1.1 date 2004.02.21.00.01.17; author manu; state Exp; branches; next ; desc @@ 1.97 log @Fix build on CentOS (Mart Pirita) @ text @/* $Id: milter-greylist.h,v 1.96 2014/02/07 13:46:46 manu Exp $ */ /* * Copyright (c) 2004-2012 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 _MILTER_GREYLIST_H_ #define _MILTER_GREYLIST_H_ #include #include #include #include #include #include "config.h" #include "dump.h" #ifdef USE_DKIM #ifdef HAVE_STDBOOL_H #include #endif #include #endif /* environment of Solaris workaround for stdio descriptor limitation */ #include "fd_pool.h" #define NUMLEN 20 #define QSTRLEN 4096 #define REGEXLEN 1024 #define HDRLEN 1024 #define HEADERNAME "X-Greylist" /* * Maximum URL length. This is just a hint, * the code will adjust the buffer if needed. */ #define URLMAXLEN 2083 LIST_HEAD(urlchecklist, urlcheck_entry); #if defined(HAVE_GETNAMEINFO) #define IPADDRSTRLEN NI_MAXHOST #elif defined(INET6_ADDRSTRLEN) #define IPADDRSTRLEN INET6_ADDRSTRLEN #else #define IPADDRSTRLEN IPADDRLEN #endif typedef union { struct in_addr in4; #ifdef AF_INET6 struct in6_addr in6; #endif } ipaddr; typedef union { struct sockaddr sa; struct sockaddr_in sin; #ifdef AF_INET6 struct sockaddr_in6 sin6; #endif } sockaddr_t; #define SA(sa) ((struct sockaddr *)(sa)) #define SA4(sa) ((struct sockaddr_in *)(sa)) #define SADDR4(sa) (&SA4(sa)->sin_addr) #ifdef AF_INET6 #define SA6(sa) ((struct sockaddr_in6 *)(sa)) #define SADDR6(sa) (&SA6(sa)->sin6_addr) #endif /* Notes: * -For IPv6 not using s6_addr32 as Solaris 8 for some reason has it only * defined for its kernel... * -Using also first two characters in "from" and "rcpt" to distribute * potentially lot of triplets coming from a single host (first two chars * only because "<>" is the "shortest" email address) */ #define F2B(s) (tolower((int)*(s)) | (tolower((int)*((s)+1)) << 8)) #define F2B_SPICE(from, rcpt) (conf.c_lazyaw ? 0 : (F2B(from) ^ F2B(rcpt))) #define BUCKET_HASH_V4(v4a, v4m, from, rcpt, bucket_count) \ ((ntohl((v4a)->s_addr & (v4m)->s_addr) \ ^ F2B_SPICE(from, rcpt)) \ % bucket_count) #ifdef AF_INET6 #define IN6CAST32(_a) ((uint32_t *)(&(_a)->s6_addr)) #define BUCKET_HASH_V6(v6a, v6m, from, rcpt, bucket_count) \ ((ntohl(IN6CAST32(v6a)[0] & IN6CAST32(v6m)[0]) ^ \ ntohl(IN6CAST32(v6a)[1] & IN6CAST32(v6m)[1]) ^ \ ntohl(IN6CAST32(v6a)[2] & IN6CAST32(v6m)[2]) ^ \ ntohl(IN6CAST32(v6a)[3] & IN6CAST32(v6m)[3]) \ ^ F2B_SPICE(from, rcpt)) \ % bucket_count) #define BUCKET_HASH(sa, from, rcpt, bucket_count) \ (sa->sa_family == AF_INET ? \ BUCKET_HASH_V4(SADDR4(sa), \ &conf.c_match_mask, \ from, rcpt, bucket_count) \ : sa->sa_family == AF_INET6 ? \ BUCKET_HASH_V6(SADDR6(sa), \ &conf.c_match_mask6, \ from, rcpt, bucket_count) \ : 0) #else /* AF_INET6 */ #define BUCKET_HASH(sa, from, rcpt, bucket_count) \ (sa->sa_family == AF_INET ? \ BUCKET_HASH_V4(SADDR4(sa), \ &conf.c_match_mask, \ from, rcpt, bucket_count) \ : 0) #endif typedef enum { TAP_SESSION, TAP_COMMAND } tarpit_scope_t; struct smtp_reply { long long sr_whitelist; int sr_nowhitelist; time_t sr_elapsed; time_t sr_remaining; int sr_acl_line; char *sr_acl_id; time_t sr_delay; time_t sr_autowhite; time_t sr_tarpit; tarpit_scope_t sr_tarpit_scope; char *sr_code; char *sr_ecode; char *sr_msg; char *sr_msg_x; char *sr_report; char *sr_report_x; char *sr_addheader; char *sr_addfooter; char *sr_subjtag; sfsistat sr_retcode; int sr_nmatch; char **sr_pmatch; }; struct rcpt { char r_addr[ADDRLEN + 1]; LIST_ENTRY(rcpt) r_list; }; struct line { char *l_line; size_t l_len; TAILQ_ENTRY(line) l_list; }; TAILQ_HEAD(bh_line, line); struct mlfi_priv { SMFICTX *priv_ctx; sockaddr_t priv_addr; socklen_t priv_addrlen; char priv_hostname[ADDRLEN + 1]; char priv_helo[ADDRLEN + 1]; char priv_from[ADDRLEN + 1]; LIST_HEAD(, rcpt) priv_rcpt; char priv_cur_rcpt[ADDRLEN + 1]; int priv_rcptcount; struct bh_line priv_header; struct bh_line priv_body; int priv_maxpeek; #ifdef USE_GEOIP const char *priv_ccode; #endif size_t priv_msgcount; size_t priv_peekcount; int priv_peekdone; char *priv_buf; size_t priv_buflen; char *priv_queueid; int priv_delayed_reject; struct smtp_reply priv_sr; time_t priv_max_elapsed; long long priv_last_whitelist; LIST_HEAD(, prop) priv_prop; struct prop *priv_prop_match; #ifdef USE_DNSRBL LIST_HEAD(, dnsrbl_list) priv_dnsrbl; #endif #ifdef USE_DKIM DKIM *priv_dkim; DKIM_STAT priv_dkimstat; #endif #ifdef USE_P0F char *priv_p0f; #endif #ifdef USE_SPAMD int priv_spamd_flags; int priv_spamd_score10; #endif time_t priv_max_tarpitted; time_t priv_total_tarpitted; struct acl_entry *priv_acl; /* current ACL being evaluated */ }; sfsistat mlfi_connect(SMFICTX *, char *, _SOCK_ADDR *); sfsistat mlfi_helo(SMFICTX *, char *); sfsistat mlfi_envfrom(SMFICTX *, char **); sfsistat mlfi_envrcpt(SMFICTX *, char **); sfsistat mlfi_header(SMFICTX *, char *, char *); sfsistat mlfi_eoh(SMFICTX *); sfsistat mlfi_body(SMFICTX *, unsigned char *, size_t); sfsistat mlfi_eom(SMFICTX *); sfsistat mlfi_abort(SMFICTX *); sfsistat mlfi_close(SMFICTX *); #ifdef HAVE_DATA_CALLBACK sfsistat mlfi_data(SMFICTX *); #endif void usage(char *); int humanized_atoi(char *); char *local_ipstr(struct mlfi_priv *); struct in_addr *prefix2mask4(int, struct in_addr *); #ifdef AF_INET6 struct in6_addr *prefix2mask6(int, struct in6_addr *); #endif void unmappedaddr(struct sockaddr *, socklen_t *); void final_dump(void); int main(int, char **); void mg_log(int, char *, ...); char *strncpy_rmsp(char *, char *, size_t); char *fstring_expand(struct mlfi_priv *, char *, const char *, char *(*)(char *)); char *fstring_escape(char *); void mkparentdir(char *, mode_t); #ifdef HAVE_STRLCAT /* #include */ #define mystrlcat strlcat #else size_t mystrlcat(char *, const char *src, size_t size); #endif /* * Locking management */ #define WRLOCK(lock) { \ int err; \ \ if ((err = pthread_rwlock_wrlock(&(lock))) != 0) { \ syslog(LOG_ERR, "%s:%d pthread_rwlock_wrlock failed: %s", \ __FILE__, __LINE__, strerror(err)); \ exit(EX_SOFTWARE); \ } \ } #define RDLOCK(lock) { \ int err; \ \ if ((err = pthread_rwlock_rdlock(&(lock))) != 0) { \ syslog(LOG_ERR, "%s:%d pthread_rwlock_rdlock failed: %s", \ __FILE__, __LINE__, strerror(err)); \ exit(EX_SOFTWARE); \ } \ } #define TSS_SET(key, val) do { \ int err; \ \ if ((err = pthread_setspecific(key, val)) != 0) { \ mg_log(LOG_ERR, "%s:%d pthread_setspecific failed: %s", \ __FILE__, __LINE__, strerror(err)); \ exit(EX_SOFTWARE); \ } \ } while (/*CONSTCOND*/ 0) /* * There is a bug in GNU pth-2.0.0 that will cause a spurious EPERM * error when a thread releases a read lock that has been shared by * two threads and already released by the other one. As a workaround * for that problem, we just avoid quitting on this error. */ #ifndef HAVE_BROKEN_RWLOCK #define UNLOCK(lock) { \ int err; \ \ if ((err = pthread_rwlock_unlock(&(lock))) != 0) { \ syslog(LOG_ERR, "%s:%d pthread_rwlock_unlock failed: %s", \ __FILE__, __LINE__, strerror(err)); \ exit(EX_SOFTWARE); \ } \ } #else #define UNLOCK(lock) { \ int err; \ \ if ((err = pthread_rwlock_unlock(&(lock))) != 0) { \ syslog(LOG_DEBUG, "%s:%d pthread_rwlock_unlock failed: " \ "%s (ignored)", __FILE__, __LINE__, strerror(err)); \ } \ } #endif #ifdef HAVE_MISSING_TIMERADD #define timeradd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ if ((vvp)->tv_usec >= 1000000) { \ (vvp)->tv_sec++; \ (vvp)->tv_usec -= 1000000; \ } \ } while (/* CONSTCOND */ 0) #define timersub(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ if ((vvp)->tv_usec < 0) { \ (vvp)->tv_sec--; \ (vvp)->tv_usec += 1000000; \ } \ } while (/* CONSTCOND */ 0) #endif #define ADD_REASON(whystr, reason) \ { \ if (whystr[0] != '\0') \ mystrlcat(whystr, ", ", sizeof(whystr)); \ mystrlcat(whystr, reason, sizeof(whystr)); \ } /* * Due to race conditions in the libmilter shipped with sendmail <= 8.13.8, * the whole process may die after receiving a signal. * It makes impossible the final dump. Apply the following patch ASAP: * http://www.j10n.org/files/libmilter-8.13.8-signal.patch * * If you don't want to apply it, the following knob enables an uncertain * effort to workaround the bug. Do not ask me about this. * */ /* #define WORKAROUND_LIBMILTER_RACE_CONDITION */ /* * We may want to check SOCK_CLOEXEC as well for close-on-exec * availlability for sockets. On the other hand, if the * functionnality is not there, fcntl(F_SETFD) will just * silently fail. */ #ifdef FD_CLOEXEC #define SET_CLOEXEC(fd) do { \ int flags = fcntl((fd), F_GETFD, 0); \ \ if (flags != -1) \ (void)fcntl(fd, F_SETFD, flags|FD_CLOEXEC); \ } while (0 /* CONSTCOND */) #else /* FD_CLOEXEC */ #define SET_CLOEXEC(fd) #endif /* FD_CLOEXEC */ #endif /* _MILTER_GREYLIST_H_ */ @ 1.96 log @Fix msgcount miscomputation and crashes @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.95 2013/10/04 12:17:38 manu Exp $ */ a252 1 #ifndef USE_POSTFIX a253 1 #endif @ 1.95 log @Support OpenDKIM (John Wood) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.94 2013/09/01 04:59:42 manu Exp $ */ d208 2 @ 1.94 log @ Add %cA and %ca to report current ACL line number and id Increase format string maximum length to 4096 Break long SMTP replies in mutiple lines @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.93 2013/08/18 04:45:30 manu Exp $ */ d40 4 a50 4 #include #include "config.h" #include "dump.h" @ 1.93 log @set ACL clause to set/increment/decrement properties log ACL clause to send formatted string to syslog @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.92 2012/09/20 08:31:49 manu Exp $ */ d55 1 a55 1 #define QSTRLEN 1024 d233 1 @ 1.92 log @- Format string substitution get %-encoding for urlcheck - Format string substitution get \-escapes and %-encoding for ldapcheck - bump to 4.4a3 @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.91 2012/09/19 02:04:38 manu Exp $ */ a214 1 #if defined(USE_CURL) || defined(USE_LDAP) a216 1 #endif /* USE_CURL || USE_LDAP */ @ 1.91 log @- Add subjtag clause in DATA stage ACL to add a tag to message subject - Allow comparison of msgsize, rcptcount & spamd, against values from LDAP @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.90 2012/09/11 04:29:19 manu Exp $ */ d265 1 a265 1 char *, const char *); @ 1.90 log @Mkdir parent dir for pidfile/socket/dumpfile Add helpful error message if mkdir fails Fix duplicate logging when run with -D via systemd @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.89 2012/02/21 05:53:44 manu Exp $ */ d172 1 @ 1.89 log @p0f v3 support bump to 4.4a1 @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.84 2010/07/12 01:38:14 manu Exp $ */ d266 1 @ 1.88 log @Add continue type AC @ text @d4 1 a4 1 * Copyright (c) 2004-2010 Emmanuel Dreyfus @ 1.87 log @- Add a addfooter action clause in ACL, to add mail a footer - Allow per-dacl maxpeek setting, set by maxpeer action clause in racl - Add LDAP or CURL gathered property substitution in format strings @ text @@ 1.86 log @Add format string to report last matching LDAP or CURL propery Fix memory corruption bug Refactor prop_clear*() into a ingle function @ text @d171 1 d202 1 @ 1.85 log @Allow filtering header and body against LDAP or CURL gathered properties Merge struct body and struct header into struct line, for the sake of code reusing @ text @d197 1 a197 1 char *priv_cur_rcpt; d214 2 a215 1 #endif @ 1.84 log @Fix spamd hang if message contains NULL (Enrico Scholz) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.83 2010/06/22 02:13:04 manu Exp $ */ d181 4 a184 4 struct header { char *h_line; size_t h_len; TAILQ_ENTRY(header) h_list; d187 1 a187 5 struct body { char *b_lines; size_t b_len; TAILQ_ENTRY(body) b_list; }; d199 2 a200 2 TAILQ_HEAD(, header) priv_header; TAILQ_HEAD(, body) priv_body; @ 1.83 log @Back out previous change, which has unclear security implications yet. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.82 2010/06/21 20:20:19 manu Exp $ */ d183 1 d189 1 @ 1.82 log @Avoid spamd hang on malformed messages @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.81 2010/06/16 01:30:30 manu Exp $ */ a182 1 size_t h_len; a187 1 size_t b_len; @ 1.81 log @Close-on-exec sockets to avoid file shortage with stat (Enrico Scholz) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.80 2009/11/01 02:03:33 manu Exp $ */ d183 1 d189 1 @ 1.80 log @More variables that needed to be 64 bits. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.79 2009/10/31 21:28:03 manu Exp $ */ d4 1 a4 1 * Copyright (c) 2004-2007 Emmanuel Dreyfus d373 17 a390 1 @ 1.79 log @Add mx ACL clause (Rudy Eschauzier) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.78 2009/09/07 12:56:54 manu Exp $ */ d213 1 a213 1 int priv_last_whitelist; @ 1.78 log @New tarpit feature (Kouhei Sutou) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.77 2008/11/26 05:20:13 manu Exp $ */ d154 1 a154 1 int sr_whitelist; @ 1.77 log @Allow regex on properties Allow extended regex substitution Custom headers can now be added to the message Bump to 4.1.8 @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.76 2008/09/26 23:35:44 manu Exp $ */ d148 5 d162 2 d231 2 d243 1 d245 3 @ 1.77.2.1 log @Avoid spamd hang on malformed messages @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.77 2008/11/26 05:20:13 manu Exp $ */ a175 1 size_t h_len; a180 1 size_t b_len; @ 1.77.2.2 log @Back out previous change, which has unclear security implications yet. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.77.2.1 2010/06/21 20:21:55 manu Exp $ */ d176 1 d182 1 @ 1.76 log @Spamassassin support and DATA-stage greylisting (Manuel Badzong) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.75 2008/09/26 20:40:01 manu Exp $ */ d163 1 @ 1.75 log @Ease DKIM build (Ondrej Valousek) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.74 2008/09/07 00:13:34 manu Exp $ */ d219 4 @ 1.74 log @Experimental p0f support Fix a memory leak in GeoIP code Fix a memory leak in DKIM code Bump to revision to 4.1.6 (but no tag yet) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.73 2008/08/21 21:05:35 manu Exp $ */ d41 3 @ 1.73 log @Exprimental DKIM support @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.72 2008/08/03 05:00:06 manu Exp $ */ d213 3 @ 1.72 log @Native LDAP support through OpenLDAP bump to 4.1.4 @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.71 2007/11/11 11:57:19 manu Exp $ */ d40 4 d209 4 d220 1 @ 1.71 log @Add ACL id string @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.70 2007/11/06 11:39:33 manu Exp $ */ d199 2 a200 2 #ifdef USE_CURL LIST_HEAD(, urlcheck_prop) priv_prop; @ 1.70 log @Add SPF status selection to ACL @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.69 2007/10/03 10:52:23 manu Exp $ */ d147 1 @ 1.69 log @Workaround for Solaris 256 stream limitation (Johann E. Klasek) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.68 2007/05/02 03:36:50 manu Exp $ */ d216 3 @ 1.68 log @Use static. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.67 2007/04/16 02:47:52 manu Exp $ */ d44 3 @ 1.67 log @Fix X-Greylist lossage (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.66 2007/03/29 03:58:51 manu Exp $ */ a216 1 void cleanup_sock(char *); @ 1.66 log @%% syntax in format strings (AIDA Shinra) Clarified "%Xm" and "%Xh" semantics (AIDA Shinra) Fixed a memory leak at mlfi_eom (AIDA Shinra) ix a bug where doing RCPT twice when blacklised succeed (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.65 2007/03/22 05:39:16 manu Exp $ */ d193 2 @ 1.65 log @Allow filtering on the HELO string @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.64 2007/02/26 04:27:50 manu Exp $ */ d149 1 d151 1 @ 1.64 log @- %D format string for getting the list of matching DNSRBL - Avoid performing multiple DNSRBL checks for the same IP @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.63 2007/02/24 22:10:21 manu Exp $ */ a229 7 #if (defined(HAVE_SPF) || defined(HAVE_SPF_ALT)) #define MLFI_HELO mlfi_helo #else #define MLFI_HELO NULL #endif @ 1.63 log @Allow reusing in the ACL of properties gathered from urlcheck @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.62 2007/02/05 06:05:34 manu Exp $ */ d194 3 @ 1.62 log @%g for substitution by regex back references %I for susbtitution by sender IP masked by a CIDR @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.61 2007/02/02 07:00:06 manu Exp $ */ d191 3 @ 1.61 log @Add GeoIP support @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.60 2007/01/29 04:57:18 manu Exp $ */ d151 2 @ 1.60 log @msg clauses in ACL can use format strings substitution Add an ACL clause to customize X-Greylist header @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.59 2007/01/28 02:16:33 manu Exp $ */ d180 3 @ 1.59 log @ACL clauses can now be negated @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.58 2007/01/16 05:10:38 manu Exp $ */ d149 1 d209 1 a209 1 char *, char *); @ 1.58 log @Use TAILQ_* instead of SIMPLEQ_*, as the SIMPLEQ_* definition is not the same on different systems. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.57 2007/01/10 10:54:26 manu Exp $ */ d4 1 a4 1 * Copyright (c) 2004 Emmanuel Dreyfus d140 1 @ 1.57 log @Add msgsize and rcptcount clauses to ACL Allow rcpt clause at DATA stage ACL @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.56 2007/01/04 23:01:46 manu Exp $ */ d158 1 a158 1 SIMPLEQ_ENTRY(header) h_list; d163 1 a163 1 SIMPLEQ_ENTRY(body) b_list; d176 2 a177 2 SIMPLEQ_HEAD(, header) priv_header; SIMPLEQ_HEAD(, body) priv_body; @ 1.56 log @Optionnaly post the message body to an URL check at DATA stage (see postmsg in greylist.conf(5) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.55 2007/01/03 05:53:30 manu Exp $ */ d175 1 @ 1.55 log @Build fix @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.54 2007/01/01 17:29:29 manu Exp $ */ d158 1 a158 1 LIST_ENTRY(header) h_list; d163 1 a163 1 LIST_ENTRY(body) b_list; d175 2 a176 2 LIST_HEAD(, header) priv_header; LIST_HEAD(, body) priv_body; @ 1.54 log @Add custom logs of milter-greylist actions, see stat in greylist.conf(5) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.53 2006/12/29 18:32:44 manu Exp $ */ d49 8 @ 1.53 log @Major refactoring of ACL code. Remove a lot of duplicate code. Allow multiple macro, dnsrbl, urlcheck, body and header clauses in ACL @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.52 2006/12/26 21:21:52 manu Exp $ */ d140 1 d197 3 @ 1.52 log @Allow header and body searches in DATA-stage ACL Allow CIDR match for DNSRBL (not tested) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.51 2006/12/24 19:04:08 manu Exp $ */ d158 1 @ 1.51 log @Log and report multiple recipients in delayed rejects @ text @d1 1 a1 2 /* $Id: milter-greylist.h,v 1.50 2006/12/20 21:57:53 manu Exp $ */ /* vim: set sw=8 ts=8 sts=8 noet cino=(0: */ d147 10 d164 6 d179 2 @ 1.50 log @DATA stage ACL, with some limitations: only whitelist or blacklist, and no access to rcpt. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.49 2006/11/07 05:12:01 manu Exp $ */ d143 5 d154 1 a154 1 char priv_rcpt[ADDRLEN + 1]; @ 1.49 log @Fix crashes during dump reloads (AIDA Shinra) Fix DoS in MX sync protocol (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.48 2006/10/05 20:05:56 manu Exp $ */ d131 12 a149 2 time_t priv_elapsed; int priv_whitelist; d152 1 a152 7 time_t priv_remaining; int priv_acl_line; time_t priv_delay; time_t priv_autowhite; char *priv_code; char *priv_ecode; char *priv_msg; @ 1.48 log @FreeBSD build fixes from Hajimu UMEMOTO @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.47 2006/09/04 21:28:18 manu Exp $ */ d168 1 @ 1.47 log @Fix various race conditions (AIDA Shinra) Fix big bugs in macro support (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.46 2006/08/30 04:57:58 manu Exp $ */ d37 1 a38 1 #include @ 1.46 log @Fix various race conditions (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.45 2006/08/27 20:54:41 manu Exp $ */ d271 12 @ 1.46.2.1 log @Back out race conditions fixes (too intrusive, will be back in 3.1.x) @ text @d2 1 d206 10 @ 1.46.2.2 log @FreeBSD build fixes Hajimu UMEMOTO @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.46.2.1 2006/09/04 22:05:59 manu Exp $ */ d36 1 a37 1 #include @ 1.46.2.3 log @Fix crashes during dump reloads (AIDA Shinra) Fix DoS in MX sync protocol (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.46.2.2 2006/10/05 20:05:17 manu Exp $ */ a166 1 char *strncpy_rmsp(char *, char *, size_t); @ 1.45 log @Remove the need of LOG_PERROR, make sure no log is missed @ text @d1 2 a2 1 /* $Id: milter-greylist.h,v 1.44 2006/08/20 06:38:43 manu Exp $ */ d206 10 @ 1.44 log @Fix improper strncpy usage (AIDA Shinra) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.43 2006/08/01 21:29:36 manu Exp $ */ d166 1 a231 8 /* * Some systems don't know about LOG_PERROR. By defining it * to zero, we make it nilpotent */ #ifdef HAVE_MISSING_LOG_PERROR #define LOG_PERROR 0 #endif @ 1.43 log @per-ACL code and SMTP replies @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.42 2006/07/26 13:03:11 manu Exp $ */ d167 7 d263 2 a264 2 strncat(whystr, ", ", sizeof(whystr)); \ strncat(whystr, reason, sizeof(whystr)); \ @ 1.42 log @Rename PATH -> QSTRING @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.41 2006/07/26 08:22:41 manu Exp $ */ d143 5 @ 1.41 log @Report matching ACL line number in the logs @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.40 2006/04/13 17:32:25 manu Exp $ */ d45 1 a45 1 #define PATHLEN 1024 @ 1.40 log @Fixes to bucketed databases when using lazyaw (Ranko Zivojnovic) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.39 2006/01/22 17:15:32 manu Exp $ */ d142 1 @ 1.39 log @Build fix for IPv6 (Ranko Zivojnovic) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.38 2006/01/08 00:38:25 manu Exp $ */ d83 5 a87 3 * -For IPv6 not using s6_addr32 as Solaris 8 for some reason has it only defined for its kernel... * -Using also first two characters in "from" and "rcpt" to distribute potentially lot of triplets * coming from a single host (first two chars only because "<>" is the "shortest" email address) d90 7 d98 29 a126 8 #define BUCKET_HASH(sa, from, rcpt, bucket_count) \ (sa->sa_family == AF_INET ? \ ((ntohl(SADDR4(sa)->s_addr) ^ F2B(from) ^ F2B(rcpt)) \ % bucket_count) \ : sa->sa_family == AF_INET6 ? \ (((uint32_t)(SADDR6(sa)->s6_addr)[3] ^ F2B(from) ^ F2B(rcpt)) \ % bucket_count) \ : 0) a127 6 #else #define BUCKET_HASH(sa, from, rcpt, bucket_count) \ (sa->sa_family == AF_INET ? \ ((ntohl(SADDR4(sa)->s_addr) ^ F2B(from) ^ F2B(rcpt)) \ % bucket_count) \ : 0) @ 1.38 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: milter-greylist.h,v 1.37 2005/01/29 18:42:53 manu Exp $ */ a81 1 #ifdef AF_INET6 d88 1 @ 1.37 log @Delayed reject for <> sender to cope better with sender callback (Moritz Both) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.36 2004/12/08 22:23:09 manu Exp $ */ d82 24 @ 1.36 log @New ACL framework for whitelist and greylist (Remy Card) Tell MX peers about autowhitelist prolongation (Remy Card) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.35 2004/08/02 12:11:48 manu Exp $ */ d88 1 d92 2 @ 1.35 log @Changed ipaddr_t into ipaddr to fix a build problem on Solaris @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.34 2004/08/01 09:27:03 manu Exp $ */ d47 1 a47 1 #define HDRLEN 195 d196 7 @ 1.34 log @Full blown IPv6 support, from Hajimu Umemoto Correctly clean rc-debian.sh @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.33 2004/06/08 14:47:47 manu Exp $ */ d64 1 a64 1 } ipaddr_t; @ 1.33 log @Correctly check pthread function return values @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.32 2004/05/26 21:50:13 manu Exp $ */ d38 1 d47 1 a47 1 #define HDRLEN 160 d50 32 d83 2 a84 1 struct in_addr priv_addr; d101 4 a104 1 struct in_addr *cidr2mask(int, struct in_addr *); d106 1 @ 1.32 log @DNS support in greylist.conf through the domain keyword @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.31 2004/05/25 09:39:49 manu Exp $ */ d82 4 a85 1 #define WRLOCK(lock) if (pthread_rwlock_wrlock(&(lock)) != 0) { \ d87 1 a87 1 __FILE__, __LINE__, strerror(errno)); \ d89 7 a95 2 } #define RDLOCK(lock) if (pthread_rwlock_rdlock(&(lock)) != 0) { \ d97 1 a97 1 __FILE__, __LINE__, strerror(errno)); \ d99 2 a100 1 } d109 4 a112 1 #define UNLOCK(lock) if (pthread_rwlock_unlock(&(lock)) != 0) { \ d114 1 a114 1 __FILE__, __LINE__, strerror(errno)); \ d116 2 a117 1 } d119 4 a122 1 #define UNLOCK(lock) if (pthread_rwlock_unlock(&(lock)) != 0) { \ d124 3 a126 2 "%s (ignored)", __FILE__, __LINE__, strerror(errno)); \ } @ 1.31 log @Final dump on program termination @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.30 2004/04/08 15:06:07 manu Exp $ */ d51 1 @ 1.30 log @Don't enable the helo callback if building without SPF @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.29 2004/04/08 11:32:53 manu Exp $ */ d68 1 @ 1.29 log @ksh: q: not found @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.28 2004/04/02 08:57:18 manu Exp $ */ d69 7 @ 1.28 log @Fix build troubles by removing any reference to in_addr_t @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.27 2004/04/01 20:36:00 manu Exp $ */ d51 1 d59 1 @ 1.27 log @Use regex for from and rcpt config lines @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.26 2004/04/01 07:16:30 manu Exp $ */ d64 1 a64 1 in_addr_t *cidr2mask(int, in_addr_t *); @ 1.26 log @Fix a build problem on Linux @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.25 2004/03/31 15:31:59 manu Exp $ */ d45 1 @ 1.25 log @Attempt to fix a warning on Solaris @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.24 2004/03/31 10:07:17 manu Exp $ */ d34 4 @ 1.24 log @Added an option for subnet mask @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.23 2004/03/31 09:49:16 manu Exp $ */ d59 1 a59 1 struct in_addr * cidr2mask(int, struct in_addr *); @ 1.23 log @Add flag equivalents to the config file @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.22 2004/03/22 17:55:25 manu Exp $ */ d59 1 @ 1.22 log @Build on Solaris @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.21 2004/03/22 07:01:53 manu Exp $ */ d39 2 a51 2 extern int debug; d58 1 @ 1.21 log @More casts for DigitalUNIX @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.20 2004/03/20 07:19:03 manu Exp $ */ d94 29 d124 1 @ 1.20 log @Print the message Id with the logs @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.19 2004/03/18 09:55:15 manu Exp $ */ d45 1 a45 1 long priv_elapsed; @ 1.19 log @Use a modern queue.h if it is missing from the system (Linux...) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.18 2004/03/17 17:33:40 manu Exp $ */ d47 1 @ 1.18 log @Move away the dumper thread from pending.c as it will also dump the autowhitelist now @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.17 2004/03/13 15:12:42 manu Exp $ */ a92 35 /* * Theses definitions are missing from Linux's */ #ifndef TAILQ_FOREACH #define TAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->tqh_first); \ (var); \ (var) = ((var)->field.tqe_next)) #endif #ifndef LIST_FOREACH #define LIST_FOREACH(var, head, field) \ for ((var) = ((head)->lh_first); \ (var); \ (var) = ((var)->field.le_next)) #endif #ifndef LIST_FIRST #define LIST_FIRST(head) ((head)->lh_first) #endif #ifndef LIST_EMPTY #define LIST_EMPTY(head) ((head)->lh_first == NULL) #endif #ifndef TAILQ_FIRST #define TAILQ_FIRST(head) ((head)->tqh_first) #endif #ifndef TAILQ_EMPTY #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #endif @ 1.17 log @Don't exit at all on pthread_rwlock_unlock failure if we have a broken libpthread @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.16 2004/03/13 13:54:30 manu Exp $ */ d37 1 @ 1.16 log @Workaround the bug with libpthread's rwlock. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.15 2004/03/12 11:00:10 manu Exp $ */ d87 2 a88 4 syslog(LOG_ERR, "%s:%d pthread_rwlock_unlock failed: %s", \ __FILE__, __LINE__, strerror(errno)); \ if (errno != EPERM) \ exit(EX_SOFTWARE); \ @ 1.15 log @Fix error log message @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.14 2004/03/11 14:12:48 manu Exp $ */ d36 1 d72 8 d85 8 @ 1.14 log @Rebuild on Linux Build again with -Werror, both on Linux and NetBSD! @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.13 2004/03/10 21:11:45 manu Exp $ */ d67 1 a67 1 syslog(LOG_ERR, "%s:%d pthread_rwlock_wrlock failed: %s", \ d72 1 a72 1 syslog(LOG_ERR, "%s:%d pthread_rwlock_wrlock failed: %s", \ @ 1.13 log @Renamed except.greylist as except.conf, split the cde between exception list management and config management @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.12 2004/03/10 20:36:29 manu Exp $ */ d101 10 @ 1.12 log @Fix time diff display in debug output Get safer sync, by maintaining a per peer queue. When a peer is unreachable, its queue is not touched until it gets back again @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.11 2004/03/10 14:24:34 manu Exp $ */ d46 2 @ 1.11 log @Remove unused code factor locking defines @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.10 2004/03/08 22:14:12 manu Exp $ */ d59 4 a62 4 #define WRLOCK(lock) if (pthread_rwlock_wrlock(&(lock)) != 0) { \ syslog(LOG_ERR, "%s:%d pthread_rwlock_wrlock failed", \ __FILE__, __LINE__); \ exit(EX_SOFTWARE); \ d64 4 a67 4 #define RDLOCK(lock) if (pthread_rwlock_rdlock(&(lock)) != 0) { \ syslog(LOG_ERR, "%s:%d pthread_rwlock_wrlock failed", \ __FILE__, __LINE__); \ exit(EX_SOFTWARE); \ d69 4 a72 4 #define UNLOCK(lock) if (pthread_rwlock_unlock(&(lock)) != 0) { \ syslog(LOG_ERR, "%s:%d pthread_rwlock_wrlock failed", \ __FILE__, __LINE__); \ exit(EX_SOFTWARE); \ @ 1.10 log @More -Wwhatever stuff fixed @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.9 2004/03/04 09:40:12 manu Exp $ */ d55 19 @ 1.9 log @Auto-reload exception file when it is modified @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.8 2004/03/04 08:38:26 manu Exp $ */ d54 1 @ 1.8 log @Show the reason why the message was not delayed in the X-Greylist header (sender IP whitelisted or whatever) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.7 2004/03/03 19:17:39 manu Exp $ */ d70 8 @ 1.7 log @Display the machine name and local date in X-Greylist header @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.6 2004/03/03 16:52:04 manu Exp $ */ d44 1 @ 1.6 log @Fixed header problem: only smfi_eom can create headers. @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.5 2004/03/03 16:30:12 manu Exp $ */ d37 1 a37 1 #define HDRLEN 80 @ 1.5 log @Report how many time has been spent in milter-greylist once message have passed, and how many time to go when refusing messages (this can be disabled this -q) @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.4 2004/03/02 16:26:40 manu Exp $ */ d43 1 d49 1 @ 1.4 log @Build on Linux Move from inet_aton to inet_pton Bump to 0.6 @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.3 2004/02/29 23:01:27 manu Exp $ */ d36 3 @ 1.3 log @Cleanup function to remove stale socket Fork to become a daemon -D flag to preventy the fork @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.2 2004/02/21 09:42:07 manu Exp $ */ d35 2 d49 17 @ 1.2 log @Removed useless boolean defs @ text @d1 1 a1 1 /* $Id: milter-greylist.h,v 1.1.1.1 2004/02/21 00:01:17 manu Exp $ */ d45 1 @ 1.1 log @Initial revision @ text @d1 1 a1 1 /* $Id$ */ a33 6 #ifndef true typedef int bool; # define false 0 # define true 1 #endif /* ! true */ @ 1.1.1.1 log @greylisting milter for sendmail @ text @@