X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap-cgi.git;a=blobdiff_plain;f=machines.cgi;h=e8670987a80fcd0c357da7aa8481fca8032cab39;hp=d67aa3ff419d2fac20c3386f3b250f93df44d89a;hb=HEAD;hpb=5489f5dc8cad654f062ff0f40b6a47b5779877ed diff --git a/machines.cgi b/machines.cgi index d67aa3f..e867098 100755 --- a/machines.cgi +++ b/machines.cgi @@ -11,7 +11,7 @@ use strict vars; #use Apache::Registry; use CGI; use Util; -use Net::LDAP qw(:all); +use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR); use Fcntl; use POSIX; use MIME::Base64; @@ -35,7 +35,6 @@ 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', # 'createtimestamp' => 'Entry created', @@ -51,12 +50,13 @@ my (%attrs, @attrorder, %summaryattrs, @summaryorder, %summarylistitems); # 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,32 +67,15 @@ sub DieHandler { $ldap->unbind if (defined($ldap)); } -# human readable fingerprint -sub sshfingerprint { - my $key = shift; - - return '' if (!$key); - - my @field = split(/ /, $key); - return '' if $field[0] ne 'ssh-dss' and $field[0] ne 'ssh-rsa'; - 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 # [[hostname]] makes a link too # if you add a * after [[ it's still the same, only not used for ssh_known_hosts in ud-generate # [[-hostname]] are not links, but get added to known_hosts. we should drop the [[- ]] tho + $in =~ s#\[\[-(.*?)\]\]#$1#g; $in =~ s#\[\[\*?(.*?)\|(.*?)\]\]#$2#g; $in =~ s#\[\[\*?(.*?)\]\]#$1#g; - $in =~ s#\[\[-(.*?)\]\]#$1#g; return $in; } @@ -106,7 +89,7 @@ sub wiki_link($) { sub item_uplist($) { my ($items) = @_; my $out = undef; - my(@tmp) = grep(!/\[\[-/, @$items); + my(@tmp) = @$items; if (scalar @tmp>= 1) { $out = "