From: Santiago Vila <sanvila@debian.org>
Subject: Confirmation suite by Werner Reisberger
X-Debian-version: 3.10.7-5

--- /dev/null
+++ b/SmartList/bin/confirm
@@ -0,0 +1,219 @@
+#!/bin/sh
+
+# $Id: confirm,v 1.3 1999/03/11 13:00:33 szhrew Exp szhrew $
+# $Log: confirm,v $
+# Revision 1.3  1999/03/11 13:00:33  szhrew
+# Obsolete comment deleted
+#
+# Revision 1.2  1999/03/11 12:23:09 
+# Changing the command for creating a cookie due to problems with
+# the date command on other OS's.
+#
+
+##  Author:
+##      Werner Reisberger     <werner@free.de> 
+##  Description:
+##    confirm allows (un)subscriptions to mailing lists running with  
+##    SmartList  depending on a confirmation. If automatic subscription is 
+##    not allowed the confirmation can be done by the list maintainer(s).
+##---------------------------------------------------------------------------##
+##    
+##    Copyright (C) 1998   Werner Reisberger  <werner@free.de>
+##    Copyright (C) 1997   Michelle Dick <artemis@rahul.net> and
+##                         Werner Reisberger  <werner@free.de>
+##
+##    This program is free software; you can redistribute it and/or modify
+##    it under the terms of the GNU General Public License as published by
+##    the Free Software Foundation; either version 2 of the License, or
+##    (at your option) any later version.
+##
+##    This program is distributed in the hope that it will be useful,
+##    but WITHOUT ANY WARRANTY; without even the implied warranty of
+##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##    GNU General Public License for more details.
+##
+##    You should have received a copy of the GNU General Public License
+##    along with this program; if not, write to the Free Software
+##    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##---------------------------------------------------------------------------##
+
+test=test		# /bin/test
+echo=echo		# /bin/echo
+cat=cat			# /bin/cat
+sed=sed			# /bin/sed
+grep=grep		# /bin/grep
+date=date		# /bin/date
+ls=ls                   # /bin/ls
+rm=rm                   # /bin/rm
+mkdir=mkdir             # /bin/mkdir
+formail=formail		# /usr/local/bin/formail
+multigram=multigram 	# ../.bin/multigram
+
+$test -z "$listaddr" &&
+ $echo "Don't start this script directly, it is used in rc.request" && exit 64
+
+tmprequest=tmp.request
+tmpfrom=tmp.from
+confirmtxt=confirm.txt
+US=$1
+
+$test -d cookies || $mkdir cookies
+
+case "$X_ENVELOPE_TO" in
+  *$list-request*) wrongaddress="" ;;
+  *) wrongaddress="WARNING:
+	Please try to use '$listreq'
+	the next time when issuing (un)subscribe requests.
+" ;;
+esac
+
+subscraddr=""
+
+if [ "$US" = "unsub" ]
+then
+
+address=`$formail -k -xSubject: |
+$sed -n -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
+  -e '/^[        ]*[^    a-z]/ q' \
+  -e 's/^[^@]*del[       ]*'\
+'[^      ]*[     ]\([^   ]*[-a-z0-9_][@!][a-z][^         ]*\).*/\1/p' \
+  -e 's/^[^@]*unsub[   ]*'\
+'[^      ]*[     ]\([^   ]*[-a-z0-9_][@!][a-z][^         ]*\).*/\1/p' \
+  -e 's/^[^@]*unsubscribe[   ]*'\
+'[^      ]*[     ]\([^   ]*[-a-z0-9_][@!][a-z][^         ]*\).*/\1/p' `
+
+
+# create an cookie...this is u for unsubscribe, the date plus the pid
+COOKIE="u`$date +%m%d%H%M%S`$$"
+
+else
+
+address=`$formail -k -xSubject: |
+ $sed -n -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
+  -e '/^[	 ]*[^	 a-z]/ q' \
+  -e 's/^[^@]*add[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' \
+  -e 's/^[^@]*address[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' \
+  -e 's/^[^@]*sub[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' \
+  -e 's/^[^@]*subscribe[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' `
+
+fi
+
+fromaddr=`$cat $tmpfrom`
+
+for a in $address ""
+do
+  if $test -z "$subscraddr"
+  then
+     case $a in
+	$listreq|$listaddr) ;;
+	?*) subscraddr=$a
+	   $echo " $subscraddr" >$tmpfrom ;;
+     esac
+  fi
+done
+
+subscraddr=""	# let multigram eliminate trailing and leading punctuation
+
+address=`$formail -k -xSubject: <$tmprequest |
+ $multigram -b1 -x$listreq -x$listaddr -l$off_threshold $tmpfrom |
+ $sed -e 's/^ *[^ ]* *[^ ]* *[^ ]* *\([^ ]*\)/\1/' `
+
+for a in $address ""
+do
+  $test -z "$subscraddr" && subscraddr=$a
+done
+
+$test -z "$subscraddr" && subscraddr=$fromaddr
+
+if  [ "$US" != "unsub" ]
+then
+
+if $test -f subscreen
+then
+  ./subscreen "$subscraddr" || exit 1
+fi
+
+# create a fairly unique cookie...this is the date plus the pid
+COOKIE="s`$date +%m%d%H%M%S`$$"
+
+# log the attempt
+$echo "$0: subscription request from $fromaddr for"
+$echo "`cat $tmpfrom` - assigned cookie $COOKIE" >> log
+
+else
+
+$echo "$0: unsubscription request from $fromaddr for"
+$echo "`cat $tmpfrom` - assigned cookie $COOKIE" >> log
+
+fi
+
+# create cookie file in cookies directory containing the address
+# to be subscribed
+$echo $subscraddr > cookies/$COOKIE
+
+$grep '^Subject: Re:' <$tmprequest >/dev/null &&
+  wrongaddress="${wrongaddress}WARNING:
+	Send in a new mail, INSTEAD OF REPLYING
+	the next time when issuing (un)subscribe requests.
+"
+  
+  if [ "$US" = "sv" ]; then
+
+  authaddr=`$echo $maintainer|sed 's/,/ /g'`
+  
+  else
+
+  authaddr=$subscraddr
+
+  fi
+
+
+( $formail -i"From: $listreq" -rtA"X-Loop: $listaddr" \
+           -I"Subject: CONFIRM $COOKIE" <$tmprequest 
+
+  $test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""
+
+  $echo "It has been requested that the following address:"
+  $echo ""
+  $echo "       $subscraddr"
+  $echo ""
+
+  if [ "$US" = "unsub" ]; then
+  
+  $echo "should be deleted from the $list mailing list."
+  $echo ""
+  $echo "It has NOT yet been unsubscribed from the list."
+  $echo "To unsubscribe you need to confirm the unsubscription"
+
+  else
+
+  $echo "should be added to the $list mailing list."
+  $echo ""
+  $echo "The address has NOT yet been subscribed to the mailing list."
+  $echo "To subscribe you need to confirm the subscription"
+
+  fi
+
+  $echo "request by sending an email to the address:"
+  $echo ""
+  $echo "        $listreq"
+  $echo ""
+  $echo "with the Subject string:"
+  $echo ""
+  $echo "         CONFIRM $COOKIE"
+  $echo ""
+  $echo "With a reasonable good email program a reply to this" 
+  $echo "message should be sufficient"
+  $echo ""
+
+  $cat $confirmtxt
+  $echo ""
+
+  $rm -f _dummy_ `$ls -td cookies/* | $sed -e '1,'$maxcookies' d' `
+
+  $sed -e 's/^/>/' $tmprequest
+) | $SENDMAIL $sendmailOPT $authaddr
--- /dev/null
+++ b/SmartList/bin/confirm_add
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+##  Author:
+##      Werner Reisberger     <werner at pure dot ch> 
+##  Description:
+##    confirm_add allows subscriptions to mailing lists running with  
+##    SmartList  depending on a confirmation. If automatic subscription is 
+##    not allowed the confirmation can be done by the list maintainer(s).
+##---------------------------------------------------------------------------##
+##    
+##    Copyright (C) 1998-2002   Werner Reisberger  <werner at pure dot ch>
+##    Copyright (C) 1997        Michelle Dick <artemis@rahul.net> and
+##                              Werner Reisberger  <werner at pure dot ch>
+##
+##    This program is free software; you can redistribute it and/or modify
+##    it under the terms of the GNU General Public License as published by
+##    the Free Software Foundation; either version 2 of the License, or
+##    (at your option) any later version.
+##
+##    This program is distributed in the hope that it will be useful,
+##    but WITHOUT ANY WARRANTY; without even the implied warranty of
+##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##    GNU General Public License for more details.
+##
+##    You should have received a copy of the GNU General Public License
+##    along with this program; if not, write to the Free Software
+##    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##---------------------------------------------------------------------------##
+
+test=test		# /bin/test
+echo=echo		# /bin/echo
+cat=cat			# /bin/cat
+sed=sed			# /bin/sed
+grep=grep		# /bin/grep
+date=date		# /bin/date
+ls=ls                   # /bin/ls
+rm=rm                   # /bin/rm
+mkdir=mkdir             # /bin/mkdir
+formail=formail		# /usr/local/bin/formail
+
+$test -z "$listaddr" &&
+ $echo "Don't start this script directly, it is used in rc.request" && exit 64
+
+tmprequest=tmp.request
+tmpfrom=tmp.from
+confirmtxt=confirm.txt
+subscraddr=$1
+US=$2
+
+$test -d cookies || $mkdir cookies
+
+case "$X_ENVELOPE_TO" in
+  *$list-request*) wrongaddress="" ;;
+  *) wrongaddress="WARNING:
+	Please try to use '$listreq'
+	the next time when issuing subscribe requests.
+" ;;
+esac
+
+
+if $test -f subscreen
+then
+  ./subscreen "$subscraddr" || exit 1
+fi
+
+# create a fairly unique cookie...this is the date plus the pid
+COOKIE="s`$date +%m%d%H%M%S`$$"
+
+# log the attempt
+$echo "$0: subscription request from $fromaddr for"
+$echo "`cat $tmpfrom` - assigned cookie $COOKIE" >> log
+
+# create cookie file in cookies directory containing the address
+# to be subscribed
+$echo $subscraddr > cookies/$COOKIE
+
+$grep '^Subject: Re:' <$tmprequest >/dev/null &&
+  wrongaddress="${wrongaddress}WARNING:
+	Send in a new mail, INSTEAD OF REPLYING
+	the next time when issuing (un)subscribe requests.
+"
+  
+if [ "$US" = "sv" ]; then
+
+  authaddr=`$echo $maintainer|sed 's/,/ /g'`
+  
+else
+
+  authaddr=$subscraddr
+
+fi
+
+( $formail -i"From: $listreq" -rtA"X-Loop: $listaddr" \
+           -I"Subject: CONFIRM $COOKIE" <$tmprequest 
+
+  $test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""
+
+  $echo "It has been requested that the following address:"
+  $echo ""
+  $echo "       $subscraddr"
+  $echo ""
+  $echo "should be added to the $list mailing list."
+  $echo ""
+  $echo "The address has NOT yet been subscribed to the mailing list."
+  $echo "To subscribe you need to confirm the subscription"
+  $echo "request by sending an email to the address:"
+  $echo ""
+  $echo "        $listreq"
+  $echo ""
+  $echo "with the Subject string:"
+  $echo ""
+  $echo "         CONFIRM $COOKIE"
+  $echo ""
+  $echo "With a reasonable good email program a reply to this" 
+  $echo "message should be sufficient"
+  $echo ""
+
+  $cat $confirmtxt
+  $echo ""
+
+  $rm -f _dummy_ `$ls -td cookies/* | $sed -e '1,'$maxcookies' d' `
+
+  $sed -e 's/^/>/' $tmprequest
+) | $SENDMAIL $sendmailOPT $authaddr
--- /dev/null
+++ b/SmartList/bin/confirm_del
@@ -0,0 +1,202 @@
+#!/bin/sh
+
+##  Author:
+##      Werner Reisberger     <werner at pure dot ch> 
+##  Description:
+##    confirm_del allows unsubscriptions to mailing lists running with  
+##    SmartList  depending on a confirmation. If automatic unsubscription is 
+##    not allowed the confirmation can be done by the list maintainer(s).
+##---------------------------------------------------------------------------##
+##    
+##    Copyright (C) 1998-2002   Werner Reisberger  <werner at pure dot ch>
+##    Copyright (C) 1997        Michelle Dick <artemis@rahul.net> and
+##                              Werner Reisberger  <werner at pure dot ch>
+##
+##    This program is free software; you can redistribute it and/or modify
+##    it under the terms of the GNU General Public License as published by
+##    the Free Software Foundation; either version 2 of the License, or
+##    (at your option) any later version.
+##
+##    This program is distributed in the hope that it will be useful,
+##    but WITHOUT ANY WARRANTY; without even the implied warranty of
+##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##    GNU General Public License for more details.
+##
+##    You should have received a copy of the GNU General Public License
+##    along with this program; if not, write to the Free Software
+##    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##---------------------------------------------------------------------------##
+
+test=test		# /bin/test
+dist=dist
+echo=echo		# /bin/echo
+cat=cat			# /bin/cat
+sed=sed			# /bin/sed
+grep=grep		# /bin/grep
+date=date		# /bin/date
+ls=ls                   # /bin/ls
+rm=rm                   # /bin/rm
+mkdir=mkdir             # /bin/mkdir
+formail=formail		# /usr/local/bin/formail
+multigram=multigram 	# ../.bin/multigram
+
+$test -z "$listaddr" &&
+ $echo "Don't start this script directly, it is used in rc.request" && exit 64
+
+tmprequest=tmp.request
+tmpfrom=tmp.from
+confirmtxt=confirm.txt
+
+$test -d cookies || $mkdir cookies
+
+case "$X_ENVELOPE_TO" in
+  *$list-request*) wrongaddress="" ;;
+  *) wrongaddress="WARNING:
+	Please try to use '$listreq'
+	the next time when issuing unsubscribe requests.
+" ;;
+esac
+
+subscraddr=""
+
+address=`$formail -k -xSubject: |
+$sed -n -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
+  -e '/^[ 	]*[^ 	a-z]/ q' \
+  -e 's/^[^@]*del[ 	]*'\
+'[^      ]*[ 	]\([^ 	]*[-a-z0-9_][@!][a-z][^ 	]*\).*/\1/p' \
+  -e 's/^[^@]*unsub[ 	]*'\
+'[^      ]*[ 	]\([^ 	]*[-a-z0-9_][@!][a-z][^ 	]*\).*/\1/p' \
+  -e 's/^[^@]*unsubscribe[ 	]*'\
+'[^      ]*[ 	]\([^ 	]*[-a-z0-9_][@!][a-z][^ 	]*\).*/\1/p' `
+
+
+# create an cookie...this is u for unsubscribe, the date plus the pid
+COOKIE="u`$date +%m%d%H%M%S`$$"
+
+fromaddr=`$cat $tmpfrom`
+
+for a in $address ""
+do
+  if $test -z "$subscraddr"
+  then
+     case $a in
+	$listreq|$listaddr) ;;
+	?*) subscraddr=$a
+	   $echo " $subscraddr" >$tmpfrom ;;
+     esac
+  fi
+done
+
+subscraddr=""	# let multigram eliminate trailing and leading punctuation
+
+address=`$formail -k -xSubject: <$tmprequest |
+ $multigram -b1 -x$listreq -x$listaddr -l$off_threshold $tmpfrom |
+ $sed -e 's/^ *[^ ]* *[^ ]* *[^ ]* *\([^ ]*\)/\1/' `
+
+for a in $address ""
+do
+  $test -z "$subscraddr" && subscraddr=$a
+done
+
+$test -z "$subscraddr" && subscraddr=$fromaddr
+
+# is the address on the list ?
+$sed 's/\([^ 	]*\) *.*/\1/' $dist | $grep -i "^${subscraddr}$" > /dev/null
+
+if [ $? != 0 ]; then
+
+  $echo "$0: unsubscription request from $fromaddr for" >> $LOGFILE
+  $echo "unknown address: $subscraddr" >> $LOGFILE
+
+    
+  ( $formail -i"From: $listreq" -rtA"X-Loop: $listaddr" \
+             -I"Subject: unsuccessful unsubscribe request" <$tmprequest 
+  
+    $test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""
+  
+    $echo "It has been requested that the following address:"
+    $echo ""
+    $echo "       $subscraddr"
+    $echo ""
+  
+    $echo "should be deleted from the $list mailing list."
+    $echo ""
+    $echo "Sorry, but this address has NOT been found on the list."
+
+    if $test ! -z "$unsub_assist" -a 0 != "$unsub_assist"
+    then
+      $echo "What I did find were the following approximate matches:"
+      $echo ""
+      $echo $subscraddr | $multigram -m -b$unsub_assist -l-32767 $dist
+      $echo ""
+      $echo "If you recognise one of these addresses as being the one you"
+      $echo "wanted to unsubscribe, send in a new unsubscribe request"
+      $echo "containing the text:  unsubscribe the_address_you_meant."
+
+    else
+ 
+      $echo ""
+      $echo "Please check carefully the spelling of this address."
+      $echo "You may send an unsubscribe request with another address."
+      $echo "If the address is on the list you will receive a confirmation"
+      $echo "message. A reply to this message will remove the address."
+      $echo ""
+
+    fi
+
+    $echo "It follows a copy of your unsubscribe request"
+    $echo ""
+
+    $sed -e 's/^/>/' $tmprequest
+  ) | $SENDMAIL $sendmailOPT $fromaddr
+  
+  exit 0
+
+fi
+
+$echo "$0: unsubscription request from $fromaddr for" >> $LOGFILE
+$echo "$subscraddr - assigned cookie $COOKIE" >> $LOGFILE
+
+# create cookie file in cookies directory containing the address
+# to be unsubscribed
+$echo $subscraddr > cookies/$COOKIE
+
+$grep '^Subject: Re:' <$tmprequest >/dev/null &&
+  wrongaddress="${wrongaddress}WARNING:
+	Send in a new mail, INSTEAD OF REPLYING
+	the next time when issuing unsubscribe requests.
+"
+  
+( $formail -i"From: $listreq" -rtA"X-Loop: $listaddr" \
+           -I"Subject: CONFIRM $COOKIE" <$tmprequest 
+
+  $test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""
+
+  $echo "It has been requested that the following address:"
+  $echo ""
+  $echo "       $subscraddr"
+  $echo ""
+
+  $echo "should be deleted from the $list mailing list."
+  $echo ""
+  $echo "It has NOT yet been unsubscribed from the list."
+  $echo "To unsubscribe you need to confirm the unsubscription"
+  $echo "request by sending an email to the address:"
+  $echo ""
+  $echo "        $listreq"
+  $echo ""
+  $echo "with the Subject string:"
+  $echo ""
+  $echo "         CONFIRM $COOKIE"
+  $echo ""
+  $echo "With a reasonable good email program a reply to this" 
+  $echo "message should be sufficient"
+  $echo ""
+
+  $cat $confirmtxt
+  $echo ""
+
+  $rm -f _dummy_ `$ls -td cookies/* | $sed -e '1,'$maxcookies' d' `
+
+  $sed -e 's/^/>/' $tmprequest
+) | $SENDMAIL $sendmailOPT $subscraddr
--- a/SmartList/bin/createlist
+++ b/SmartList/bin/createlist
@@ -152,7 +152,8 @@
 fi
 cd "$list"
 for a in rc.submit rc.init rc.request help.txt subscribe.txt unsubscribe.txt \
- archive.txt reject
+ archive.txt reject rc.confirm confirm-help.txt confirm.txt confirm-error.txt \
+ rc.rfc822
 do
   $test -f ../$defaults/$a || $touch ../$defaults/$a	# make sure it exists
   $ln ../$defaults/$a $a
--- /dev/null
+++ b/SmartList/bin/extraddr
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+##  Author:
+##      Werner Reisberger     <werner at pure dot ch> 
+##  Description:
+##    confirm allows (un)subscriptions to mailing lists running with  
+##    SmartList  depending on a confirmation. If automatic subscription is 
+##    not allowed the confirmation can be done by the list maintainer(s).
+##---------------------------------------------------------------------------##
+##    
+##    Copyright (C) 1998-2003   Werner Reisberger  <werner at pure dot ch>
+##    Copyright (C) 1997        Michelle Dick <artemis@rahul.net> and
+##                              Werner Reisberger  <werner at pure dot ch>
+##
+##    This program is free software; you can redistribute it and/or modify
+##    it under the terms of the GNU General Public License as published by
+##    the Free Software Foundation; either version 2 of the License, or
+##    (at your option) any later version.
+##
+##    This program is distributed in the hope that it will be useful,
+##    but WITHOUT ANY WARRANTY; without even the implied warranty of
+##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##    GNU General Public License for more details.
+##
+##    You should have received a copy of the GNU General Public License
+##    along with this program; if not, write to the Free Software
+##    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+##---------------------------------------------------------------------------##
+
+test=test		# /bin/test
+echo=echo		# /bin/echo
+cat=cat			# /bin/cat
+sed=sed			# /bin/sed
+grep=grep		# /bin/grep
+date=date		# /bin/date
+ls=ls                   # /bin/ls
+rm=rm                   # /bin/rm
+mkdir=mkdir             # /bin/mkdir
+formail=formail		# /usr/local/bin/formail
+multigram=multigram 	# ../.bin/multigram
+
+$test -z "$listaddr" &&
+ $echo "Don't start this script directly, it is used in rc.request" && exit 64
+
+ADR=$1
+
+tmprequest=tmp.request
+tmpfrom=tmp.from
+
+case "$X_ENVELOPE_TO" in
+  *$list-request*) wrongaddress="" ;;
+  *) wrongaddress="WARNING:
+	Please try to use '$listreq'
+	the next time when issuing (un)subscribe requests.
+" ;;
+esac
+
+subscraddr=""
+
+address=`$formail -k -xSubject: |
+ $sed -n -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
+  -e '/^[	 ]*[^	 a-z]/ q' \
+  -e 's/^[^@]*add[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' \
+  -e 's/^[^@]*address[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' \
+  -e 's/^[^@]*sub[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' \
+  -e 's/^[^@]*subscribe[	 ]*'\
+'[^	 ]*[	 ]\([^	 ]*[-a-z0-9_][@!][a-z][^	 ]*\).*/\1/p' `
+
+fromaddr=`$cat $tmpfrom`
+
+for a in $address ""
+do
+  if $test -z "$subscraddr"
+  then
+     case $a in
+	$listreq|$listaddr) ;;
+	?*) subscraddr=$a
+	   $echo " $subscraddr" >$tmpfrom ;;
+     esac
+  fi
+done
+
+subscraddr=""	# let multigram eliminate trailing and leading punctuation
+
+address=`$formail -k -xSubject: <$tmprequest |
+ $multigram -b1 -x$listreq -x$listaddr -l$off_threshold $tmpfrom |
+ $sed -e 's/^ *[^ ]* *[^ ]* *[^ ]* *\([^ ]*\)/\1/' `
+
+for a in $address ""
+do
+  $test -z "$subscraddr" && subscraddr=$a
+done
+
+$test -z "$subscraddr" && subscraddr=$fromaddr
+
+# log the attempt
+$echo "$0: subscription request from $fromaddr" >> log
+
+if [ -z $ADR ]; then
+  $formail -f -I"X-RFC822Conform: $subscraddr" < $tmprequest
+else
+  $grep "^[ 	]*$subscraddr[ 	]*" dist
+fi
--- /dev/null
+++ b/SmartList/etc/confirm-error.txt
@@ -0,0 +1,4 @@
+Your subscription request was unsuccesful.
+
+If your subscription address was invalid you should have got a response
+from the mailing list server indicating the faulty address in the subject line.
--- /dev/null
+++ b/SmartList/etc/confirm-help.txt
@@ -0,0 +1,16 @@
+Your confirmation request was unsuccessful.  Please double-check the
+following and try again:
+
+1.  Did you include the word "CONFIRM" and the confirmation number in
+the SUBJECT of your email?
+
+2.  Did you copy the confirmation number exactly as written in the
+confirmation email you received?
+
+3.  Did you already successfully confirm your subscription?
+
+It is also possible that too long a time has transpired between your
+(un)subscription request and confirmation or that some list data was lost.
+If you followed the above instructions exactly and still get this
+message, please send another (un)subscribe request and get a new
+confirmation number.
--- /dev/null
+++ b/SmartList/etc/confirm.txt
@@ -0,0 +1,20 @@
+Don't remove or edit the confirm string within the subject line. If the 
+confirm string has been removed or changed the confirmation will fail!
+
+When your confirm message has been received the above listed address
+will be (un)subscribed.  If the above address is incorrect, please do not
+send in the confirm message listed above. Instead, send a new
+(un)subscribe request containing the Subject: 
+
+   subscribe correct-address@correct-domain 
+
+                  or
+
+   unsubscribe correct-address@correct-domain
+
+and wait for a new confirmation message.
+
+A copy of the (un)subcription request appears below.  In the event that
+you did not send a request to (un)subscribe, the headers of the message
+may help you discover who sent the request.
+
--- /dev/null
+++ b/SmartList/etc/rc.confirm
@@ -0,0 +1,85 @@
+# confirm v.1.2.7, 3. Nov. 2002 <werner at free dot de>
+#
+# Check to see if it is a confirm request
+#
+
+:0
+* Subject:.*confirm.*\/[su][0-9]+
+{
+   COOKIE=$MATCH	
+
+   :0 
+   * ? test -s cookies/$COOKIE
+   {
+
+     subscraddr=`cat cookies/$COOKIE`
+
+
+     # 
+     # transfer to "(un)subscribe" in rc.request
+     #
+     
+     :0 wfh
+     * COOKIE ?? s[0-9]+
+     | formail -A "X-Diagnostic: $subscraddr tried to confirm subscription" \
+        -I"Subject: subscribe $subscraddr" && rm cookies/$COOKIE
+
+     :0 E
+     * COOKIE ?? u[0-9]+
+     {
+         
+        # remove the address from the dist file
+        # use global lockfile because of log message
+        LOCKFILE=dist.lock
+        :0 w
+        * ? echo $subscraddr | multigram -b1 -l30000 -d dist 
+        { }
+        LOCKFILE
+
+        :0 Awc
+        | formail -IIn-Reply-To: -ICc: >tmp.request
+
+        :0 Aw ${cc_unsubrequests:+c}
+        * ? echo "unsubscribed: $subscraddr" >> $LOGFILE
+        | (formail -r; echo "$subscraddr removed from list $list!"; echo ""; \
+           cat unsubscribe.txt; cat tmp.request | sed 's/^/> /') \
+           | $SENDMAIL $sendmailOPT -t && rm cookies/$COOKIE
+        
+        :0 A w
+        | formail -A "X-Diagnostic: Tried to confirm unsubscription" \
+          | $SENDMAIL $sendmailOPT $maintainer
+
+        :0 Ewfh
+        * ? echo "Couldn't unsubscribe $subscraddr" >> $LOGFILE
+        | formail -A "X-Diagnostic: Problem unsubscribing $subscraddr"
+
+     }
+  
+   }
+
+  #If there is no such cookie send a help file
+
+  :0 EHB
+  {
+    :0 hw ${cc_requests:+c}
+    | (formail -i"From: $listreq" -rtA"X-Loop: $listaddr"; \
+       cat confirm-help.txt 2>/dev/null ) | $SENDMAIL $sendmailOPT -t
+
+    :0 wfh
+    | formail -A "X-Diagnostic: unsuccessful confirm, help sent"
+  }
+
+}
+
+#if confirm is in subject, but no cookie, send a help file
+
+:0 EHB
+* Subject:.*confirm
+{
+  :0 hw ${cc_requests:+c}
+  | (formail -i"From: $listreq" -rtA"X-Loop: $listaddr"; \
+     cat confirm-help.txt 2>/dev/null ) | $SENDMAIL $sendmailOPT -t
+
+  :0 wfh
+  | formail -A "X-Diagnostic: unsuccessful confirm, help sent"
+}
--- a/SmartList/etc/rc.custom
+++ b/SmartList/etc/rc.custom
@@ -1,8 +1,14 @@
+# This rc.custom file is customized for the confirm v.1.2 package.
+# The variables set in the confirm chapter are triggering the confirmation
+# of subscribe and/or unsubscribe requests. Subscriptions could be also
+# forwarded to the maintainer(s) for confirmation.
 #
 # Assign the fully qualified mail address of the maintainer of this list
 # to "maintainer".  If empty, request-mail will not be mailed to any
 # maintainer and will be stored in the "request" file for this list.
 #
+# If you want to define more than one maintainer you have to seperate
+# the email addresses with commas. Don't leave blanks around the commas.
 
 maintainer	=
 
@@ -52,6 +58,26 @@
 ##force_subscribe=	yes		# uncomment to cause people to
 					# be autosubscribed upon first
 					# submission to the list
+
+#
+# Variables to control and activate the confirm mechanism
+#
+
+maxcookies      =       50                  # cookies held in cookies directory
+
+require_confirm =	yes             # send confirmation message before
+#require_confirm			# subscribing
+
+confirm_unsubscribe =	yes
+#confirm_unsubscribe
+
+confirm_subscribe =	yes
+#confirm_subscribe
+
+#confirm_maintainer =	yes # This forwards all subscription requests to
+confirm_maintainer          # the maintainer(s) who have to confirm or
+                            # ignore the messages.
+
 #auto_unsubscribe=	yes
 ##auto_unsubscribe			# uncomment to disable unattended
 					# unsubscription handling
--- a/SmartList/etc/rc.request
+++ b/SmartList/etc/rc.request
@@ -5,7 +5,13 @@
 # New mails can be temporarily stalled by creating the file rc.lock (either in
 # ../.etc for all lists or in the current directory for this list only).
 
-#$Id: rc.request,v 1.84 2000/05/09 06:36:33 guenther Exp $
+# modified for confirmation messages and multiple maintainers 
+# 11 Dec. 1998, Werner Reisberger, werner at pure dot ch
+
+#$Id: rc.request,v 1.2.1.2 1999/03/12 14:41:20 szhrew Exp szhrew $
+# $Log: rc.request,v $
+# Revision 1.2.1.2  1999/03/12 14:41:20  szhrew
+# merged two recipes
 
 INCLUDERC=$RC_INIT
 INCLUDERC=$RC_CUSTOM
@@ -30,6 +36,18 @@
 # If everything matches, we extract the sender address into tmp.from
 #
 
+# is there more than one maintainer?
+maintainer_re="$maintainer"
+maintainers="$maintainer"
+Maintainer=Maintainer
+
+:0
+* maintainer ?? ,
+{ maintainer_re="`echo $maintainer | sed -e 's/,/|/g' -e 's/\./\\\./g'`"
+  maintainers="`echo $maintainer | sed -e 's/,/ /g'`"
+  Maintainer=Maintainers
+}
+
 :0
 * B ?? < 4096
 * $$daemon_bias
@@ -38,15 +56,17 @@
 *    1^0
 {
 
+  INCLUDERC=${require_confirm:+rc.confirm}
+
 :0
-* -100^0 ^Subject:(.*[^a-z])?(Re:|erro|change|problem|((can)?not|.*n't)\>)
+* -100^0 ^Subject:[^a-z]*(Re:|erro|change|problem|((can)?not|.*n't)\>)
 *  100^0 B ?? ^^([	 ]|$)*\
 	((archives?:?($|[	 ]+)|\
 	  ((un)subscribe|(send|get)(me)?|gimme|retrieve|mail|ls|dir(ectory)?|\
 	    list|show|search|[fe]?grep|find|maxfiles|version|help|info)\
 	   ([	 ].*)?$)([	 ]|$)*)+\
 	    ([^	 a-z].*$(.*$(.*$(.*$(.*$)?)?)?)?)?^^
-*  100^0 ^Subject:[	 ]*archive
+*  100^0 ^Subject:[	 ]*(archive|(un)?subscribe)
 *    1^0
 {
   :0 whc
@@ -119,7 +139,24 @@
   *  1^0 B ?? ^^([	 ]|$)*unsub(scribe)?([	 ].*)?([	 ]|$)*\
 	       [^	 a-z]?^^
    {
-     :0 fw:dist.lock
+
+     #
+     # If confirmation required send a cookie
+     #
+
+     :0
+     * ! ^X-Diagnostic: Tried to confirm unsubscription
+     * confirm_unsubscribe ?? y
+      {
+        :0 W ${cc_requests:+c}:dist.lock
+        | confirm_del
+
+        :0 awfh
+        | formail -A "X-Diagnostic: Sent confirmation instructions"
+      }
+
+     :0 E fw:dist.lock
+     * ! confirm_unsubscribe ?? y
      * auto_unsubscribe ?? y
      | unsubscribe
 
@@ -160,19 +197,119 @@
      # If not, then let's see if he might already be on the
      # mailinglist.
      #
+     # We only check these if the message isn't a subscription confirmation.
+     # In this case the check have been made before.
+     # 
 
-     :0 E HB wfh
-     * ? formail -IReceived: -IX-Envelope-To: -IIn-Reply-To: -ICc: | \
-	   multigram -b1 -x$listreq -x$listaddr -l$reject_threshold dist
-     | formail -A "X-Diagnostic: Already on the subscriber list" \
+     :0 E
+     * ! subscraddr ?? @
+     {
+ 
+       :0 HB wfh
+       * ! require_confirm ?? y
+       * ! confirm_subscribe ?? y
+       * ? formail -IReceived: -IX-Envelope-To: -IIn-Reply-To: -ICc: | \
+       	   multigram -b1 -x$listreq -x$listaddr -l$reject_threshold dist
+       | formail -A "X-Diagnostic: Already on the subscriber list" \
 	-A "X-Diagnostic: `multigram -b1 -x$listreq -x$listaddr \
 	-l$reject_threshold dist`"
+     
+       :0 A
+       { dublette = yes }
+
+       :0 EHB wfh
+       * require_confirm ?? y
+       * confirm_subscribe ?? y
+       * ? formail -IReceived: -IX-Envelope-To: -IIn-Reply-To: -ICc: | \
+       	   extraddr check
+       | formail -A "X-Diagnostic: Already on the subscriber list" \
+	     -A "X-Diagnostic: `extraddr check`"
+     
+       :0 A
+       { dublette = yes }
+
+       #
+       # If confirmation required send a cookie
+       #
+
+       :0 E
+       * require_confirm ?? y
+       * confirm_subscribe ?? y
+       {
+         # extract subscribe address
+         :0 wfh
+         | extraddr
+
+         :0 aH
+         * ^X-RFC822Conform: \/.+ 
+         {
+
+           # include regexp to check if email address conforms to rfc822
+           INCLUDERC=rc.rfc822
+           # check address format
+
+           :0
+           * $ MATCH ?? ^$addrspec__
+           {
+           
+             :0 
+             * confirm_maintainer ?? y
+             {
+                :0 W ${cc_requests:+c}:dist.lock
+                | confirm_add $MATCH sv 
+
+                :0 awfh
+                | formail -A "X-Diagnostic: Sent maintainer instructions"
+
+                :0 Ewfh
+                | formail -A "X-Diagnostic: Tried to subscribe"
+             } 
+
+             :0 E
+             {
+                :0 W ${cc_requests:+c}:dist.lock
+                | confirm_add $MATCH
+
+                :0 awfh
+                | formail -A "X-Diagnostic: Sent confirmation instructions"
+
+                :0 Ewfh
+                | formail -A "X-Diagnostic: Tried to subscribe"
+             }
+
+           } 
+
+           :0 E
+           {
+              :0 hw ${cc_requests:+c}
+              |(formail -i"From: $listreq" -rtA"X-Loop: $listaddr" \
+                -i "Subject: Invalid address ($MATCH)"; \
+                cat confirm-error.txt 2>/dev/null ) | $SENDMAIL $sendmailOPT -t
+
+              :0
+              | formail -A "X-Diagnostic: Invalid subscribe address ($MATCH)" \
+               | $SENDMAIL $sendmailOPT $sendmailOPTp $maintainers
+           }
+         }
+
+         :0 Ewfh
+         | formail -A "X-Diagnostic: Extract script failed"
+
+       }
+     } 
 
      #
-     # If not, add him(/her/it?).
+     # If no confirmation required or already confirmed call
+     # the subscribe script
      #
+     
+     :0
+     * require_confirm ?? y
+     * ! $^X-Diagnostic: $\subscraddr tried to confirm subscription
+     {	}
 
      :0 E
+     * ! dublette ?? y
      * auto_subscribe ?? y
       {
 	:0 W ${cc_requests:+c}:dist.lock
@@ -305,7 +442,7 @@
 #
 
 :0 wf:dist.lock
-* $^$X_COMMAND:.*$\maintainer[	 ]*$\X_COMMAND_PASSWORD
+* $^$X_COMMAND:.*($maintainer_re)[	 ]*$X_COMMAND_PASSWORD
 * $!^X-Loop: $\listaddr
 | x_command
 
--- /dev/null
+++ b/SmartList/etc/rc.rfc822
@@ -0,0 +1,30 @@
+#
+# RFC822 address parsing regular expressions for procmail.
+#
+# Copyright (c) 1997-2002 Barton E. Schaefer
+
+# spacex__ below is a space and a tab
+
+specialx__ = '][()<>@,;:\\".'
+spacex__ = " 	"
+specials__ = "[$specialx__]"
+atom__ = "[^$specialx__$spacex__]+"
+space__ = "[$spacex__]*"
+qtext__ = '[^"\\]'
+qpair__ = '\\.'
+beginq__ = '"'
+endq__ = '[^\\]?"'
+dotx__ = '\.'
+dot__ = "$space__$dotx__$space__"
+comma__ = "$space__,$space__"
+
+domainref__ = "$atom__"
+domainlit__ = "\[([^]]|$qpair__)*[^\\]?\]"
+quotedstring__ = "$beginq__($qtext__|$qpair__)*$endq__"
+word__ = "($atom__|$quotedstring__)"
+phrase__ = "($space__$word__$space__)*"
+localpart__ = "$word__($dot__$word__)*"
+
+subdomain__ = "($domainref__|$domainlit__)"
+domain__ = "$subdomain__($dot__$subdomain__)*"
+addrspec__ = "$localpart__$space__@$space__$domain__"
--- a/SmartList/etc/rc.submit
+++ b/SmartList/etc/rc.submit
@@ -105,6 +105,18 @@
      INCLUDERC=$RC_LOCAL_SUBMIT_10
 
      :0
+     * ^Subject:.*confirm.*[su][0-9]+
+      { 
+
+        :0 whf
+        * pass_diverts ?? y
+        | formail -A "X-Diagnostic: Probably a confirmation message"
+
+        HOST=continue_with_rc.request
+
+      }
+
+     :0
      * moderated_flag ?? y
       {
 	:0 Bhfw				# contract header and body
