blob: 77932a3095f023517b0688f2c6b1819acd64541a (
plain)
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
|
. functions
inj() { inject -n -v "$@" a </dev/null 2>/dev/null | head -n 1; }
testvar() {
set -e
echo "Checking that inject obeys $1."
export $1="$2"
inj | grep -q "$3"
}
testcanon() {
set -e
echo "Checking that inject canonicalizes $1."
export $1="$2"
inj | grep -q "$3"
}
testhdr() {
set -e
echo "Checking that inject $1 $2:"
echo $2: $3 | inject -n -v a 2>/dev/null | head -n 1 | grep -q "$4"
}
testign() { testhdr ignores "$@"; }
testset() { testhdr uses "$@"; }
testfrom() {
echo "Checking that inject honors -f '$1'"
inj -f "$1" | grep -qx "$2"
}
testfrom2() {
testfrom "$1" "$2"
testfrom "<$1>" "$2"
}
echo "Checking that inject obeys me"
rm -f $SYSCONFDIR/default*
inj | grep -q "@f.q.d.n$"
echo "Checking that inject obeys config/defaulthost"
echo test.org >$SYSCONFDIR/defaulthost
inj | grep -q '@test.org$'
echo "Checking that inject obeys config/defaultdomain"
echo test >$SYSCONFDIR/defaulthost
echo domain.org >$SYSCONFDIR/defaultdomain
inj | grep -q '@test.domain.org$'
echo "Checking that inject ignores config/defaultdomain for localhost"
echo localhost >$SYSCONFDIR/defaulthost
inj | grep -q '@localhost$'
testvar HOSTNAME test1.org '@test1.org$'
testcanon HOSTNAME test1 '@test1.domain.org$'
testvar MAILHOST test2.org '@test2.org$'
testcanon MAILHOST test2 '@test2.domain.org$'
testvar NULLMAILER_HOST test3.org '@test3.org$'
testcanon NULLMAILER_HOST test3 '@test3.domain.org$'
echo "Checking that inject uses getpwnam"
inj | grep -q "^`id -un`@"
testvar LOGNAME name1 '^name1@'
testvar USER name2 '^name2@'
testvar MAILUSER name3 '^name3@'
testvar NULLMAILER_USER name4 '^name4@'
testign Errors-To a@b.c '^name4@test3'
testign From a@b.c '^name4@test3'
testign Reply-To a@b.c '^name4@test3'
testign Resent-From a@b.c '^name4@test3'
testign Resent-Reply-To a@b.c '^name4@test3'
testign Resent-Sender a@b.c '^name4@test3'
testign Return-Receipt-To a@b.c '^name4@test3'
testign Sender a@b.c '^name4@test3'
testset Return-Path name0@host0.org '^name0@host0.org$'
export NULLMAILER_FLAGS=s
testign Return-Path name0@host0.org '^name4@test3'
testfrom2 '' ''
testfrom2 'a@b.c' 'a@b.c'
testfrom2 'a@b' 'a@b.domain.org'
|