[Da-tools-commits] ./da-tools/userdir-ldap-cgi-common r93: merge changes from debian back to -common

Martin Zobel-Helas zobel at debian.org
Wed Jul 16 18:28:00 UTC 2008


------------------------------------------------------------
revno: 93
committer: Martin Zobel-Helas <zobel at debian.org>
branch nick: userdir-ldap-cgi-common
timestamp: Wed 2008-07-16 20:28:00 +0200
message:
  merge changes from debian back to -common
modified:
  Util.pm
  debian/changelog
  debian/control
  login.cgi
  machines.cgi
  search.cgi
  update.cgi
    ------------------------------------------------------------
    revno: 87.1.1
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Fri 2008-03-14 22:10:13 +0100
    message:
      Merged from alioth: Make machines.cgi display the purpose attribute from LDAP
    modified:
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.2
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Fri 2008-03-14 22:15:43 +0100
    message:
      Add a changelog entry for "Make machines.cgi display the purpose attribute from LDAP"
    modified:
      debian/changelog
    ------------------------------------------------------------
    revno: 87.1.3
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Sun 2008-05-25 18:04:55 +0200
    message:
      Add VoIP field to CGI [zobel].
    modified:
      debian/changelog
      search.cgi
      update.cgi
    ------------------------------------------------------------
    revno: 87.1.4
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Sun 2008-05-25 18:05:17 +0200
    message:
      make summaryattrs sortable [zobel]
    modified:
      debian/changelog
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.5
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Sun 2008-05-25 18:27:04 +0200
    message:
      Use SSL/TLS when configured to do so.
    modified:
      Util.pm
      debian/changelog
      debian/control
      login.cgi
      machines.cgi
      search.cgi
      update.cgi
    ------------------------------------------------------------
    revno: 87.1.6
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 15:11:08 +0200
    message:
      fix capitalisation for voip field
    modified:
      search.cgi
    ------------------------------------------------------------
    revno: 87.1.7
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 15:26:52 +0200
    message:
      Show purposes as a bullet list, support [[wikistylelinks]]
    modified:
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.8
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 15:27:17 +0200
    message:
      And a changelog for 0.3.11
    modified:
      debian/changelog
    ------------------------------------------------------------
    revno: 87.1.9
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 15:55:44 +0200
    message:
      Also support [[link|wiki links with alternate link text]].
    modified:
      debian/changelog
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.10
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 15:58:09 +0200
    message:
      Fix purposes_uplist to use passed argument instead of global variable
    modified:
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.11
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 15:59:12 +0200
    message:
      rename purpose_upload to item_uplist
    modified:
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.12
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 16:01:20 +0200
    message:
      Use wikilink format for sponsors too - requires changing ldap
    modified:
      debian/changelog
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.13
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 16:34:05 +0200
    message:
      Remove distribution from summary, add purpose and sponsor
    modified:
      machines.cgi
    ------------------------------------------------------------
    revno: 87.1.14
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 16:34:18 +0200
    message:
      And a changelog entry
    modified:
      debian/changelog
    ------------------------------------------------------------
    revno: 87.1.15
    committer: Peter Palfrader <peter at palfrader.org>
    branch nick: userdir-ldap-cgi
    timestamp: Tue 2008-07-15 21:46:23 +0200
    message:
      Hide hosts on website whose status starts with unlisted.
    modified:
      debian/changelog
      machines.cgi
-------------- next part --------------
=== modified file 'Util.pm'
--- a/Util.pm	2006-11-13 16:25:16 +0000
+++ b/Util.pm	2008-05-25 16:27:04 +0000
@@ -3,6 +3,7 @@
 
 use strict;
 use Date::Manip qw(ParseDate);
+use Net::LDAP qw(:all);
 
 my $blocksize = 8; # A blowfish block is 8 bytes
 my $configfile = "/etc/userdir-ldap/userdir-ldap.conf";
@@ -339,4 +340,17 @@
   return %config;
 }
 
+sub UpgradeConnection($) {
+  my ($ldap) = @_;
+  my $mesg = $ldap->start_tls(
+                          verify => 'require',
+                          capath => '/etc/ssl/certs/'
+                          );
+  $mesg->sync;
+  if ($mesg->code != LDAP_SUCCESS) {
+    print "Content-type: text/html; charset=utf-8\n\n";
+    print "<html><body><h1>STARTTLS failed: "..$mesg->error."</h1></body></html>\n";
+    exit(1);
+  };
+};
 1;

=== modified file 'debian/changelog'
--- a/debian/changelog	2006-12-28 01:44:02 +0000
+++ b/debian/changelog	2008-07-15 19:46:23 +0000
@@ -1,3 +1,39 @@
+userdir-ldap-cgi (0.3.14) unstable; urgency=low
+
+  * Hide hosts on website whose status starts with unlisted.
+
+ -- Peter Palfrader <weasel at debian.org>  Tue, 15 Jul 2008 21:46:07 +0200
+
+userdir-ldap-cgi (0.3.13) unstable; urgency=low
+
+  * Remove distribution from summary, add purpose and sponsor
+
+ -- Peter Palfrader <weasel at debian.org>  Tue, 15 Jul 2008 16:34:10 +0200
+
+userdir-ldap-cgi (0.3.12) unstable; urgency=low
+
+  * Also support [[link|wiki links with alternate link text]].
+  * Use wikilink format for sponsors too - requires changing ldap.
+
+ -- Peter Palfrader <weasel at debian.org>  Tue, 15 Jul 2008 16:00:50 +0200
+
+userdir-ldap-cgi (0.3.11) unstable; urgency=low
+
+  * Show purposes as a bullet list
+  * support [[wikistylelinks]] in purpose
+
+ -- Peter Palfrader <weasel at debian.org>  Tue, 15 Jul 2008 15:26:57 +0200
+
+userdir-ldap-cgi (0.3.10) unstable; urgency=low
+
+  * Make machines.cgi display the purpose attribute from LDAP [HE].
+  * Add VoIP field to CGI [zobel].
+  * make summaryattrs sortable [zobel].
+  * Use SSL/TLS when configured to do so, and Depend on libio-socket-ssl-perl
+    for that.
+
+ -- Peter Palfrader <weasel at debian.org>  Sun, 25 May 2008 18:21:45 +0200
+
 userdir-ldap-cgi (0.3.9) unstable; urgency=low
 
   * machines.cgi

=== modified file 'debian/control'
--- a/debian/control	2006-12-22 08:13:31 +0000
+++ b/debian/control	2008-05-25 16:27:04 +0000
@@ -8,7 +8,7 @@
 
 Package: userdir-ldap-cgi
 Architecture: all
-Depends: userdir-ldap, perl5, libnet-ldap-perl, libcrypt-blowfish-perl, gnupg (>= 1.0.3), libdate-manip-perl, liburi-perl
+Depends: userdir-ldap, perl5, libnet-ldap-perl, libcrypt-blowfish-perl, gnupg (>= 1.0.3), libdate-manip-perl, liburi-perl, libio-socket-ssl-perl
 Replaces: userdir-ldap
 Description: CGI programs for the db.debian.org
  These programs are run on http://db.debian.org/ to simplify the

=== modified file 'login.cgi'
--- a/login.cgi	2006-12-22 07:58:50 +0000
+++ b/login.cgi	2008-05-25 16:27:04 +0000
@@ -28,6 +28,7 @@
 my $cipher = new Crypt::Blowfish $key;
 
 my $ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!);
+&Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False';
 
 my $username = $query->param('username');
 my $password = $query->param('password');

=== modified file 'machines.cgi'
--- a/machines.cgi	2008-05-18 16:37:17 +0000
+++ b/machines.cgi	2008-07-15 19:46:23 +0000
@@ -17,7 +17,7 @@
 use MIME::Base64;
 use Digest::MD5 qw(md5_hex);
 
-my (%attrs, @attrorder, %summaryattrs, @summaryorder);
+my (%attrs, @attrorder, %summaryattrs, @summaryorder, %summarylistitems);
 
 # This defines the description of the fields, and which fields are retrieved
 %attrs = ('hostname' => 'Host name',
@@ -50,13 +50,14 @@
 
 # ditto for summary
 %summaryattrs = ('hostname' => 'Host name',
-                 'host'     => 'just for a link',
-                 'architecture' => 'Architecture',
-		 'distribution' => 'Distribution',
+		 'host'     => 'just for a link',
+		 'architecture' => 'Architecture',
 		 'status' => 'Status',
-		 'access' => 'Access');
-		 
- at summaryorder = ('hostname', 'architecture', 'distribution', 'status', 'access');		 
+		 'access' => 'Access',
+		 'sponsor' => 'Sponsor',
+		 'purpose' => 'Purpose');
+ at summaryorder = qw{hostname architecture sponsor purpose status access};
+%summarylistitems = map {$_=>1} qw{purpose sponsor};
 
 # Global settings...
 my %config = &Util::ReadConfigFile;
@@ -83,6 +84,28 @@
     return $hrfpr;
 }
 
+sub wiki_link($) {
+	my ($in) = @_;
+	$in =~ s#\[\[(.*?)\|(.*?)\]\]#<a href="http://$1">$2</a>#g;
+	$in =~ s#\[\[(.*?)\]\]#<a href="http://$1">$1</a>#g;
+	return $in;
+}
+
+sub item_uplist($) {
+	my ($items) = @_;
+	my $out = undef;
+
+	if (scalar @$items >= 1) {
+		$out = "<ul>".
+			join("", map { 
+				"<li>".wiki_link($_)."</li>\n";
+			  } sort {my $A=$a; my $B=$b; $A =~ s/[\[\]]//g; $B =~ s/[\[\]]//g; $A cmp $B} @{$items}
+			).
+			"</ul>";
+	}
+	return $out;
+}
+
 $SIG{__DIE__} = \&DieHandler;
 
 my $query = new CGI;
@@ -92,6 +115,7 @@
 
 &Util::HTMLSendHeader;
 $ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!);
+&Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False';
 $mesg;
 $ldap->bind;
 
@@ -134,34 +158,26 @@
       $output{sshrsahostfprint} .= sshfingerprint($key) . "<br>";
     }
     
-    # URL
-    my ($sponsor, $url) = undef;
-    $output{sponsor} = undef;
-    foreach $sponsor (@{$data->{sponsor}}) {
-      $sponsor =~ m#((http|ftp)://\S+)#i;
-      $url = $1;
-      $sponsor =~ s/\s*$url\s*//;
-      $output{sponsor} .= "<br>" if ($output{sponsor});
-      if ($url) {
-        $output{sponsor} .= sprintf("<a href=\"%s\">%s</a>", $url, $sponsor);
-      } else {
-        $output{sponsor} .= $sponsor;
-      }
-    }
+    my $sponsor = item_uplist($data->{sponsor});
+    $output{sponsor} = $sponsor if defined $sponsor;
+    my $purpose = item_uplist($data->{purpose});
+    $output{purpose} = $purpose if defined $purpose;
 
-	#Reformat purposes to be pleasing for the human eye:
-	$output{purpose} = join(",", @{$data->{purpose}});
-    
-    $selected = " selected ";    
+    $selected = " selected ";
   }
-  
-  $hostlist .= "<option value=\"$thishost\"$selected>$thishost\n";
-  
+
+  $hostlist .= "<option value=\"$thishost\"$selected>$thishost\n" unless ($data->{status}->[0] =~ /^unlisted/);
+
   # collect summary info
   foreach $key (keys(%summaryattrs)) {
-    $summary{$thishost}{$key} = $data->{$key}->[0];
+    if (exists $summarylistitems{$key}) {
+      my $v = item_uplist($data->{$key});
+      $summary{$thishost}{$key} = $v if defined $v;
+    } else {
+      $summary{$thishost}{$key} = $data->{$key}->[0];
+    }
   }
-  
+
   $summary{$thishost}{hostname} = undef;
   foreach my $hostname (@{$data->{hostname}}) {
     $summary{$thishost}{hostname} .= sprintf("%s<a href=\"machines.cgi?host=%s\">%s</a>", ($summary{$thishost}{hostname} ? '<br>' : ''), $summary{$thishost}{host}, $hostname);
@@ -202,6 +218,7 @@
      @sorted = sort {($summary{$b}->{$sortby} cmp $summary{$a}->{$sortby}) || ($summary{$a}->{'host'} cmp $summary{$b}->{'host'})} keys(%summary)
   }
   foreach $host (@sorted) {
+    next if $summary{$host}{status} =~ /^unlisted/;
     $hostdetails .= "<tr>";
     foreach $key (@summaryorder) {
       $hostdetails .= "<td>$summary{$host}{$key}&nbsp;</td>";

=== modified file 'search.cgi'
--- a/search.cgi	2008-05-26 19:24:38 +0000
+++ b/search.cgi	2008-07-15 13:11:08 +0000
@@ -84,6 +84,7 @@
 
   # Now, we are ready to connect to the LDAP server.
   $ldap = Net::LDAP->new($config{ldaphost}) || &Util::HTMLError($!);
+  &Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False';
   my $auth = 0;
   my $mesg;
 

=== modified file 'update.cgi'
--- a/update.cgi	2008-05-10 12:21:44 +0000
+++ b/update.cgi	2008-05-25 16:27:04 +0000
@@ -36,6 +36,7 @@
 $SIG{__DIE__} = \&DieHandler;
 
 $ldap = Net::LDAP->new($config{ldaphost});
+&Util::UpgradeConnection($ldap) unless $config{usessl} eq 'False';
 my $auth = 0;
 my $mesg;
 $mesg = $ldap->bind($editdn, password => $password);



More information about the Da-tools-commits mailing list