This file is indexed.

/usr/bin/ngconfigtest is in libarccommon1 1.1.1-1.

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
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
#!/usr/bin/perl -w

=head1 NAME

ngconfigtest - checks the arc.conf for inconsistencies, known problems
or (in a future development) just general bad taste.

=head1 SYNOPSIS

ngconfigtest --printall

=head1 DESCRIPTION

The motivation behind this little script was to have a repository for
automated tests on issues that came up on the NorduGrid developers
mailing list. As such this script indicates directories that are not
present or indicates that the cache directory does not reside on a file
system that knows how to implement UNIX locking properly. The tool is
supposed to help both the newbie and the experts to improve overall
reliability of the grid.

BECAUSE EVERY INSTALLATION OF ARC IS DIFFERENT THIS UTILITY ONLY SUGGESTS
WHAT COULD BE WRONG. SOMETIMES IT IS OVERRESTRICTIVE. AND SOMETIMES IT
CAN MISS SOME MISCONFIGURATION. NEVER TREAT RESULTS PRODUCED BY IT AS
ULTIMATE TRUTH.

=head1 OPTIONS

=over 4

=item --config <string>

Specifies the location of the config file, by default it is /etc/arc.conf

=item --printall

Lists all variable names of the config file together with their values.

=item --timeserver <server>

Allows the specification of a server against which to test the local
system's time.

=item --skip-warnings

Do not show warnings.

=item --help

Quick summary of options,

=item --man

Detailed man page.

=item --openssl-path <filename>

Path to openssl binary, determined with 'which openssl' if not set.

=back

=cut


#################### P R E A M B E L  and options parsing ####################

use strict;
use warnings;
use Getopt::Long;

my ($conffile,$printall,$skip_warnings,$help,$man)=("/etc/arc.conf",0,0,0,0);

#Please make sure this reference server is not one you administer yourself.\n";
my $timeserver="europe.pool.ntp.org";

my $globusloc = $ENV{"GLOBUS_LOCATION"};

my $arcloc = undef;
if (defined $ENV{"ARC_LOCATION"}) {
	$arcloc = $ENV{"ARC_LOCATION"};
} else {
	$arcloc = "/usr";
}
my $OS = `uname`;
chomp $OS;

my $usercert;
my $hostcert;
my $CApath;
my $opensslpath;
my $verbose=0;
my $debug=0;

GetOptions(
	"config:s" => \$conffile,
	"printall" => \$printall,
	"skip-warnings" => \$skip_warnings,
	"timeserver:s" => \$timeserver,
	"openssl-path:s" => \$opensslpath,
	"verbose" => \$verbose,
	"debug" => \$debug,
	"help" => \$help,
	"man" => \$man
	) or die "Could not parse options.\n";

if ( $man or $help ) {
        # Load Pod::Usage only if needed.
	require "Pod/Usage.pm";
	import Pod::Usage;
	pod2usage(1) if $help;
	pod2usage(VERBOSE => 2) if $man;
}


# key counters

my $warnings=0;
my $errors=0;

$verbose=1 if $debug;


########## S E E D   A S S U M P T I O N S   F O R   R U L E S ############

# Some bits of the configuration are dynamic and may cross-reference other
# bits of the configuration. This hash shall keep track of these.

my %introducedSections = (
	"group" => [],
	"infosys/cluster/registration" => [],
	"infosys/index" => [],
	"infosys/se" => [],
	"janitor" => [],
	"queue" => [],
	"se" => []
);

print STDERR "The following sections have configurable subgroups: "
		. join(", ",keys %introducedSections)."\n" if $verbose;

################ U T I L  R O U T I N E S #################################

$opensslpath=`which openssl | tr -d '\n'` unless defined($opensslpath);

# prints and counts a warning
sub w($) {
	my $s = shift;
	if (!$skip_warnings) {
		print STDERR "W: $s";
		$warnings++;
	}
}

# prints and counts an error
sub e($) {
	my $s = shift;
	print STDERR "E: $s";
	$errors++;
}

sub v($) {
	return unless $verbose or $debug;
	my $s = shift;
	print STDERR "$s";
}

####################### C H E C K S  #######################################

=head1 PERFORMED TESTS

=over 4

=item timecheck

The current time is compared with an external time server. A clock
shift higher than a maximally allowed maxtimediff results in an error.

=cut

sub timecheck($$) {
	my ($timeserver, $maxtimediff) = @_;
	my $timeoffset = undef;

	my $ntpdate = "/usr/sbin/ntpdate";
	unless ( -x $ntpdate )  {
		w("Could not spot location of 'ntpdate'.\n");
		return;
	}

	unless (open(NTPDATE, "$ntpdate -q $timeserver |")) {
		w("Could not properly invoke 'ntpdate'.\n");
		return;
	}
	while (<NTPDATE>) {
		next unless m/^server/;
		if (m/offset *[-+]?([0-9]*\.[0-9]*)/) {
			$timeoffset = $1;
		}
	}
	close NTPDATE;

	if (defined $timeoffset) {
		if (abs($timeoffset)>=$maxtimediff) {
			e("Timecheck: Your time diverts more than " .
				"$maxtimediff seconds ($timeoffset seconds) from the " .
				"public time server '$timeserver'\n");
		} else {
			w("Timecheck: Your time diverts slightly " .
				"$timeoffset seconds) from the public time " .
				"server '$timeserver'.\n");
		}
	} else {
		w("Timecheck: Can't check the time\n");
	}
}

=item check of permissions

The permission to access several different directories are checked.
The first argument is the file to be checked. The second is the permission
that is should have. The third is a binary mask that selects the bits
that are to be inspected.

=cut

sub permcheck($$$) {
	my ($filename, $p, $mask) = @_;
	my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
	       $atime,$mtime,$ctime,$blksize,$blocks)
	                  = stat($filename);
	$mode &= 07777;
	printf "$filename: mode %04o to be compared with %04o at mask %04o\n",$mode,$p,$mask if $debug;
	$mode &= $mask;
	return ($p == $mode);
}


# this performs simple stateless checks of configuration entries
sub confchecktripel($$$) {

	my ($block, $name, $value) = @_;

	printf STDOUT "Checking in block %s, name %s, value %s\n",$block,$name,$value if ($verbose);

	# check the certificate
	if ($block eq "common" and $name eq "x509_user_cert") {
		if (! -e $value) {
			e("The host certificate '$value' is not existing or unreadable.\n");
		} elsif (! -O $value) {
			e("The host certificate '$value' is not owned by this user.\n");
		} elsif (!permcheck($value,0644,0777) and !permcheck($value,0444,0777)) {
			e("Permission of '$value' must be 'rw-r--r--' or 'r--r--r--'\n");
		}
		else {
			$hostcert=$value;
		}
	}

	# check the key
	elsif ($block eq "common" and $name eq "x509_user_key") {
		if (! -e $value) {
			e("The host key '$value' is not existing or unreadable.\n");
		} elsif (! -O $value) {
			e("The host key '$value' is not owned by this user.\n");
		} elsif (!permcheck($value,0400,0777)) {
			e("Permission of '$value' must be 'r--------'\n");
		}
	}

	# check the certificate direcotry
	elsif ($block eq "common" and $name eq "x509_cert_dir") {
		if (! -d $value) {
			e("$name: The certificate directory is not existing.\n");
		} else {
			my @r0s=glob($value."/*.r0");
			if ($#r0s == -1) {
				w("$name: There are no certificate revocation lists.\n")
							unless $skip_warnings;
			} else {
				require File::stat;
				my $t=time();
				my $maxdiffsecs=60*60*24*2; # two days
				foreach my $r0 (@r0s) {
					my ($dev,$ino,$mode,$nlink,
						$uid,$gid,$rdev,$size,
						$atime,$mtime,$ctime,
						$blksize,$blocks)
						  = stat($r0);
					if ($t < $mtime ) {
						e("$r0: mtime in future\n");
					} elsif ($t > $mtime + $maxdiffsecs) {
						w("$r0: Older than $maxdiffsecs seconds. rerun grid-update-crls\n");
					}
				}
			}
			$CApath=$value;
		}
	}

	# check the cache directory
	elsif ($block eq "grid-manager" and $name eq "cachedir") {
		my @dirs=split(/\s+/,$value);
		# If available, second dir is on workernode
		my $d = $dirs[0];
		if (! -d $d)  {
			e("cachedir: not existing at '$d'\n");
		}
	}

	# check the controldir
	elsif ($block eq "grid-manager" and $name eq "controldir") {
		if (! -d $value)  {
			e("$value: control directory ($name) does not exist\n");
		} elsif (!permcheck($value,0755,0777)) {
			e("$value: directory ($name) should be 755\n");
		}
	}

	# check all remaining directory entries of the grid-manager block for existence
	elsif ($block eq "grid-manager" and $name =~ m/dir$/) {
		if (! -d $value)  {
			e("$value: directory ($name) does not exist\n");
		}
		else {
			v("$name exists.");
		}
	}

	# check for session and other directories dir
	if ($name =~ /^(sessiondir|runtimedir|cachedir|tmpdir|mount)$/) {
                if ($name =~ /^cachedir$/){
                        my @tmp = split (/\s+/,$value);
			# If available, second dir is on workernode.
                        $value = $tmp[0];
                }
		if (! -d "$value") {
			e("$value: session directory ($name) does not exist\n");
		}
		else {
			if ($name =~ /^(sessiondir|cachedir|mount)$/) {
				if (!permcheck($value,0001,0001)) {
					e("$value: session directory ($name) needs execute flag for the user that executes the computation, suggested is permission 705.\n");
				}
				elsif (!permcheck($value,0005,0005)) {
					w("$value: session directory ($name) may need read flag for the user that executes the computation, suggested is permission 705.\n");
				}
				if (! (permcheck($value,0070,0070)
					|| permcheck($value,0700,0700) )) {
					e("$value: session directory ($name) needs the user or the group to have complete rights. Suggested is permission 705.\n");
				}
			}
			if ($name =~ /^(tmpdir)$/) {
				if (! permcheck($value,0777,0777)) {
					e("The tmpdir directory must be writable and have the sticky bit set (chmod +t \"$name\")\n");
				}
			}
		}
	}

}

=item configuration check

General checks on the sensibility of the arc.conf

=cut

sub confcheck($) {
	my ($arcconf) = @_;
	my $config = {};

	unless (open (CONFIGFILE, "<$conffile")) {
		e("Could not open '$arcconf' for reading.\n");
		return;
	}
	my $blockname = undef;
	my $blockcontents = 0;
	my $c = 0;
	my $vo_counter = 0;
	while (my $line = <CONFIGFILE>) {
		$c++;

		next if $line =~ m/^#/;
		next if $line =~ m/^\s*$/;

		# a new block?
		if ($line =~ m/^\s*\[(.+)\]\s*$/) {
			if (defined $blockname and $blockcontents == 0) {
				printf STDERR "E: %s: Block \"%s\" is empty\n",
					$arcconf, $blockname;
			}

			$blockname = $1;
			$blockcontents = 0;

			# blocknames must be uniq
			# XXX but there is this special case of vo-blocks...
			if ($blockname eq "vo") {
				$blockname .= "|" . ++$vo_counter;
			}
			if (defined $config->{$blockname}) {
				if (!$skip_warnings) {
					w("$arcconf:$c: Block '"
					  . $blockname
					  ."' is defined multiple times\n");
				}
				$warnings++;
			}

			$config->{$blockname}{">]|found|[<"} = $c;

			next;
		}

		my $name;
		my $value;

		# look out for crap
		unless ($line =~ m/^([^=]*)=(.*)$/) {
			e("$arcconf: $c: Line is erroneous!\n");
			next;
		}

		$name = $1;
		$value = $2;

		$name =~ s/^\s*//;
		$name =~ s/\s*$//;
		$name =~ s/^"(.*)"$/$1/;
		$name =~ s/^'(.*)'$/$1/;

		$value =~ s/^\s*//;
		$value =~ s/\s*$//;
		$value =~ s/^"(.*)"$/$1/;
		$value =~ s/^'(.*)'$/$1/;

		if ($name =~ m/^"/ and $name !~ m/"$/
			or $name =~ m/^'/ and $name !~ m/'$/
			or $name !~ m/^"/ and $name =~ m/"$/
			or $name !~ m/^'/ and $name =~ m/'$/) {
				w("$arcconf: $c: badly quoted attribute name?\n");
		}
		if ($value =~ m/^"/ and $value !~ m/"$/
			or $value =~ m/^'/ and $value !~ m/'$/
			or $value !~ m/^"/ and $value =~ m/"$/
			or $value !~ m/^'/ and $value =~ m/'$/) {
				w("$arcconf: $c: badly quoted value?\n");
				$warnings++;
		}

		# are we within a block?
		unless (defined $blockname) {
			e("$arcconf:$c: found value=name pair which is " .
				"not part of a block\n");
			next;
		}

		# check if we know more about this kind of tripel
		confchecktripel($blockname, $name, $value);

		#count
		$blockcontents++;

		unless ($config->{$blockname}{$name}) {
			$config->{$blockname}{$name} = $value;
		} else {
			$config->{$blockname}{$name} .= ">]|sep|[<" . $value;
		}
	}

	close CONFIGFILE;

	check_completeness($config);

	if ($printall) {
		foreach my $key (sort { $config->{$a}{">]|found|[<"} <=> $config->{$b}{">]|found|[<"} }  keys %$config) {
			printf "\n# line: %d\n", $config->{$key}{">]|found|[<"};
			if ($key =~ m/^(.*)\|[0-9]+$/) {
				printf "[%s]\n", $1;
			} else {
				printf "[%s]\n", $key;
			}
			my $x = $config->{$key};
			foreach my $item (sort keys %$x) {
				next if $item eq ">]|found|[<";
				foreach my $val (split />\]\|sep\|\[</, $config->{$key}{$item}) {
					printf "%s=\"%s\"\n", $item, $val;
				}
			}
		}
	}
}

=item check for completeness

Return error if the presence of one value implies one of another

=cut

sub check_completeness() {
	my $config=shift;

	my @required=("common", "grid-manager",
		"gridftpd", "gridftpd/jobs",
		"infosys", "cluster",
	);

	my @optional=("httpsd","janitor","group","httpsd/se","vo");

	my @all=(@required,@optional);

	# testing for unknown
	foreach my $k (keys %$config) {
		next if grep(/^$k$/,@all);
		my @secs;
		map { push(@secs,$_) if $k=~/^$_/;} keys %introducedSections;
		print STDERR "$k -> " . join(":",@secs)."\n" if $debug;

		if (0 == @secs) {
			unless ($skip_warnings) {
				w("Unknown group identifier '$k'\n");
			}
			next;
		}
		elsif (1 < @secs) {
			die "Programming error: found multiple sections "
			    .join(",",@secs)." to be prefixes of secion '$k'.\n";
		}

		my $secs1 = $secs[0];
		unless (exists($introducedSections{$secs1})) {
			die "Programming error: section '$secs1' not amongs keys of hash %introducedSections: "
			    . join(",",keys %introducedSections)."\n";
		}
		my $listref=$introducedSections{$secs1};
		push @$listref,$k;
	}

	# testing for the missing
	foreach my $k (@required) {
		unless (exists($config->{$k})) {
			e("Missing group identifier '$k'\n");
		}
	}

	if (exists($config->{common})) {
	    my $hn=`hostname -f`;
	    chomp($hn);
	    if (!exists($config->{common}{lrms})) {
		e("The entry lrms must not be missed.\n");
	    }
	    if (!exists($config->{common}{hostname})) {
		e("The entry hostname must not be missed.\n");
	    }
	    elsif ($config->{common}{hostname} ne "$hn") {
		e("The entry of the full hostname (".$config->{common}{hostname}
			                      . ") is better\n"
		            ."   equal to `hostname -f` ($hn).\n"
		            ."   Also test reverse lookup of the hostname.\n");
	    }

	}
}

=item check of applications

Some applications are required for the server to be functional.

=cut

sub check_applications() {
	unless ( -x "/usr/bin/time" ) {
		e("Could not find GNU time utility (or a substitute) at /usr/bin/time.");
	}
}


=item check of libraries

uses ldd to check if all libraries are installed

=cut

sub check_libraries() {

	my $prob=0;
	
	if (! defined($globusloc)) {
		v("check_libraries: interpreting undefined GLOBUS_LOCATION as /usr\n");
		$globusloc="/usr";
	}

	unless ( -e $globusloc) {
		e("Cannot find Globus at $globusloc: no such file or directory\n");
		$prob++;
	}

	if (defined($arcloc)) {
		unless (-e $arcloc) {
			e("Cannot find ARC at $arcloc: no such file or directory\n");

			if (defined $ENV{"ARC_LOCATION"}) {
				w("The location was retrieved from the environment variable 'ARC_LOCATION'. Maybe this needs an update.");
			}
			$prob++;
		}
	}

	return if ($prob);

	my @globmes = ( $globusloc . "/bin/ng*",
			$globusloc . "/bin/arc*",
			$globusloc . "/bin/gm*",
			$globusloc . "/bin/grid*",
			$globusloc . "/bin/http*",
			$globusloc . "/sbin/ng*",
			$globusloc . "/sbin/arc*",
			$globusloc . "/sbin/gm-*",
			$globusloc . "/sbin/grid*",
			$globusloc . "/sbin/http*"
	);

	push(@globmes, ($arcloc . "/bin/ng*",
			$arcloc . "/bin/arc*",
			$arcloc . "/bin/gm*",
			$arcloc . "/bin/grid*",
			$arcloc . "/bin/http*",
			$arcloc . "/sbin/ng*",
			$arcloc . "/sbin/arc*",
			$arcloc . "/sbin/gm-*",
			$arcloc . "/sbin/grid*",
			$arcloc . "/sbin/http*"
	));

	push(@globmes, $globusloc . "/lib/*") if "/usr" ne "$globusloc"; # takes too long, little gain expected
	push(@globmes, $arcloc . "/lib/*") if "/usr" ne "$arcloc"; # takes too long, little gain expected

	my @to_check;
	foreach my $d (@globmes) {
		@to_check = ( @to_check , glob $d );
	}

	if ($verbose) {
		print "Checking the following files for their dependencies:\n";
		print join("\n",@to_check);
		print "\n";
	}

	my %missing;
	foreach my $file ( @to_check ) {
		next unless -f $file;
		next if $file =~ m/\.a$/;
		next if $file =~ m/\.la$/;

		my $command = "LC_ALL=C ";
		$command .= "LD_LIBRARY_PATH=";
		$command .= "$globusloc/lib:" if "/usr" ne "$globusloc" and "/usr/" ne "$globusloc";
		$command .= "$arcloc/lib:" if "/usr" ne "$arcloc" and "/usr/" ne "$arcloc";
		$command .= "\$LD_LIBRARY_PATH ";
		$command .= "ldd $file 2>/dev/null |";

		my %libs;

		if (open LDD, $command) {
			while (<LDD>) {
				chomp;
				my $lib = $_;

				if ($lib =~ m/^\s*([^\s]+)\.so\.([^\s]+)\s*=>/) {
					my $a=$1;
					my $b=$2;
					my $index=$a;
					$index =~ s/_(gcc)(16|32|64|128|256)(dbg)?(pthr)?\././;
					if (defined $libs{$index}) {
						e("$file: uses multiple versions of lib " .
							"$a: ".$libs{$index}." and $b. This might not work\n");
					} else {
						$libs{$index} = $b;
					}
				}

				next unless /not found/;

				$lib =~ m/^\s*([^\s]+)\s*=>/;
				my $missing = $1;

				unless (defined $missing{$missing}) {
					$missing{$missing} = 1;
					e("$file: needs $missing. Not found.\n");
				}

			}
			close LDD;
		} else {
			if (!$skip_warnings) {
				w("Cannot check used libraries of $file.\n");
			}
		}
	}
}

sub check_certificates() {

	# check if CAdir is present

	if (!defined($CApath)) {
		e("The x509_cert_dir was not set.\n");
		$CApath="/etc/grid-security/certificates";
		if ( ! -d $CApath) {
			return;
		}
	}
	elsif ( ! -d "$CApath") {
		e("CApath does not exist at '$CApath");
		return;
	}

	unless (defined($opensslpath) and "" ne "$opensslpath") {
		w("openssl application not in path and not specified.\n");
		return;
	}

	unless ( -x "$opensslpath") {
		e("Cannot execute openssl application at '$opensslpath'");
	}

	# check of host certificate

	if (!defined($hostcert)) {
		$hostcert="/etc/grid-security/hostcert.pem";
	}
	if ( -f $hostcert) {
		if (system("$opensslpath verify -CApath $CApath $hostcert | grep 'OK'")) {
			e("Verification of host cert at $hostcert with $opensslpath failed.\n");
		}
	}
	else {
		if (!$skip_warnings) {
			w("Not verifying host cert which is not present at $hostcert (should already be reported).\n");
		}
	}


	# check of user certificate

	if (!defined($usercert)) {
		$usercert=$ENV{"HOME"}."/.globus/usercert.pem";
	}
	if ( -f $usercert) {
		if (system("openssl verify -CApath $CApath $usercert | grep 'OK'")) {
			e("verification of user cert at $usercert with $opensslpath failed.\n");
		}
	}
	else {
		if (!$skip_warnings) {
			w("Not verifying user cert which is not present at $usercert.\n");
		}
	}
}



#
# What is there to mention if the globus location is unknown?
#
unless (defined($globusloc)) {
	w("Globus location not specified. That is fine, but be aware of it.\n");
}


timecheck($timeserver, 0.2);
confcheck($conffile);
check_applications();
check_libraries();
check_certificates();

if (0 == $errors) {
	print "Found no apparent failures.\n";
} else {
	printf "Found %d failure%s.\n", $errors, ($errors > 1) ? "s" : "";
}
if ($warnings) {
	printf "Found %d non-critical issue%s%s.\n",
		$warnings, ($warnings > 1) ? "s" : "",
		($skip_warnings?" (not shown)":"");
}

exit $errors;

=back

=head1 SEE ALSO

http://www.nordugrid.org and our mailing lists.

=cut


# EOF