X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=machines.cgi;h=81b9c8415dc79729cacf5770735d29944b9b0977;hb=refs%2Fheads%2Ffordsa;hp=98567ec9f137afa55ea5c010b59ecae67e98308b;hpb=b1f218fa7ea8dda76284fa0260c4be66e1701922;p=mirror%2Fuserdir-ldap-cgi.git diff --git a/machines.cgi b/machines.cgi index 98567ec..81b9c84 100755 --- a/machines.cgi +++ b/machines.cgi @@ -27,7 +27,7 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder, %summarylistitems); 'access' => 'Access', 'sponsor' => 'Sponsor', 'sponsor-admin' => 'Sponsor admin', - 'location' => 'Location', + 'l' => 'Location', 'machine' => 'Processor', 'memory' => 'Memory', 'disk' => 'Disk space', @@ -35,28 +35,28 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder, %summarylistitems); 'status' => 'Status', 'notes' => 'Notes', 'sshrsahostkey' => 'SSH host key', - 'sshrsahostfprint' => 'SSH host fingerprint', 'description' => 'Description', - 'purpose' => 'purposes of this server', + 'purpose' => 'Purposes of this server', # 'createtimestamp' => 'Entry created', # 'modifytimestamp' => 'Entry modified' ); # This defines what fields are displayed, and in what order @attrorder = qw(hostname admin architecture distribution access - sponsor sponsor-admin location machine memory + sponsor sponsor-admin l machine memory disk bandwidth status notes sshrsahostkey sshrsahostfprint description purpose); # ditto for summary %summaryattrs = ('hostname' => 'Host name', 'host' => 'just for a link', + 'description' => 'Description', 'architecture' => 'Architecture', 'status' => 'Status', 'access' => 'Access', 'sponsor' => 'Sponsor', 'purpose' => 'Purpose'); -@summaryorder = qw{hostname architecture sponsor purpose status access}; +@summaryorder = qw{hostname description architecture sponsor purpose status access}; %summarylistitems = map {$_=>1} qw{purpose sponsor}; # Global settings... @@ -67,24 +67,6 @@ sub DieHandler { $ldap->unbind if (defined($ldap)); } -# human readable fingerprint -sub sshfingerprint { - my $key = shift; - - return '' if (!$key); - - my @field = split(/ /, $key); - my %keytypes = map {$_=>1} (qw{ssh-dss ssh-rsa ecdsa-sha2-nistp256}); - return '' unless $keytypes{$field[0]}; - return '' if !$field[1]; - my $fpr = md5_hex(decode_base64($field[1])); - my $hrfpr = $field[0] . " " . substr($fpr,0,2,""); - while (length $fpr > 0) { - $hrfpr .= ':' . substr($fpr,0,2,""); - } - return $hrfpr; -} - sub wiki_link($) { my ($in) = @_; # [[hostname|text]] makes a link @@ -113,7 +95,7 @@ sub item_uplist($) { $out = ""; } @@ -162,17 +144,14 @@ foreach $dn (sort {$entries->{$a}->{host}->[0] cmp $entries->{$b}->{host}->[0]} # Format email addresses $output{admin} = sprintf("%s", $output{admin}, $output{admin}); - $output{'sponsor-admin'} = sprintf("%s", $output{'sponsor-admin'}, $output{'sponsor-admin'}); + $output{'sponsor-admin'} = sprintf("%s", $output{'sponsor-admin'}, $output{'sponsor-admin'}) + if defined $output{'sponsor-admin'}; $output{sshrsahostkey} = undef; foreach $key (@{$data->{sshrsahostkey}}) { $output{sshrsahostkey} .= $key . "
"; } - foreach $key (@{$data->{sshrsahostkey}}) { - $output{sshrsahostfprint} .= sshfingerprint($key) . "
"; - } - my $sponsor = item_uplist($data->{sponsor}); $output{sponsor} = $sponsor if defined $sponsor; my $purpose = item_uplist($data->{purpose}); @@ -205,14 +184,14 @@ if ($output{havehostdata}) { $hostdetails .= "\n"; } else { # display summary info $hostdetails = "

Summary

\n"; - $hostdetails .= "\n\n"; + $hostdetails .= "
\n\n"; foreach $key (@summaryorder) { if ($sortby ne $key) { $hostdetails .= "";
$summaryattrs{$key}