# HG changeset patch # User carl # Date 1123439197 25200 # Node ID 946fc1bcfb2c2399be3554cbec621a2a4046b367 # Parent 7245c45cef7aa14a6b0bab43e8fc78aad42bf249 don't load null config pointer, keep the old one diff -r 7245c45cef7a -r 946fc1bcfb2c ChangeLog --- a/ChangeLog Mon Aug 01 19:32:03 2005 -0700 +++ b/ChangeLog Sun Aug 07 11:26:37 2005 -0700 @@ -1,5 +1,11 @@ $Id$ +5.3 2005-08-07 + Properly quit if the config file has syntax errors on startup. Send + mail to root if the config file needs to be reloaded since it was + modified, but contains syntax errors. In this case, we continue to + use the old configuration. + 5.2 2005-08-02 Patch from Stephen Johnson fixing the lack of a default return value in CONTEXT::acceptable_content(). diff -r 7245c45cef7a -r 946fc1bcfb2c dnsbl.spec.in --- a/dnsbl.spec.in Mon Aug 01 19:32:03 2005 -0700 +++ b/dnsbl.spec.in Sun Aug 07 11:26:37 2005 -0700 @@ -1,6 +1,6 @@ Summary: DNSBL Sendmail Milter Name: dnsbl -Version: 5.2 +Version: 5.3 Release: 2 Copyright: GPL Group: System Environment/Daemons diff -r 7245c45cef7a -r 946fc1bcfb2c package.bash --- a/package.bash Mon Aug 01 19:32:03 2005 -0700 +++ b/package.bash Sun Aug 07 11:26:37 2005 -0700 @@ -1,6 +1,6 @@ #!/bin/bash -VER=dnsbl-5.2 +VER=dnsbl-5.3 mkdir $VER target1=/home/httpd/html/510sg/util/dnsbl.tar.gz target2=/home/httpd/html/510sg/dnsbl.conf diff -r 7245c45cef7a -r 946fc1bcfb2c src/dnsbl.cpp --- a/src/dnsbl.cpp Mon Aug 01 19:32:03 2005 -0700 +++ b/src/dnsbl.cpp Sun Aug 07 11:26:37 2005 -0700 @@ -1007,6 +1007,7 @@ } if (reload) { CONFIG *newc = new_conf(); + if (newc) { // replace the global config pointer pthread_mutex_lock(&config_mutex); CONFIG *old = config; @@ -1014,6 +1015,14 @@ pthread_mutex_unlock(&config_mutex); if (old) old_configs.insert(old); } + else { + // failed to load new config + my_syslog("failed to load new configuration"); + system("echo 'failed to load new dnsbl configuration from /etc/dnsbl' | mail -s 'error in /etc/dnsbl configuration' root"); + // update the load time on the current config to prevent complaining every 3 minutes + dc.load_time = time(NULL); + } + } // now look for old configs with zero ref counts for (configp_set::iterator i=old_configs.begin(); i!=old_configs.end(); ) { CONFIG *old = *i; @@ -1266,6 +1275,13 @@ } } + // load the initial config + config = new_conf(); + if (!config) { + my_syslog("failed to load initial configuration, quitting"); + exit(1); + } + // fork off the resolver listener process pid_t child = fork(); if (child < 0) { @@ -1336,9 +1352,6 @@ sleep(2); // allow child to get started } - // load the initial config - config = new_conf(); - // only create threads after the fork() in daemon pthread_t tid; if (pthread_create(&tid, 0, config_loader, 0)) diff -r 7245c45cef7a -r 946fc1bcfb2c test.bash --- a/test.bash Mon Aug 01 19:32:03 2005 -0700 +++ b/test.bash Sun Aug 07 11:26:37 2005 -0700 @@ -47,7 +47,7 @@ chmod 700 /var/run/dnsbl chown dnsbl:dnsbl /var/run/dnsbl mv -f $pid $pid.save -./dnsbl -d -r /var/run/dnsbl/dnsbl.resolver.sock2 -p local:/var/run/dnsbl/dnsbl.sock2 +./dnsbl -d 10 -r /var/run/dnsbl/dnsbl.resolver.sock2 -p local:/var/run/dnsbl/dnsbl.sock2 sleep 5 P2=`cat $pid` mv -f $pid.save $pid diff -r 7245c45cef7a -r 946fc1bcfb2c xml/dnsbl.in --- a/xml/dnsbl.in Mon Aug 01 19:32:03 2005 -0700 +++ b/xml/dnsbl.in Sun Aug 07 11:26:37 2005 -0700 @@ -2,7 +2,7 @@ -DNSBL Sendmail milter - Version 5.2 +DNSBL Sendmail milter - Version 5.3
Introduction
@@ -30,6 +30,12 @@

The DNSBL milter reads a text configuration file (dnsbl.conf) on startup, and whenever the config file (or any of the referenced include files) is changed. The entire configuration file is case insensitive. +If the configuration cannot be loaded due to a syntax error, the milter +will log the error and quit. If the configuration cannot be reloaded +after being modified, the milter will log the error and send an email to +root from dnsbl@$hostname. You probably want to added dnsbl@$hostname +to your /etc/mail/virtusertable since otherwise sendmail will reject +that message.


DCC Issues

If you are also using the