Commit 98b0eeaf authored by Leigh B Stoller's avatar Leigh B Stoller

Add helper function to write a credential to a file.

parent c027ba74
......@@ -561,7 +561,7 @@ sub CreateFromSigned($$;$)
if (!($owner_certificate->uuid() =~ /^\w+\-\w+\-\w+\-\w+\-\w+$/)
&& $CHECK_UUID) {
$msg = "Invalid target_uuid in credential";
$msg = "Invalid owner_uuid in credential";
goto bad;
}
if (!($owner_certificate->hrn() =~ /^[-\w\.]+$/)) {
......@@ -1189,6 +1189,20 @@ sub LoadFromFile($$)
return GeniCredential->CreateFromSigned($contents);
}
#
# Write a credential to a tempfile.
#
sub WriteToFile($)
{
my ($self) = @_;
# We want this file to be passed back but deleted at script exit.
my ($tempfile, $filename) = tempfile(UNLINK => 1);
print $tempfile $self->asString();
close $tempfile;
return $filename;
}
########################################################################
# ABAC version of a credential. This a total hack job, will need to
# be flushed and redone later.
......
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