--- gld-1.5.2/greylist.c 2005-04-21 05:41:09.000000000 -0400 +++ gld-1.5.2/greylist.c 2005-10-20 14:05:05.000000000 -0400 @@ -181,10 +181,28 @@ else if(conf->update==1) { - if(conf->lightd==1 && fnotdomain==1) - snprintf(query,sizeof(query)-1,"update greylist set last=%d,n=n+1 where ip='%s' and sender='%s' and recipient='%s'",ts,ip,osender,orecipient); + if(ts-n>conf->mini) + { + if(conf->lightd==1 && fnotdomain==1) + snprintf(query,sizeof(query)-1,"update greylist set last=%d,n=n+1 where ip='%s' and sender='%s' and recipient='%s'",ts,ip,osender,orecipient); - snprintf(query,sizeof(query)-1,"update greylist set last=%d,n=n+1 where ip='%s' and sender='%s' and recipient='%s'",ts,ip,sender,recipient); + snprintf(query,sizeof(query)-1,"update greylist set last=%d,n=n+1 where ip='%s' and sender='%s' and recipient='%s'",ts,ip,sender,recipient); + } + else + { + // + // We have NOT reached the greylist-timeout, so we do NOT increase the message-counter (SQL-field n), + // because otherwise we will braek the MXGREY-option. + // In fact this means that the THIRD retry will immidiately pass the greylist, as mxgrey checks only for ip and (n>1). + // + // 2005-08-16 martin@it4linux.de + // + + if(conf->lightd==1 && fnotdomain==1) + snprintf(query,sizeof(query)-1,"update greylist set last=%d where ip='%s' and sender='%s' and recipient='%s'",ts,ip,osender,orecipient); + + snprintf(query,sizeof(query)-1,"update greylist set last=%d where ip='%s' and sender='%s' and recipient='%s'",ts,ip,sender,recipient); + } SQLQuery(query); if(conf->debug==1) printf("%d: Query=(%s)\n",pid,query);