From 9e7a955ba4d460f403cb7557b081a9cbfeb736ef Mon Sep 17 00:00:00 2001
From: tausq <>
Date: Thu, 30 Sep 1999 03:38:06 +0000
Subject: [PATCH] host information web-based information scripts added
---
web/hostinfo.html | 73 ++++++++++++++++++++++++
web/hostinfo.wml | 20 +++++++
web/machines.cgi | 142 ++++++++++++++++++++++++++++++++++++++++++++++
web/settings.cfg | 17 +++---
4 files changed, 245 insertions(+), 7 deletions(-)
create mode 100644 web/hostinfo.html
create mode 100644 web/hostinfo.wml
create mode 100755 web/machines.cgi
diff --git a/web/hostinfo.html b/web/hostinfo.html
new file mode 100644
index 0000000..eea037b
--- /dev/null
+++ b/web/hostinfo.html
@@ -0,0 +1,73 @@
+
+
+
+Debian GNU/Linux -- debian.org Developer Machines
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+debian.org Developer Machines
+
+
+
+Lookup:
+
+ |
+
+
+~hostdetails~
+
+ |
+
+
+Back to the Debian Project homepage.
+
+See the Debian contact page for information on contacting us.
+
+
+
+
+
+
+
+
+
+
+
+Last Modified: Thu, Sep 30 05:36:01 UTC 1999
+Copyright © 1997-1999 SPI; See license terms
+
+
+
+
diff --git a/web/hostinfo.wml b/web/hostinfo.wml
new file mode 100644
index 0000000..d9e7f25
--- /dev/null
+++ b/web/hostinfo.wml
@@ -0,0 +1,20 @@
+#use wml::debian::template title="debian.org Developer Machines"
+
+
+
+
+Lookup:
+
+ |
+
+
+~hostdetails~
+
+ |
+
diff --git a/web/machines.cgi b/web/machines.cgi
new file mode 100755
index 0000000..193eeca
--- /dev/null
+++ b/web/machines.cgi
@@ -0,0 +1,142 @@
+#!/usr/bin/perl
+
+# (c) 1999 Randolph Chung. Licensed under the GPL.
+
+use lib '.';
+use strict vars;
+#use Apache::Registry;
+use CGI;
+use Util;
+use Net::LDAP qw(:all);
+
+my (%attrs, @attrorder, %summaryattrs, @summaryorder);
+
+# This defines the description of the fields, and which fields are retrieved
+%attrs = ('hostname' => 'Host name',
+ 'admin' => 'Admin contact',
+ 'architecture' => 'Architecture',
+ 'distribution' => 'Distribution',
+ 'access' => 'Access',
+ 'sponsor' => 'Sponsor',
+ 'sponsorurl' => 'Sponsor URL',
+ 'sponsor-admin' => 'Sponsor admin',
+ 'location' => 'Location',
+ 'machine' => 'Processor',
+ 'memory' => 'Memory',
+ 'disk' => 'Disk space',
+ 'bandwidth' => 'Bandwidth',
+ 'notes' => 'Notes',
+ 'createtimestamp' => 'Entry created',
+ 'modifytimestamp' => 'Entry modified'
+ );
+
+# This defines what fields are displayed, and in what order
+@attrorder = ('hostname', 'admin', 'architecture', 'distribution', 'access',
+ 'sponsor', 'sponsor-admin', 'location', 'machine', 'memory',
+ 'disk', 'bandwidth', 'notes', 'createtimestamp', 'modifytimestamp');
+
+# ditto for summary
+%summaryattrs = ('hostname' => 'Host name',
+ 'host' => 'just for a link',
+ 'architecture' => 'Architecture',
+ 'access' => 'Access');
+
+@summaryorder = ('hostname', 'architecture', 'access');
+
+# Global settings...
+my %config = &Util::ReadConfigFile;
+
+my ($ldap, $mesg, $dn, $entries, $data, %output, $key, $hostlist, $hostdetails, $selected, %summary);
+sub DieHandler {
+ $ldap->unbind if (defined($ldap));
+}
+
+$SIG{__DIE__} = \&DieHandler;
+
+my $query = new CGI;
+my $host = lc($query->param('host'));
+
+&Util::HTMLSendHeader;
+$ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!);
+$mesg;
+$ldap->bind;
+
+$mesg = $ldap->search(base => $config{hostbasedn}, filter => 'host=*');
+$mesg->code && &Util::HTMLError($mesg->error);
+$entries = $mesg->as_struct;
+
+foreach $dn (sort {$entries->{$a}->{host}->[0] <=> $entries->{$b}->{host}->[0]} keys(%$entries)) {
+ $data = $entries->{$dn};
+
+ my $thishost = $data->{host}->[0];
+ $selected = "";
+
+ if (lc($thishost) eq $host) {
+ $output{havehostdata} = 1;
+
+ foreach $key (keys(%attrs)) {
+ $output{$key} = $data->{$key}->[0];
+ }
+
+ # Modified/created time. TODO: maybe add is the name of the creator/modifier
+ $output{modifytimestamp} = &Util::FormatTimestamp($output{modifytimestamp});
+ $output{createtimestamp} = &Util::FormatTimestamp($output{createtimestamp});
+
+ # Format email addresses
+ $output{admin} = sprintf("%s", $output{admin}, $output{admin});
+ $output{'sponsor-admin'} = sprintf("%s", $output{'sponsor-admin'}, $output{'sponsor-admin'});
+
+ # URL
+ $output{sponsor} = sprintf("%s", $output{sponsorurl}, $output{sponsor});
+
+ $selected = " selected ";
+ }
+
+ $hostlist .= "