File: confirm_sub

package info (click to toggle)
smartlist 3.15-28
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,308 kB
  • sloc: ansic: 9,238; sh: 4,901; makefile: 118
file content (95 lines) | stat: -rw-r--r-- 2,491 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/sh

# That's the modified original SmartList subscribe script to overcome security
# implications and limititations caused by multigram. It's only used if 
# require_confirm is set to yes

test=test		# /bin/test
echo=echo		# /bin/echo
cat=cat			# /bin/cat
sed=sed			# /bin/sed
grep=grep		# /bin/grep
date=date		# /bin/date
formail=formail		# /usr/local/bin/formail
multigram=multigram	# ../.bin/multigram
arch_retrieve=arch_retrieve	# ../.bin/arch_retrieve

tmprequest=tmp.request
tmpfrom=tmp.from
subscribetxt=subscribe.txt
subscribefiles=subscribe.files

$test -z "$listaddr" &&
 $echo "Don't start this script directly, it is used in rc.request" && exit 64

subscraddr="$1"
$test -z "$subscraddr" &&
 $echo "Error: missing address to subscribe" && exit 64

if $test ! -r dist
then
  $echo "subscribe: Where did the dist file go?" 1>&2
  $echo "(Only addresses below this line can be automatically removed)" >>dist
fi

case "$X_ENVELOPE_TO" in
  *$list-request*) wrongaddress="" ;;
  *) wrongaddress="WARNING:
	Please try to use '$listreq'
	the next time when issuing (un)subscribe requests.
" ;;
esac

if $test -f subscreen
then
  ./subscreen "$subscraddr" || exit 1
fi

$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.
"

$multigram -a "$subscraddr" dist >/dev/null

sender=`$formail -rtzcxTo: <$tmprequest`

$test -z "$subscribe_log" ||
 $echo "subscribe: $subscraddr by: $sender  `$date`" >>$subscribe_log

case $subscraddr in
   *$sender*) sender="$subscraddr" ;;
   *) sender="$sender $subscraddr" ;;
esac

( $formail -i"From: $listreq" -rtA"X-Loop: $listaddr" <$tmprequest

  $test ! -z "$wrongaddress" && $echo "$wrongaddress" && wrongaddress=""

  $echo "You have added to the subscriber list of:"
  $echo ""
  $echo "	$listaddr"
  $echo ""
  $echo "the following mail address:"
  $echo ""
  $echo "	$subscraddr"
  $echo ""
  $echo "By default, copies of your own submissions will be returned."
  $echo ""

  $cat $subscribetxt

  $sed -e 's/^/>/' $tmprequest
) | $SENDMAIL $sendmailOPT $sender

if $test -f $subscribefiles
then
  $formail -X "" -i "Reply-To: $subscraddr" -i "Subject: archive" \
   <$tmprequest >$tmpfrom
  $cat $tmpfrom >$tmprequest
  $echo "" >>$tmprequest
  $cat $subscribefiles >>$tmprequest		# setup fake archive commands
  $echo $subscraddr >$tmpfrom
  exec $arch_retrieve <$tmprequest		# the point of no return
fi