changeset 2:32b57406b656

initial version
author carl
date Fri, 10 Mar 2006 10:47:12 -0800
parents 45c8592d5d13
children 01268466f0dc
files Makefile.am info/Makefile.am install.bash man/Makefile.am sm-archive.spec.in src/context.h src/includes.h src/sm-archive.cpp src/sm-archive.h xml/Makefile.am
diffstat 10 files changed, 38 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Fri Mar 10 10:35:25 2006 -0800
+++ b/Makefile.am	Fri Mar 10 10:47:12 2006 -0800
@@ -1,20 +1,20 @@
 SUBDIRS = src man html info
-hackdir = $(sysconfdir)/dnsbl
-hack_SCRIPTS = dnsbl
-hack_DATA = dnsbl.conf hosts-ignore.conf html-tags.conf tld.conf
-CLEANFILES = dnsbl xml/dnsbl xml/Makefile
-EXTRA_DIST = dnsbl.rc $(hack_DATA) dnsbl.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/d*)
+hackdir = $(sysconfdir)/sm-archive
+hack_SCRIPTS = sm-archive
+hack_DATA = sm-archive.conf
+CLEANFILES = sm-archive xml/sm-archive xml/Makefile
+EXTRA_DIST = sm-archive.rc $(hack_DATA) sm-archive.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/sm*)
 
-dnsbl: $(srcdir)/dnsbl.rc
-	   rm -f dnsbl
-	   echo "#!" $(BASH) >dnsbl
-	   cat $(srcdir)/dnsbl.rc     | \
+sm-archive: $(srcdir)/sm-archive.rc
+	   rm -f sm-archive
+	   echo "#!" $(BASH) >sm-archive
+	   cat $(srcdir)/sm-archive.rc     | \
 	       sed -e "s,SBINDIR,$(sbindir),g"  | \
-	       sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>dnsbl
+	       sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>sm-archive
 
-chkconfig: dnsbl
-	   /usr/bin/getent passwd dnsbl || /usr/sbin/useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl
-	   mv -f $(sysconfdir)/dnsbl/dnsbl /etc/rc.d/init.d
-	   /sbin/chkconfig --del dnsbl
-	   /sbin/chkconfig --add dnsbl
+chkconfig: sm-archive
+	   /usr/bin/getent passwd sm-archive || /usr/sbin/useradd -r -d /etc/sm-archive -M -c "sm-archive pseudo-user" -s /sbin/nologin sm-archive
+	   mv -f $(sysconfdir)/sm-archive /etc/rc.d/init.d
+	   /sbin/chkconfig --del sm-archive
+	   /sbin/chkconfig --add sm-archive
 
--- a/info/Makefile.am	Fri Mar 10 10:35:25 2006 -0800
+++ b/info/Makefile.am	Fri Mar 10 10:47:12 2006 -0800
@@ -1,2 +1,2 @@
-info_INFOS = dnsbl.texi
+info_INFOS = sm-archive.texi
 EXTRA_DIST = $(info_INFOS)
--- a/install.bash	Fri Mar 10 10:35:25 2006 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-#!/bin/bash
-
-#####################
-# stop the milter if it is already installed
-if [ -f /etc/rc.d/init.d/dnsbl ]; then
-    /etc/rc.d/init.d/dnsbl stop
-    rm -f /etc/rc.d/init.d/dnsbl
-fi
-
-
-#####################
-# build the milter
-# add compiler flags - suggested by Nigel Horne
-g++ -c $CXXFLAGS -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp
-if [ $? -ne 0 ]; then
-    echo "compiler errors"
-    exit
-fi
-g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread
-if [ $? -ne 0 ]; then
-    echo "linker errors"
-    exit
-fi
-
-
-#####################
-# ensure the user is created
-/usr/bin/getent passwd dnsbl || /usr/sbin/useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl
-# install the milter
-DST=/etc/dnsbl
-mkdir -p $DST
-if [ -f /var/dnsbl/dnsbl.conf ]; then
-    # move the conf files to the new location
-    mv /var/dnsbl/*conf $DST
-    rm /var/dnsbl/dnsbl # remove the old binary
-    rmdir /var/dnsbl
-fi
-CONF=$DST/dnsbl.conf
-if [ -f $CONF ]; then
-    grep '^context' $CONF >/dev/null
-    if [ $? -eq 1 ]; then
-        # config file exists, but it is for the older version
-        # preserve it and start over
-        suf=4.old
-        for i in dnsbl hosts-ignore html-tags tld; do
-            j=$DST/$i.conf
-            if [ -f $j ]; then
-                mv -f $j $j.$suf
-            fi
-        done
-    fi
-fi
-if [ ! -f $CONF ]; then
-    cp dnsbl.conf        $DST
-    cp hosts-ignore.conf $DST
-    cp html-tags.conf    $DST
-    cp tld.conf          $DST
-fi
-if [ ! -f $DST/hosts-ignore.conf ]; then
-    cp hosts-ignore.conf $DST
-fi
-if [ ! -f $DST/html-tags.conf ]; then
-    cp html-tags.conf $DST
-fi
-rm -f $DST/tld.conf     # new tld list
-if [ ! -f $DST/tld.conf ]; then
-    cp tld.conf $DST
-fi
-
-# make the directory for the socket
-mkdir -p          /var/run/dnsbl
-chown dnsbl:dnsbl /var/run/dnsbl
-chmod 700         /var/run/dnsbl
-
-# install the binaries
-mv -f dnsbl /usr/sbin/dnsbl
-cp dnsbl.rc /etc/rc.d/init.d/dnsbl
-chmod 755 /etc/rc.d/init.d/dnsbl
-/sbin/chkconfig --add dnsbl
-/sbin/chkconfig --level 2345 dnsbl on
-/etc/rc.d/init.d/dnsbl start
--- a/man/Makefile.am	Fri Mar 10 10:35:25 2006 -0800
+++ b/man/Makefile.am	Fri Mar 10 10:47:12 2006 -0800
@@ -1,2 +1,2 @@
-man_MANS = dnsbl.1 dnsbl.conf.5
+man_MANS = sm-archive.1 sm-archive.conf.5
 EXTRA_DIST = $(man_MANS)
--- a/sm-archive.spec.in	Fri Mar 10 10:35:25 2006 -0800
+++ b/sm-archive.spec.in	Fri Mar 10 10:47:12 2006 -0800
@@ -59,7 +59,7 @@
     sysconfdir=$RPM_BUILD_ROOT%{_sysconfdir} install
 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
 mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/@PACKAGE@-@VERSION@
-mv -f $RPM_BUILD_ROOT%{_sysconfdir}/sm-archive       $RPM_BUILD_ROOT/etc/rc.d/init.d
+mv -f $RPM_BUILD_ROOT%{_sysconfdir}/sm-archive/sm-archive   $RPM_BUILD_ROOT/etc/rc.d/init.d
 mv AUTHORS COPYING ChangeLog NEWS README             $RPM_BUILD_ROOT%{_datadir}/doc/@PACKAGE@-@VERSION@
 mkdir -p %{buildroot}/var/run/@PACKAGE@
 
--- a/src/context.h	Fri Mar 10 10:35:25 2006 -0800
+++ b/src/context.h	Fri Mar 10 10:47:12 2006 -0800
@@ -13,6 +13,7 @@
 	// all the rest is constant after loading from the config file
 	int 			generation;
 	time_t			load_time;
+	string_set		config_files;
 	string_map		env_from;			// map senders to archive mailboxes
 	string_map		rcpt_to;			// map recipients to archive mailboxes
 
--- a/src/includes.h	Fri Mar 10 10:35:25 2006 -0800
+++ b/src/includes.h	Fri Mar 10 10:47:12 2006 -0800
@@ -1,8 +1,3 @@
-#define VERIFY_DEBUG   1
-#define RESOLVER_DEBUG 1
-#undef	VERIFY_DEBUG
-#undef	RESOLVER_DEBUG
-
 #include "tokenizer.h"
 #include "context.h"
-#include "dnsbl.h"
+#include "sm-archive.h"
--- a/src/sm-archive.cpp	Fri Mar 10 10:35:25 2006 -0800
+++ b/src/sm-archive.cpp	Fri Mar 10 10:47:12 2006 -0800
@@ -55,7 +55,7 @@
 
 #include "includes.h"
 
-static char* dnsbl_version="$Id$";
+static char* smarchive_version="$Id$";
 
 
 extern "C" {
@@ -123,7 +123,7 @@
 	if (use_syslog) {
 		pthread_mutex_lock(&syslog_mutex);
 			if (!syslog_opened) {
-				openlog("dnsbl", LOG_PID, LOG_MAIL);
+				openlog("sm-archive", LOG_PID, LOG_MAIL);
 				syslog_opened = true;
 			}
 			syslog(LOG_NOTICE, "%s", text);
@@ -254,7 +254,7 @@
 		snprintf(buf, sizeof(buf), "loading configuration generation %d", newc->generation);
 		my_syslog(buf);
 	}
-	if (load_conf(*newc, "dnsbl.conf")) {
+	if (load_conf(*newc, "sm-archive.conf")) {
 		newc->load_time = time(NULL);
 		return newc;
 	}
@@ -298,7 +298,7 @@
 			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");
+				system("echo 'failed to load new sm-archive configuration from /etc/sm-archive' | mail -s 'error in /etc/sm-archive configuration' root");
 				// update the load time on the current config to prevent complaining every 3 minutes
 				dc.load_time = time(NULL);
 			}
@@ -448,7 +448,7 @@
 	}
 
 	// write the pid
-	const char *pidpath = "/var/run/dnsbl.pid";
+	const char *pidpath = "/var/run/sm-archive.pid";
 	unlink(pidpath);
 	FILE *f = fopen(pidpath, "w");
 	if (f) {
@@ -476,10 +476,10 @@
 	struct passwd *pw = getpwnam("sm-archive");
 	if (pw) {
 		if (setgid(pw->pw_gid) == -1) {
-			my_syslog("failed to switch to group dnsbl");
+			my_syslog("failed to switch to group sm-archive");
 		}
 		if (setuid(pw->pw_uid) == -1) {
-			my_syslog("failed to switch to user dnsbl");
+			my_syslog("failed to switch to user sm-archive");
 		}
 	}
 
--- a/src/sm-archive.h	Fri Mar 10 10:35:25 2006 -0800
+++ b/src/sm-archive.h	Fri Mar 10 10:47:12 2006 -0800
@@ -1,5 +1,5 @@
-#ifndef dnsbl_include
-#define dnsbl_include
+#ifndef smarchive_include
+#define smarchive_include
 
 #include "context.h"
 
--- a/xml/Makefile.am	Fri Mar 10 10:35:25 2006 -0800
+++ b/xml/Makefile.am	Fri Mar 10 10:47:12 2006 -0800
@@ -1,10 +1,10 @@
-all: dnsbl
-	   cat header.xml  dnsbl >dnsbl.xml
-	   cat header.sgml dnsbl >dnsbl.sgml
+all: sm-archive
+	   cat header.xml  sm-archive >sm-archive.xml
+	   cat header.sgml sm-archive >sm-archive.sgml
 	   rm -f ../html/*html
 	   rm -f ../html/*pdf
-	   xmlto        -o ../man  man   dnsbl.xml
-	   xmlto        -o ../html xhtml dnsbl.xml
-	   xmlto        -o ../html pdf   dnsbl.xml
-	   docbook2texi -o ../info       dnsbl.sgml
-	   rm -f dnsbl.xml dnsbl.sgml
+	   xmlto        -o ../man  man   sm-archive.xml
+	   xmlto        -o ../html xhtml sm-archive.xml
+	   xmlto        -o ../html pdf   sm-archive.xml
+	   docbook2texi -o ../info       sm-archive.sgml
+	   rm -f sm-archive.xml sm-archive.sgml