Commit 8c624fed authored by Leigh B Stoller's avatar Leigh B Stoller

Minor fix.

parent 83a9f7a1
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# GENIPUBLIC-COPYRIGHT # GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2010 University of Utah and the Flux Group. # Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
use strict; use strict;
...@@ -18,10 +18,11 @@ sub usage() ...@@ -18,10 +18,11 @@ sub usage()
print "Usage: addauthority [-c] [-a] [-n] <certfile> <type> [url]\n"; print "Usage: addauthority [-c] [-a] [-n] <certfile> <type> [url]\n";
exit(1); exit(1);
} }
my $optlist = "acn"; my $optlist = "acnf";
my $asch = 0; my $asch = 0;
my $asam = 0; my $asam = 0;
my $disable = 0; my $disable = 0;
my $force = 0;
# #
# Check args. # Check args.
...@@ -39,6 +40,9 @@ if (defined($options{"c"})) { ...@@ -39,6 +40,9 @@ if (defined($options{"c"})) {
if (defined($options{"a"})) { if (defined($options{"a"})) {
$asam = 1; $asam = 1;
} }
if (defined($options{"f"})) {
$force = 1;
}
usage() usage()
if (@ARGV < 2 || @ARGV > 3); if (@ARGV < 2 || @ARGV > 3);
...@@ -73,7 +77,7 @@ if (!defined($url)) { ...@@ -73,7 +77,7 @@ if (!defined($url)) {
die("Certificate does not have a URI extension"); die("Certificate does not have a URI extension");
} }
} }
if (GeniAuthority->CheckExisting($certificate)) { if (!$force && GeniAuthority->CheckExisting($certificate)) {
die("$certfile is already registered in the DB\n"); die("$certfile is already registered in the DB\n");
} }
my $authority = GeniAuthority->Create($certificate, $url, lc($type)); my $authority = GeniAuthority->Create($certificate, $url, lc($type));
......
...@@ -97,7 +97,7 @@ if ($asch) { ...@@ -97,7 +97,7 @@ if ($asch) {
system("$UPDATECERT $CHCERT") == 0 or system("$UPDATECERT $CHCERT") == 0 or
fatal("Could not update $CHCERT"); fatal("Could not update $CHCERT");
system("$ADDAUTHORITY -c $CHCERT ma") == 0 system("$ADDAUTHORITY -f -c $CHCERT ma") == 0
or fatal("Could not add CH certificate to CH DB"); or fatal("Could not add CH certificate to CH DB");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment