This file is indexed.

/usr/lib/kannel/checks/check_ppg.sh is in kannel-extras 1.4.4-4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
#!/bin/sh
#
# Use 'test/test_ppg' and 'test/test_http_server' to test PPG. It presumes
# using of http smsc.
#
# Note: Running this script can take quite a long time, if your input does have
# many files. Two (ok ip and sms control document) should be quite enough for 
# a general make check. Use more only if you are interested of detailed test-
# ing of ppg.

set -e
#set -x

host=127.0.0.1
list_port=18082
server_port=18081
push_port=18080
loglevel=0
username="foo"
password="bar"
prefix="test"
contents="sl" 
# Kannel configuration file
conf_file="gw/pushkannel.conf"
# Push content. Use only sl, because compilers should be tested separately
content_file="$prefix/sl.txt"
# Ok ip control files
ip_control_files="$prefix/*iptest*"
# Ok sms control files
sms_control_files="$prefix/*smstest*"
# Erroneous ip control files
wrong_ip_files="$prefix/*witest*"
# Erroneous sms control files
wrong_sms_files="$prefix/*wstest*"
# File containing the blacklist
blacklist="$prefix/blacklist.txt"
# File containing the whitelist
whitelist="$prefix/whitelist.txt"

sleep 1
test/test_http_server -p $list_port -w $whitelist -b $blacklist > check_http_list.log 2>&1 & listid=$!
error=no

# ok control files requesting an ip bearer. Names contain string 'ip'. Bearer-
# box should not use smsc (do a http fetch) when ip bearer is requested.

for control_file in $ip_control_files;
    do 
        if [ -f $control_file ]
        then
            gw/bearerbox -v $loglevel $conf_file > check_bb.tmp 2>&1 & bbpid=$!
            sleep 2 

            gw/wapbox -v $loglevel $conf_file > check_wap.tmp 2>&1 & wappid=$!
            sleep 2

            test/test_ppg -c $contents http://$host:$push_port/cgi-bin/wap-push.cgi?username=$username'&'password=$password $content_file $control_file > check_ppg.tmp 2>&1 
            sleep 1

            if ! grep "and type push response" check_ppg.tmp > /dev/null
            then
                cat check_ppg.tmp >> check_ppg.log 2>&1
                error="yes"
                echo "ppg failed with control file $control_file"
            fi

            if ! grep "Connectionless push accepted" check_wap.tmp > /dev/null
            then
                cat check_wap.tmp >> check_wap.log 2>&1
                error="yes"
                echo "wap failed with control file $control_file"
            fi
        
            if ! grep "got wdp from wapbox" check_bb.tmp > /dev/null
            then
                cat check_bb.tmp >> check_bb.log 2>&1
                error="yes"
                echo "bb failed with control file $control_file"
            fi

            kill -INT $wappid
            sleep 1
            kill -INT $bbpid
            sleep 2

# We can panic when we are going down, too
            if test "$error" != "yes"          
            then
                if grep 'WARNING:|ERROR:|PANIC:' check_bb.tmp > /dev/null
                then
                    cat check_bb.tmp >> check_bb.log 2>&1
                    error="yes"
                    echo "got errors in bb when going down when $control_file"
                fi

                if grep 'WARNING:|ERROR:|PANIC:' check_wap.tmp > /dev/null
                then
                    cat check_wap.tmp >> check_wap.log 2>&1
                    error="yes"
                    echo "got errors in wap when going down when $control_file"
                fi 

                if grep 'WARNING:|ERROR:|PANIC:' check_ppg.tmp > /dev/null
                then
                    cat check_ppg.tmp >> check_ppg.log 2>&1
                    error="yes"
                    echo "got errors in ppg when going down when $control_file"
                fi 
           fi
         
           rm -f check_bb.tmp check_wap.tmp check_ppg.tmp
        fi;
    done

# Erroneous control files requesting an ip bearer. Ppg should reject these and
# report pi. Names contain string 'wi'.

for control_file in $wrong_ip_files;
    do 
        if [ -f $control_file ]
        then
            have_iperrors=yes
            gw/bearerbox -v $loglevel $conf_file > check_bb.tmp 2>&1 & bbpid=$!
            sleep 2 

            gw/wapbox -v $loglevel $conf_file > check_wap.tmp 2>&1 & wappid=$!
            sleep 2

            test/test_ppg -c $contents http://$host:$push_port/cgi-bin/wap-push.cgi?username=$username'&'password=$password $content_file $control_file > check_ppg.tmp 2>&1
            sleep 1

            if ! grep "and type push response" check_ppg.tmp > /dev/null &&
               ! grep "and type bad message response" check_ppg.tmp > /dev/null
            then
                cat check_ppg.tmp >> check_ppg.log 2>&1
                error="yes"
                echo "ppg failed when control file $control_file"
            fi

            if grep "Connectionless push accepted" check_wap.tmp > /dev/null &&
               grep "WARNING" check_wap.tmp > /dev/null 
            then
                cat check_wap.tmp >> check_wap.log 2>&1
                error="yes"
                echo "wap failed when control file $control_file"
            fi
        
            if grep "got wdp from wapbox" check_bb.tmp > /dev/null
            then
                cat check_bb.tmp >> check_bb.log 2>&1
                error="yes"
                echo "bb failed when control file $control_file"
            fi

            kill -INT $wappid
            sleep 1
            kill -INT $bbpid
            sleep 2

# We can panic when we are going down, too
            if test "$error" != "yes"
            then
                if grep 'ERROR:|PANIC:' check_bb.tmp > /dev/null
                then
                    cat check_bb.tmp >> check_bb.log 2>&1
                    error="yes"
                    echo "got errors in bb when going down with $control_file"
                fi

                if grep 'ERROR:|PANIC:' check_wap.tmp > /dev/null
                then
                    cat check_wap.tmp >> check_wap.log 2>&1
                    error="yes"
                    echo "got errors in wap when going down with $control_file"
                fi 

                if grep 'ERROR:|PANIC:' check_ppg.tmp > /dev/null
                then
                    cat check_ppg.tmp >> check_ppg.log 2>&1
                    error="yes"
                    echo "got errors in ppg when going down with $control_file"
                fi 
           fi
         
           rm -f check_bb.tmp check_wap.tmp check_ppg.tmp
        fi;
    done

# Ok control files requesting a sms bearer. Names contain string 'sms'. Ppg
# should use smsc (do a http fetch).

for control_file in $sms_control_files;
    do 
        if [ -f $control_file ]
        then
            test/test_http_server -p $server_port > check_http_sim.tmp 2>&1 & simid=$!
            sleep 1
            gw/bearerbox -v $loglevel $conf_file > check_bb.tmp 2>&1 & bbpid=$!
            sleep 2 
            gw/wapbox -v $loglevel $conf_file > check_wap.tmp 2>&1 & wappid=$!
            sleep 2
            test/test_ppg -c $contents http://$host:$push_port/cgi-bin/wap-push.cgi?username=$username'&'password=$password $content_file $control_file > check_ppg.tmp 2>&1 
            sleep 1

            if ! grep "and type push response" check_ppg.tmp > /dev/null
            then
                cat check_ppg.tmp >> check_ppg.log 2>&1
                error="yes"
                echo "ppg failed with control file $control_file"
            fi

            if ! grep "Connectionless push accepted" check_wap.tmp > /dev/null
            then
                cat check_wap.tmp >> check_wap.log 2>&1
                error="yes"
                echo "wap failed with control file $control_file"
            fi
        
            if ! grep "got sms from wapbox" check_bb.tmp > /dev/null
            then
                cat check_bb.tmp >> check_bb.log 2>&1
                error="yes"
                echo "bb failed with control file $control_file"
            fi
           
            kill -INT $wappid
            sleep 1
            kill -INT $bbpid
            sleep 2
            test/test_http -qv 4 http://$host:$server_port/quit
            sleep 2
# We can panic when we are going down, too
            if test "$error" != "yes"  
            then
                if grep 'WARNING:|ERROR:|PANIC:' check_bb.tmp > /dev/null
                then
                    cat check_bb.tmp >> check_bb.log 2>&1
                    error="yes"
                    echo "got errors in bb when going down with $control_file"
                fi 

                if grep 'WARNING:|ERROR:|PANIC:' check_wap.tmp > /dev/null
                then
                    cat check_wap.tmp >> check_wap.log 2>&1
                    error="yes"
                    echo "got errors in wap when going down with $control_file"
                fi 

                if grep 'WARNING:|ERROR:|PANIC:' check_ppg.tmp > /dev/null
                then
                    cat check_ppg.tmp >> check_ppg.log 2>&1
                    error="yes"
                    echo "got errors in ppg when going down with $control_file"
                fi

                if grep 'WARNING:|ERROR:|PANIC:' check_http_sim.tmp > /dev/null
                then
                    cat check_sim.tmp >> check_sim.log 2>&1
                    error="yes"
                    echo "errors, http_sim when going down with $control_file"
                fi 
            fi
         
            rm -f check_bb.tmp check_wap.tmp check_ppg.tmp check_http_sim.tmp
        fi;
    done

# Erroneous control documents requesting a sms bearer. Ppg should reject these
# and inform pi. Names contain the string 'ws'.

for control_file in $wrong_sms_files;
    do 
        if [ -f $control_file ]
        then
            test/test_http_server -p $server_port > check_http_sim.tmp 2>&1 & simid=$
            sleep 1
            gw/bearerbox -v $loglevel $conf_file > check_bb.tmp 2>&1 & bbpid=$!
            sleep 2 

            gw/wapbox -v $loglevel $conf_file > check_wap.tmp 2>&1 & wappid=$!
            sleep 2

            test/test_ppg -c $contents http://$host:$push_port/cgi-bin/wap-push.cgi?username=$username'&'password=$password $content_file $control_file > check_ppg.tmp 2>&1
            sleep 1

            if ! grep "and type push response" check_ppg.tmp > /dev/null &&
               ! grep "and type bad message response" check_ppg.tmp > /dev/null
            then
                cat check_ppg.tmp >> check_ppg.log 2>&1
                error="yes"
                echo "ppg failed, going down with control file $control_file"
            fi

            if grep "Connectionless push accepted" check_wap.tmp > /dev/null &&
               grep "WARNING" check_wap.tmp > /dev/null 
            then
                cat check_wap.tmp >> check_wap.log 2>&1
                error="yes"
                echo "wap failed, going down with control file $control_file"
            fi
        
            if grep "got sms from wapbox" check_bb.tmp > /dev/null
            then
                cat check_bb.tmp >> check_bb.log 2>&1
                error="yes"
                echo "bb failed, going down with control file $control_file"
            fi

            kill -INT $wappid
            sleep 2
            kill -INT $bbpid
            sleep 1
            test/test_http -qv 4 http://$host:$server_port/quit
            sleep 2

# We can panic when we are going down, too
            if test "$error" != "yes" 
            then
                if grep 'ERROR:|PANIC:' check_bb.tmp > /dev/null
                then
                    cat check_bb.tmp >> check_bb.log 2>&1
                    error="yes"
                    echo "got errors in bb when ending tests"
                fi

                if grep 'ERROR:|PANIC:' check_wap.tmp > /dev/null
                then
                    cat check_wap.tmp >> check_wap.log 2>&1
                    error="yes"
                    echo "got errors in wap when ending tests"
                fi 

                if grep 'ERROR:|PANIC:' check_ppg.tmp > /dev/null
                then
                    cat check_ppg.tmp >> check_ppg.log 2>&1
                    error="yes"
                    echo "got errors in ppg when ending tests"
                fi 

                if grep 'ERROR:|PANIC:' check_http_sim.tmp > /dev/null
                then
                    cat check_http_sim.tmp >> check_http_sim.log 2>&1
                    error="yes"
                    echo "got errors in http_sim when ending tests"
                fi
            fi
         
            rm -f check_bb.tmp check_wap.tmp check_ppg.tmp
        fi;
done

kill -INT $listid
sleep 1
test/test_http -qv 4 http://$host:$list_port/quit
wait

if test "$error" = "yes"
then
        echo "check_ppg failed" 1>&2
	echo "See check_bb.log, check_wap.log, check_ppg.log," 1>&2
	echo "check_http_list.log, check_http_sim.log for info" 1>&2
	exit 1 
fi

rm -f check_bb.log check_wap.log check_ppg.log check_http_list.log check_http_sim.log

exit 0