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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#!/bin/sh
# PCP QA Test No. 454
# Check parsing of PMCD config file with errors
#
# Copyright (c) 2011 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
_filter_pmcd_log \
| sed \
-e "s:$tmp:TMP:g"
}
# real QA test starts here
export PCP_PMCDCONF_PATH=$tmp.conf
export PMCD_SOCKET=$tmp.pmcd.socket
cat <<End-of-File >$tmp.conf
# no entry point _or_ pathname
first 1 dso
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
# spaces, but no pathname
first 1 dso first_init
first 1 dso first_init no_leading_slash
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
first 1 dso first_init /first/pmda/dso extra arguments
# bad protocol
first 1 socket foonet /someplace/mypmda
# bad pmda ipc type
foo 1 foo binary mypmda
# no socket name/number
first 1 socket unix
# bad socket name
first 1 socket inet no_such_service
# bad type
first 1 pipe not-binary
# bad domain
second foo pipe binary mypmda
third 100000 pipe binary mypmda
# command missing
first 1 pipe binary
foo 1 pipe binary mypmda
# duplicate domain
bar 1 pipe binary mypmda
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
# unterminated quote
first 1 pipe binary mypmda "foo""
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
first 1 pipe binary mypmda with is a very long list of args\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789\
the end
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
first 1 pipe binary mypmda "foo
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
# empty access control section
[access]
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
# access control cases not checked in QA 051
#
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
[access
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
[foo
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
[ foo
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
[access]
allow localhost ;
allow "unix:" ;
allow localhost : ;
allow "local:" : ;
allow localhost : fetch, ;
disallow localhist, 127.0.0.* : all except all;
disallow "unix:" , "local:" : all except all;
disallow 127.0.* : all, store;
allow localhost : fetch, maximum 7 connections, store, maximum 3 connections;
allow "local:" : fetch, maximum 7 connections, store, maximum 3 connections;
allow localhost : fetch, maximum foo connections;
allow "local:" : fetch, maximum foo connections;
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
[access]
allow localhost : store
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
cat <<End-of-File >$tmp.conf
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
[access]
allow localhost, 127.0.0.1
End-of-File
pmcd -f -p 9876 -x $seq.full -l $tmp.log
_filter <$tmp.log
# success, all done
exit
|