Commit d40b0947 authored by Leigh B Stoller's avatar Leigh B Stoller

Make sure we have a RPC context defined when looking up an Authority in

case we have to ask the clearinghouse.
parent 976312fa
......@@ -42,6 +42,7 @@ use GeniCertificate;
use GeniCredential;
use GeniAuthority;
use GeniResponse;
use Genixmlrpc;
# Configure variables
my $TB = "@prefix@";
......@@ -325,15 +326,27 @@ sub GenCredentials($$;$$)
sub GetAuthority($)
{
my ($urn) = @_;
my $context = Genixmlrpc->GetContext();
if (!defined($context)) {
my $tmp = GeniContext();
return undef
if (!defined($tmp));
Genixmlrpc->SetContext($tmp);
}
my $cm_authority = GeniAuthority->Lookup($urn);
if (!defined($cm_authority)) {
$cm_authority = GeniAuthority->CreateFromRegistry("cm", $urn);
if (!defined($cm_authority)) {
print STDERR "Could not load CM authority object\n";
Genixmlrpc->SetContext(undef)
if (!defined($context));
return undef;
}
}
Genixmlrpc->SetContext(undef)
if (!defined($context));
return $cm_authority;
}
......
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