chiark / gitweb /
addrcheck: Check incoming mail for valid mailbox names.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 26 Mar 2006 15:20:52 +0000 (16:20 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 26 Mar 2006 15:20:52 +0000 (16:20 +0100)
.userv/rc [new file with mode: 0644]
Makefile
bin/addrcheck [new file with mode: 0755]
config

diff --git a/.userv/rc b/.userv/rc
new file mode 100644 (file)
index 0000000..5fee758
--- /dev/null
+++ b/.userv/rc
@@ -0,0 +1,15 @@
+### userv configuration for newsgate
+
+if ( glob calling-user qmaild
+   & ( glob service addrcheck:newsgate-default
+     | glob service addrcheck:newsgate-post-default
+     )
+   )
+       no-suppress-args
+       execute bin/addrcheck t
+elif ( glob calling-user qmaild
+     & glob service addrcheck:newsgate-mail-default
+     )
+       no-suppress-args
+       execute bin/addrcheck g
+fi
index adc9708..3e07793 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,12 @@
 ## makefile for newsgate
 
-all: config.files auth.cdb groups.cdb newsconf.stamp
+TARGETS = config.files auth.cdb groups.cdb newsconf.stamp .qmail-default
 
-config.files: config
+all: $(TARGETS)
+
+config.files .qmail-default: config
        splitconf config
+       update-addrcheck
 
 newsconf.stamp: groups
        bin/mkgroups
@@ -14,3 +17,9 @@ auth.cdb: config.files
 
 groups.cdb: groups
        bin/mkcdb groups
+
+clean:
+       splitconf -d config
+       rm -f $(TARGETS)
+
+.PHONY: all clean
diff --git a/bin/addrcheck b/bin/addrcheck
new file mode 100755 (executable)
index 0000000..ca6f3fb
--- /dev/null
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+set -e
+kind=${1?kind}
+tail=${2?tail}
+if cdb -q groups.cdb "$kind:$tail" >/dev/null 2>&1; then
+  echo +
+else
+  echo "-bad tag $tail"
+fi
diff --git a/config b/config
index 5fac6c3..1e1d271 100644 (file)
--- a/config
+++ b/config
@@ -1,17 +1,23 @@
 ## qmail configuration for newsgate
 
 before = chmod +t .
-after = chmod -t .
-
-.qmail-admin: root
-.qmail-default: |preline bin/post "$EXT"
-.qmail-in-default: |preline bin/post "$EXT2"
-
-[.qmail-mail-default]
-|check-sender <auth.cdb
-|bin/mail "$EXT2"
+after = ln -sf .qmail-post-default .qmail-default && chmod -t .
 
 [auth]
 distorted.org.uk
 .distorted.org.uk
 excessus.demon.co.uk
+
+[]
+prefix = .qmail-
+
+admin: root
+
+[post-default]
+#? addrcheck
+|preline bin/post "$DEFAULT"
+
+[mail-default]
+#? addrcheck
+|check-sender <auth.cdb
+|bin/mail "$DEFAULT"