mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Fix to print public key nicely https://github.com/webmin/webmin/issues/1086 https://github.com/webmin/webmin/pull/1289
This commit is contained in:
@@ -3600,7 +3600,8 @@ foreach my $f (readdir(ZONEDIR)) {
|
||||
$rv->{'public'} = $pub->{'values'}->[3];
|
||||
$rv->{'values'} = $pub->{'values'};
|
||||
$rv->{'publictext'} = &read_file_contents("$dir/$f");
|
||||
while($rv->{'publictext'} =~ s/^;.*\r?\n//) { }
|
||||
while($rv->{'publictext'} =~ s/^;.*\r?\n//) { };
|
||||
$rv->{'publictext'} = format_dnssec_public_key($rv->{'publictext'});
|
||||
}
|
||||
elsif ($f =~ /^K\Q$dom\E\.\+(\d+)\+(\d+)\.private$/) {
|
||||
# Found the private key file
|
||||
@@ -4279,5 +4280,16 @@ my $view = $zone->{'view'};
|
||||
return $view ? &text('master_inview', $desc, $view) : $desc;
|
||||
}
|
||||
|
||||
# format_dnssec_public_key(pubkey)
|
||||
# Format public dnssec public key, each on new line
|
||||
sub format_dnssec_public_key
|
||||
{
|
||||
my ($pubkey) = @_;
|
||||
my @krvalues = split(/\s+/, $pubkey);
|
||||
my @kvalues = @krvalues[0..5];
|
||||
my $kvspace = " " x length("@kvalues");
|
||||
return join(" ", @kvalues) . " " . join("\n$kvspace ", splice(@krvalues, 6));
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -38,8 +38,9 @@ if (@keyrecs) {
|
||||
my $kt = $key->{'ksk'} ? 'ksk' : 'zone';
|
||||
my ($keyrec) = grep { $_->{'values'}->[0] ==
|
||||
($key->{'ksk'} ? 257 : 256) } @keyrecs;
|
||||
my $keyline = join(" ", $keyrec->{'name'}, $keyrec->{'class'},
|
||||
$keyrec->{'type'}, @{$keyrec->{'values'}});
|
||||
my $keyline = format_dnssec_public_key(
|
||||
join(" ", $keyrec->{'name'}, $keyrec->{'class'},
|
||||
$keyrec->{'type'}, @{$keyrec->{'values'}}));
|
||||
print &ui_hidden_start($text{'zonekey_expand'.$kt},
|
||||
$kt, 0, "edit_zonekey.cgi?$in");
|
||||
print $text{'zonekey_public'},"<br>\n";
|
||||
|
||||
Reference in New Issue
Block a user