This file is indexed.

/var/lib/pcp/testsuite/setup.051 is in pcp-testsuite 3.9.10.

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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
#! /bin/sh
#

. $PCP_DIR/etc/pcp.env
. ./common.check

# get valid hostnames: $remote_1, $remote_2, etc.
#
. ./051.hosts

host=`hostname`
if [ -z "$host" ]
then
    echo "Cannot discover local host name!"
    exit 1
fi

ipaddr=`_host_to_ipaddr $host`
if [ -z "$ipaddr" ]
then
    echo "Cannot translate hostname ($host) to an IP address!"
    exit 1
fi

rm -rf 051.work
mkdir 051.work
cd 051.work

##############################################################################
# The die.* tests die automatically by themselves.

cat >die.001 <<End-of-File
# Test whitespace in "[access]" token

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]

die!
End-of-File

cat >die.002 <<End-of-File
# Test whitespace in "[access]" token

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[ access]

die!
End-of-File

cat >die.003 <<End-of-File
# Test whitespace in "[access]" token

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[ access ]

die!
End-of-File

cat >die.004 <<End-of-File
# Test whitespace in "[access]" token

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[ 
# what the &^*%# is this doing here!?
access
 ]

die!
End-of-File

cat >die.005 <<End-of-File
# Test missing host list

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow : all;

die!
End-of-File

cat >die.006 <<End-of-File
# Test missing comma in host list

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1 $remote_2: all;

die!
End-of-File

cat >die.007 <<End-of-File
# Test extra comma in host list

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1,: all;

die!
End-of-File

cat >die.008 <<End-of-File
# Test missing colon after host list

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1 all;

die!
End-of-File

cat >die.009 <<End-of-File
# Test extra comma and missing colon after host list

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1, all;

die!
End-of-File

cat >die.010 <<End-of-File
# Test missing semicolon

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: all

die!
End-of-File

cat >die.011 <<End-of-File
# Test statement with lotsa whitespace and comments interspersed.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
# I think
   allow#that I
#will never
	   $remote_1



#see
  	:   #a thing as beautiful
all
# as
# the bottom of my in-tray

;

    	die here!
End-of-File

cat >die.012 <<End-of-File
# Test all operation types.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]

allow $remote_1 : fetch;
allow $remote_1 : store;
allow $remote_1 : all;
allow $remote_1 : maximum 666 connections;

die!
End-of-File

cat >die.013 <<End-of-File
# Test all operations in a single permission list.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: fetch, store, maximum 666 connections;

die!
End-of-File

cat >die.014 <<End-of-File
# Test clash of "all" with a specific operation.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: all, fetch;

die!
End-of-File

cat >die.015 <<End-of-File
# Test that "all" works with a connection limit.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: all, maximum 666 connections;

die!
End-of-File

cat >die.016 <<End-of-File
# Test that specific operations work with a connection limit.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: fetch, store, maximum 666 connections;

die!
End-of-File

cat >die.017 <<End-of-File
# Test that a connection limit fails in a disallow.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
disallow $remote_1: store, maximum 666 connections;

die!
End-of-File

cat >die.018 <<End-of-File
# Test that a connection limit fails in a disallow with except.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
disallow $remote_1: all except fetch, maximum 666 connections;

die!
End-of-File

cat >die.019 <<End-of-File
# Test that a connection limit is OK in an allow with an except.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: all except store, maximum 666 connections;

die!
End-of-File

cat >die.020 <<End-of-File
# Test that a bogus hostname is detected

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow error...mebourne : fetch;

die!
End-of-File

cat >die.021 <<End-of-File
# Test a no such host condition
#
sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow nosuchhost.melbourne.sgi.com : fetch;

die!
End-of-File

cat >die.022 <<End-of-File
# Test that a bogus IP address

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow 192.2.3.999 : fetch;

die!
End-of-File

cat >die.023 <<End-of-File
# Test bad wildcard detection in IP address

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow 192.*.2 : fetch;

die!
End-of-File

cat >die.024 <<End-of-File
# Test embedded wildcard detection in host name

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow *.melbourne : fetch;

die!
End-of-File

cat >die.025 <<End-of-File
# Test wildcard detection in textual host name

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow melbourne.* : fetch;

die!
End-of-File

cat >die.026 <<End-of-File
# Test range check for IP address components

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow 192.-1.* : fetch;
allow 192.256.* : fetch;

die!
End-of-File

cat >die.027 <<End-of-File
# Test "reinforcing" of permissions

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1 : fetch;
allow $remote_1 : fetch;

die!
End-of-File

cat >die.028 <<End-of-File
# Test contradictory permissions

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1 : fetch;
disallow $remote_1 : fetch;

die!
End-of-File

cat >die.029 <<End-of-File
# Test contradictory permissions with host aliasing (IP and name)

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $host : all;
disallow $ipaddr : fetch;

die!
End-of-File

cat >die.030 <<End-of-File
# Test contradictory permissions with host aliasing (different names)

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1 : all;
disallow $remote_1 : fetch;

die!
End-of-File

cat >die.031 <<End-of-File
# Test mutually exclusive host lists

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1, $remote_2 : all;
disallow $remote_3, $remote_4 : store;

die!
End-of-File

cat >die.032 <<End-of-File
# Test overlapping host lists

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1, $remote_2 : all;
allow $remote_3, $remote_2 : fetch, store;

die!
End-of-File

cat >die.033 <<End-of-File
# Test overlapping host lists with conflict

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1, $remote_4, $remote_2 : all;
disallow $remote_3, $remote_2, $remote_5 : store;

die!
End-of-File

cat >die.034 <<End-of-File
# Test overlapping host lists with conflicting connection counts

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1, $remote_4, $remote_2 : all, maximum 30 connections;
allow $remote_3, $remote_2, $remote_5 : fetch, store, maximum 10 connections;

die!
End-of-File

cat >die.035 <<End-of-File
# Test various levels of wildcarding

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow 192.68.139.105:	all;
allow 192.68.139.*:	all, maximum 666 connections;
allow 192.68.*:		all except store, maximum 555 connections;
allow 192.*:		fetch, store, maximum 444 connections;
allow *:		fetch, maximum 333 connections;

die!
End-of-File

cat >die.036 <<End-of-File
# Test various levels of wildcarding with several similar setups

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow 192.68.139.105:	all;
allow 192.68.139.*:	all, maximum 666 connections;
allow 192.68.*:		all except store, maximum 555 connections;
allow 192.*:		fetch, store, maximum 444 connections;
allow *:		fetch, maximum 333 connections;

allow 193.68.139.105:	all;
allow 193.68.139.*:	all, maximum 666 connections;
allow 193.68.*:		all except store, maximum 555 connections;
allow 193.*:		fetch, store, maximum 444 connections;

allow 194.68.139.105:	all;
allow 194.68.139.*:	all, maximum 666 connections;
allow 194.68.*:		all except store, maximum 555 connections;
allow 194.*:		fetch, store, maximum 444 connections;

die!
End-of-File

cat >die.037 <<End-of-File
# Test reinforcing of disallows

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
disallow $remote_1: fetch;
disallow $remote_1: store;
disallow $remote_1: all;

die!
End-of-File

cat >die.038 <<End-of-File
# Test detection of multiple conflicting explicit connections limits

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: maximum 5 connections, fetch, maximum 666 connections;

die!
End-of-File

cat >die.039 <<End-of-File
# Test detection of connections limits immediately after "all except"

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: all except maximum 5 connections;

die!
End-of-File

cat >die.040 <<End-of-File
# Test unlimited connections access spec.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: unlimited connections;

die!
End-of-File

cat >die.041 <<End-of-File
# Test clash of unlimited connections with explicit maximum

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: unlimited connections;
allow $remote_1: fetch, maximum 666 connections;

die!
End-of-File

cat >die.042 <<End-of-File
# Test reinforcing of unlimited connections

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: store, unlimited connections;
allow $remote_1: fetch, unlimited connections;

die!
End-of-File

# Note: no quotes around "End-Of-File" or $host and $ipaddr not expanded

cat >die.043 <<End-of-File
# Test conflicts with localhost aliasing

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow localhost: all;
disallow $host: fetch;
disallow $ipaddr : store;

die!
End-of-File

cat >die.044 <<End-of-File
# Check that log advisory and log mandatory no longer work

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1 : log advisory;
allow $remote_1 : log mandatory;

die!
End-of-File

cat >die.045 <<End-of-File
# Test invalid and valid operations in a single permission list.

sample		254	socket	inet 2077	$PCP_PMDAS_DIR/sample/pmdasample -i 2077

[access]
allow $remote_1: fetch, store, log advisory, log mandatory, maximum 666 connections;

die!
End-of-File

##############################################################################
# The kill.* tests must be killed as they leave pmcd running.

cat >kill.001 <<End-of-File
# Test various special case tokens and the parser

tricky		128	pipe	binary		\\
			cat "whacko name" \\
			more  	 		 params x-D x-R x-d 43\\
21 back\\\\slash "broken\\
string" \\
abc:def 1;2;3 zzz "#abc\\"def" "x \\"y\\" z" \\#abc #and a comment\\
to_end
End-of-File

#
cat >filter.kill.001 <<'End-of-File'
#! /bin/sh
#
# Filter log from kill.001

. $PCP_DIR/etc/pcp.env

echo "This is  `basename $0` "
echo
sed -e '/No such file/s/^cat:/Cannot open/' \
| tee kill.001.$$ \
| grep -v "Cannot open" \
| sed -e 's/^$//' \
	-e '/^[A-Z][a-z][a-z] [A-Z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/d' \
        -e '/^Log for pmcd on/s/ on .*/ on .../' \
        -e '/^Log finished/s/finished .*/finished .../' \
	-e 's/^\[[A-Z].. [A-Z]..  *[0-9][0-9]* ..:..:..]/[DATE]/' \
	-e '/pmcd([0-9][0-9]*)/s//pmcd(PID)/' \
	-e '/pcp\[[0-9][0-9]*]/s//pcp[PID]/' \
        -e '/^pmcd: PID/s/= .*/= PID/' \
	-e '/pmcd caught SIG.* from pid=/s/=[0-9][0-9]*/=N/g' \
| $PCP_AWK_PROG '
/pipe cmd=/		{ $4 = "FD"; $5 = "FD" }
/ok .* INADDR_ANY/	{ $2 = "FD" }
/ok .*pmcd.socket$/	{ next }
/^tricky/	{ for ( i = 1 ; i <= NF ; i++ )
		    if ( i == 3 ) printf "PID " ; else printf "%s ", $i 
		    printf "\n"
		    next
		}
			{ print }
'
echo
echo 'dummy cat agent should have produced "Cannot open" messages:'
grep "Cannot open" kill.001.$$
rm kill.001.$$
End-of-File

chmod u+x filter.kill.001