Revision: 2065
Author: olavmrk
Date: Mon Jan  4 05:36:57 2010
Log: Removing feide-specific ldapstatus module.
http://code.google.com/p/simplesamlphp/source/detail?r=2065

Deleted:
  /trunk/modules/ldapstatus/config-templates/module_ldapstatus.php
  /trunk/modules/ldapstatus/default-disable
  /trunk/modules/ldapstatus/hooks/hook_frontpage.php
  /trunk/modules/ldapstatus/lib/Auth/Backend/Test/StandardLDAPTest.php
  /trunk/modules/ldapstatus/lib/Tester.php
  /trunk/modules/ldapstatus/templates/ldapsinglehost.php
  /trunk/modules/ldapstatus/templates/ldapstatus.php
  /trunk/modules/ldapstatus/www/hobbit.php
  /trunk/modules/ldapstatus/www/index.php

=======================================
--- /trunk/modules/ldapstatus/config-templates/module_ldapstatus.php    Mon  
Jan 19 10:18:52 2009
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/*
- * Configuration for the module ldapstatus.
- *
- * $Id$
- */
-
-$config = array (
-
-       // Ping command in Debian + Ubuntu
-       'ping' => 'ping -W 1 -c 1',
-
-       // Ping command in Mac OS X
-       //'ping' => 'ping -t 1 -c 1',
-
-);
-
-?>
=======================================
--- /trunk/modules/ldapstatus/default-disable   Mon Oct 19 04:12:47 2009
+++ /dev/null
@@ -1,3 +0,0 @@
-This file indicates that the default state of this module
-is disabled. To enable, create a file named enable in the
-same directory as this file.
=======================================
--- /trunk/modules/ldapstatus/hooks/hook_frontpage.php  Thu Aug 27 07:05:39  
2009
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * Hook to add the LDAP status module to the frontpage.
- *
- * @param array &$links  The links on the frontpage, split into sections.
- */
-function ldapstatus_hook_frontpage(&$links) {
-       assert('is_array($links)');
-       assert('array_key_exists("links", $links)');
-
-       $links['auth'][] = array(
-               'href' => SimpleSAML_Module::getModuleURL('ldapstatus/'),
-               'text' => array('en' => 'LDAP Status page', 'no' => 'LDAP  
statusoversikt'),
-       );
-
-}
-?>
=======================================
--- /trunk/modules/ldapstatus/lib/Auth/Backend/Test/StandardLDAPTest.php        
 
Wed Jul 15 04:15:54 2009
+++ /dev/null
@@ -1,320 +0,0 @@
-<?php
-
-/**
- * The standard Feide LDAP backend implementation.
- *
- * @author Andreas Åkre Solberg <[email protected]>, UNINETT AS
- * @package simpleSAMLphp
- * @version $Id$
- */
-class sspmod_ldapstatus_Auth_Backend_Test_StandardLDAPTest extends  
sspmod_feide_Auth_Backend_StandardLDAP {
-
-
-    private $orgmeta = NULL;
-       private $cli = array();
-
-    /**
-     * @param $location Must be of class Configuration..
-     */
-    public function __construct ($location, $orgmeta) {
-       parent::__construct($location);
-       $this->orgmeta = $orgmeta;
-    }
-
-
-       public function getCLI() {
-               return $this->cli;
-       }
-
-
-    /**
-     * Perform a test of the LDAP. Used by the LDAP status page.
-     */
-    public function test() {
-
-
-
-       $result = array();
-
-       $tester = new sspmod_ldapstatus_Tester($this->location);
-       $orgtester = new sspmod_ldapstatus_Tester($this->orgmeta);
-       $tester->tick('all');
-
-               $tester->log('Testing config');
-               $result['config'] =  
$tester->checkConfig(array('searchbase', 'hostname'));
-
-               $tester->log('Testing config meta');
-               $result['configMeta'] = 
$orgtester->checkConfig(array('description',  
array('contactMail', 'contactURL')));
-
-               $tester->log('Testing config testuser');
-               $result['configTest'] =  
$tester->checkConfig(array('testUser', 'testPassword'));
-
-               if (!$result['config'][0]) {
-                       $tester->log('Skipping because of no configuration');
-                       $result['time'] = $tester->tack('all', FALSE);
-                       return $result;
-               }
-
-               /*
-               $this->log($this->checkParameter($this->orgconfig, 
'adminUser'));
-               $this->log($this->checkParameter($this->orgconfig, 
'adminPassword'));
-               $this->log($this->checkParameter($this->orgconfig, 'testUser'));
-               $this->log($this->checkParameter($this->orgconfig, 
'testPassword'));
-               */
-               $hostname = $this->location->getValue('hostname');
-               $urldef = explode(' ', $hostname);
-               $url = parse_url($urldef[0]);
-               $port = 389;
-               if (!empty($url['scheme']) && $url['scheme'] === 'ldaps') $port 
= 636;
-               if (!empty($url['port'])) $port = $url['port'];
-
-               $tester->log('ldapstatus Url parse [' . $hostname . '] => [' .  
$url['host'] . ']:[' . $port . ']' );
-
-               $this->cli[] = array('Ping LDAP host', 'ping ' . $url['host']);
-               $this->cli[] = array('Traceroute LDAP host', 'traceroute ' .  
$url['host']);
-               $this->cli[] = array('TCPtraceroute connection', 'tcptraceroute 
' .  
$url['host'] . ' ' . $port);
-               $this->cli[] = array('Check certificate', 'openssl s_client 
-host ' .  
$url['host'] . ' -port ' . $port);
-
-
-               $tester->tick('ping');
-               $result['ping'] = $tester->phpping($url['host'], $port);
-               $result['ping'][1] .= $tester->tack('ping');
-               $result['ping']['time'] = $tester->tack('ping', FALSE);
-
-       #       echo('<pre>'); print_r($result); exit;
-
-               if (!$result['ping'][0]) {
-                       $result['time'] = $tester->tack('all', FALSE);
-                       $tester->log('Skipping because of no ping');
-                       return $result;
-               }
-
-
-               $result['cert'] = $this->certCheck();
-
-
-               // LDAP Connect
-               try {
-                       $tester->tick('connect');
-                       // Connect to LDAP.
-                       SimpleSAML_Logger::debug('AUTH - ldap-feide: Attempting 
location: ' .
-                               $this->location->getValue('hostname') . '/' .  
$this->location->getValue('searchbase'));
-
-                       $hostname = $this->location->getString('hostname');
-                       $enableTLS = $this->location->getBoolean('enable_tls', 
FALSE);
-                       $debugLDAP = $this->location->getBoolean('debugLDAP', 
FALSE);
-                       $timeout = $this->location->getValue('timeout', 30);
-
-                       $this->ldap = new SimpleSAML_Auth_LDAP($hostname, 
$enableTLS,  
$debugLDAP, $timeout);
-
-                       $result['connect'] = 
array(TRUE,$tester->tack('connect'));
-
-               } catch (Exception $e) {
-                       $tester->log('ldapstatus: Connect error() [' .$hostname 
. ']: ' .  
$e->getMessage());
-                       $result['connect'] = array(FALSE,$e->getMessage());
-                       $result['time'] = $tester->tack('all', FALSE);
-                       return $result;
-               }
-
-               $cliAdminBind = '';
-               // Do an admin bind before searching?
-               if ($this->location->hasValue('adminUser')) {
-                       try {
-                               $tester->tick('adminBind');
-
-                               $this->adminBind();
-                               $result['adminBind'] = 
array(TRUE,$tester->tack('connect'));
-                               $result['adminBind']['time'] = 
$tester->tack('connect', FALSE);
-
-                               $cliAdminBind = "-D '" . 
$this->location->getString('adminUser') . "'  
-W ";
-                               $this->cli[] = array('Bind as admin (and read 
user base)',
-                                       "ldapsearch -H " . $hostname . " -b '" 
.  
$this->location->getValue('searchbase') . "' " .
-                                       "-s base -V -x " .
-                                       $cliAdminBind
-                               );
-
-                       } catch (Exception $e) {
-                               $tester->log('ldapstatus: Connect error() [' . 
$hostname . ']: ' .  
$e->getMessage());
-                               $result['adminBind'] = 
array(FALSE,$e->getMessage());
-                               $result['time'] = $tester->tack('all', FALSE);
-                               return $result;
-                       }
-               } else {
-                       $this->cli[] = array('Bind as anonymous (and read user 
base)',
-                               "ldapsearch -H " . $hostname . " -b '" .  
$this->location->getValue('searchbase') . "' " .
-                               "-s base -V -x "
-                       );
-               }
-
-               try {
-                       $tester->tick('ldapSearchBogus');
-                       // Search for eduPersonPrincipalName of user.
-                       $username = '[email protected]';
-                       $userDN = $this->searchForUser($username);
-                       $result['ldapSearchBogus'] =  
array(TRUE,$tester->tack('ldapSearchBogus'));
-                       $result['ldapSearchBogus']['time'] = 
$tester->tack('ldapSearchBogus',  
FALSE);
-
-               } catch (SimpleSAML_Error_UserNotFound $e) {
-                       $result['ldapSearchBogus'] =  
array(TRUE,$tester->tack('ldapSearchBogus'));
-
-               } catch (Exception $e) {
-                       $tester->log('ldapstatus: Connect error() [' .$hostname 
. ']: ' .  
$e->getMessage());
-                       $result['ldapSearchBogus'] = 
array(FALSE,$e->getMessage());
-                       $result['time'] = $tester->tack('all', FALSE);
-
-                       return $result;
-               }
-
-
-
-
-
-               // If test user is available
-               if ($this->location->hasValue('testUser')) {
-
-                       $tester->log('Testuser found in config. Performing test 
with test  
user.');
-                       $attributes = array();
-                       // Try to search for DN of test account
-                       try {
-                               $tester->tick('ldapSearchTestUser');
-
-                               $testUser = 
$this->location->getString('testUser');
-                               $userDN = $this->searchForUser($testUser);
-                               $result['ldapSearchTestUser'] =  
array(TRUE,$tester->tack('ldapSearchTestUser'));
-                               $result['ldapSearchTestUser']['time'] =  
$tester->tack('ldapSearchTestUser', FALSE);
-
-                               $this->cli[] = array('Search for test user',
-                                       "ldapsearch -H " . $hostname . " -b '" 
.  
$this->location->getValue('searchbase') . "' " .
-                                       "-s sub -V -x " .
-                                       $cliAdminBind . " 
'(|(eduPersonPrincipalName=" .  
$this->location->getValue('testUser') . "))'"
-                               );
-
-                               $this->cli[] = array('Read test user attributes 
(user bind)',
-                                       "ldapsearch -H " . $hostname . " -b '" 
. $userDN . "' " .
-                                       "-s base -V -x " .
-                                       "-D '" . $userDN . "' -W "
-                               );
-
-                               $this->cli[] = array('Read test user attributes 
(as admin/anonymous)',
-                                       "ldapsearch -H " . $hostname . " -b '" 
. $userDN . "' " .
-                                       "-s base -V -x " .
-                                       $cliAdminBind
-                               );
-
-
-                       } catch (Exception $e) {
-                               $tester->log('LDAP Search test account:' . 
$e->getMessage());
-                               $result['ldapSearchTestUser'] = 
array(FALSE,$e->getMessage());
-                               $result['time'] = $tester->tack('all', FALSE);
-                               return $result;
-                       }
-
-                       $tester->tick('ldapBindTestUser');
-                       try {
-                               $this->userBind($testUser, $userDN,  
$this->location->getValue('testPassword'));
-                               $attributes = $this->getAttributes($userDN);
-                               if ($attributes) {
-                                       $result['ldapBindTestUser'] =  
array(TRUE,$tester->tack('ldapBindTestUser'));
-                                       $result['ldapBindTestUser']['time'] =  
$tester->tack('ldapBindTestUser', FALSE);
-                               } else {
-                                       $tester->log('LDAP Test user bind() 
failed...');
-                                       $result['ldapBindTestUser'] = 
array(FALSE,'asdsad');
-                                       $result['time'] = $tester->tack('all', 
FALSE);
-                                       return $result;
-                               }
-                       } catch(Exception $e) {
-                               $tester->log('LDAP Test user bind() failed...');
-                               $result['ldapBindTestUser'] = 
array(FALSE,'Failed to bind: ' .  
$e->getMessage() );
-                               $result['time'] = $tester->tack('all', FALSE);
-                               return $result;
-                       }
-
-
-                       try {
-                               $tester->tick('getTestOrg');
-
-                               // Get organization and organizationUnit data.
-                               $attributes = 
$this->addOrgAttributes($attributes);
-
-                               $result['getTestOrg'] = 
array(TRUE,$tester->tack('getTestOrg'));
-                               $result['getTestOrg']['time'] = 
$tester->tack('getTestOrg', FALSE);
-
-                               if 
(array_key_exists('eduPersonOrgDN:norEduOrgSchemaVersion',  
$attributes)) {
-                                       if  
(version_compare($attributes['eduPersonOrgDN:norEduOrgSchemaVersion'][0], 
'1.4', '>='))  
{
-                                               $result['schema'] = array(TRUE, 
'Version: ' .  
$attributes['eduPersonOrgDN:norEduOrgSchemaVersion'][0]);
-                                       } else {
-                                               $result['schema'] = 
array(FALSE, 'Version: ' .  
$attributes['eduPersonOrgDN:norEduOrgSchemaVersion'][0]);
-                                       }
-                               }
-
-                               $result['getTestOrg'] = 
array(TRUE,$tester->tack('getTestOrg'));
-                               $result['getTestOrg']['time'] = 
$tester->tack('getTestOrg', FALSE);
-
-                       } catch(Exception $e) {
-                               $tester->log('LDAP Test user attributes failed: 
' . $e->getMessage());
-                               $result['getTestOrg'] = 
array(FALSE,$e->getMessage());
-                       }
-               }
-               $result['time'] = $tester->tack('all', FALSE);
-               return $result;
-    }
-
-
-    private function certCheck() {
-
-               $result = array(FALSE, '');
-
-       $tester = new sspmod_ldapstatus_Tester($this->location);
-       $tester->tick('certcheck');
-
-               $hostname = $this->location->getValue('hostname');
-               $urldef = explode(' ', $hostname);
-               $url = parse_url($urldef[0]);
-               $port = 389;
-               if (!empty($url['scheme']) && $url['scheme'] === 'ldaps') $port 
= 636;
-               if (!empty($url['port'])) $port = $url['port'];
-               $host = $url['host'];
-
-               $tester->log('ldapstatus Url parse [' . $hostname . '] => [' .  
$host . ']:[' . $port . ']' );
-
-               $cmd = 'echo "" | openssl s_client -connect ' . $host . ':' . 
$port . '  
2> /dev/null | openssl x509 -enddate -noout';
-               $output = shell_exec($cmd);
-
-               if (!empty($output)) {
-
-                       $cmd2 = 'echo "" | openssl s_client -connect ' . $host 
. ':' .  
$port . ' 2> /dev/null | openssl x509 -issuer -subject -noout';
-                       $output2 = shell_exec($cmd2);
-
-                       if (preg_match('/issuer=(.{0,40})/', $output2, 
$matches) ) {
-                               $result['issuer'] = trim($matches[1]);
-                               $result[1] .= ' ' . $output2;
-
-                               if (preg_match('/subject=(.{0,40})/', $output2, 
$matches) ) {
-                                       $result['subject'] = trim($matches[1]);
-                               }
-                       } else {
-                               $result[0] = FALSE;
-                               $result[1] = 'Did not find Issuer in response 
[' . $host . ':' .  
$port . ']';
-                               return $result;
-                       }
-               } else {
-                       $result[0] = FALSE;
-                       $result[1] = 'Empty output from s_client -connect [' . 
$host . ':' .  
$port . ']';
-                       return $result;
-               }
-
-               if (preg_match('/notAfter=(.*)/', $output, $matches) ) {
-                       $rawdate = $matches[1];
-                       $date = strtotime($rawdate) - time();
-                       $days = floor($date / (60*60*24));
-       #               echo '<p>expires in ' . $days . ' days';
-
-                       $result[0] = ($days > 20);
-                       $result['expire'] = $days;
-                       $result['expireText'] = date('Y-m-d', 
strtotime($rawdate));
-                       return $result;
-               }
-    }
-
-
-}
=======================================
--- /trunk/modules/ldapstatus/lib/Tester.php    Tue Sep 15 01:30:55 2009
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/**
- * Test helper class.
- *
- * @author Andreas Åkre Solberg, UNINETT AS.
- * @package simpleSAMLphp
- * @version $Id$
- */
-class sspmod_ldapstatus_Tester {
-
-
-       private $location;
-       private $debugOutput;
-       private $times;
-
-       public function __construct($location, $debugOutput = FALSE) {
-               $this->location = $location;
-               $this->times = array();
-               $this->debugOutput = $debugOutput;
-       }
-
-       /**
-        * Start timer
-        */
-       public function tick($tag = 'default') {
-               $this->times[$tag] = microtime(TRUE);
-       }
-
-       /**
-        * Stop timer
-        */
-       public function tack($tag = 'default', $text = TRUE) {
-               if($text)
-                       return $this->getTimeText(microtime(TRUE) - 
$this->times[$tag]);
-               return (microtime(TRUE) - $this->times[$tag]);
-       }
-
-       /**
-        * Get duration as text.
-        */
-       private function getTimeText($time) {
-               return 'Operation took ' . ceil($time*1000) . ' ms';
-       }
-
-       public function checkConfig($req) {
-               $err = array();
-               foreach($req AS $r) {
-                       $rs = SimpleSAML_Utilities::arrayize($r);
-                       if (!$this->location->hasValueOneOf($rs)) {
-                               $err[] = 'one of (' . join(',', $rs) . ')';
-                       }
-               }
-               if (count($err) > 0)
-                       return array(FALSE, 'Missing: ' . join(' | ', $err));
-               return array(TRUE, '');
-       }
-
-
-       private function checkParameter($conf, $req) {
-               $res = $this->checkConfig($conf, array($req));
-               if ($res[0]) {
-                       return 'Parameter [' . $req . '] found';
-               } else {
-                       return 'Parameter [' . $req . '] NOT found';
-               }
-       }
-
-       public function log($str) {
-               if ($this->debugOutput) {
-                       echo '<p>' . $str;
-               } else {
-                       SimpleSAML_Logger::debug($str);
-               }
-               flush();
-       }
-
-
-       /**
-        * TCP ping implemented in php.
-        *
-        * @param string $host Hostname
-        * @param int $port Port number (TCP)
-        */
-       public function phpping($host, $port) {
-               assert('is_string($host)');
-               assert('is_int($port)');
-
-               $this->log('ldapstatus phpping(): ping [' . $host . ':' . $port 
. ']' );
-
-               $ips = gethostbynamel($host);
-               if ($ips === FALSE) {
-                       return array(FALSE, 'Unable to look up hostname ' . 
$host . '.');
-               }
-               if (count($ips) === 0) {
-                       return array(FALSE, 'No IP address found for host ' . 
$host . '.');
-               }
-
-               $errors = array();
-               foreach ($ips as $ip) {
-                       $timeout = 1.0;
-                       $socket = @fsockopen($ip, $port, $errno, $errstr, 
$timeout);
-                       if ($errno) {
-                               $errors[] = $errno . ':' . $errstr . ' (' . 
$host . '[' . $ip . ']:' .  
$port . ')';
-                       } elseif ($socket === FALSE) {
-                               $errors[] = '[Unknown error, check log] (' . 
$host . '[' .  
$ip . ']:' . $port . ')';
-                       } else {
-                               @fclose($socket);
-                       }
-               }
-
-               if (count($errors) === 0) {
-                       return array(TRUE, count($ips) . ' LDAP servers 
working.');
-               }
-
-               $error = count($errors) . ' of ' . count($ips) . ' failed: '.  
implode(';', $errors);
-               return array(FALSE, $error);
-       }
-
-
-
-}
=======================================
--- /trunk/modules/ldapstatus/templates/ldapsinglehost.php      Fri Jul 10  
00:35:43 2009
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-
-$this->data['header'] = 'LDAP status for ' .  
$this->getTranslation($this->data['org']['description']);
-$this->data['head'] = '<style type="text/css">
-table.statustable td {
-       border-bottom: 1px solid #eee;
-}
-.ui-tabs-panel { padding: .5em }
-div#content {
-       margin: .4em ! important;
-}
-p {
-       margin: 1em 0px 2px 0px
-}
-div.inbox p { margin: 0; }
-
-div#ldapstatus p {
-       margin: none;
-}
-div#ldapstatus .testtext p {
-       margin: 3px ! important;
-       padding: 0px ;
-}
-</style>';
-
-$this->data['head'] .= '<script type="text/javascript">
-
-$(document).ready(function() {
-       $("#tabs").tabs();
-       $("#tabdiv").tabs();
-       $("#ldapstatus").accordion({
-               header: "h3"
-       });
-});
-</script>';
-
-$this->data['jquery'] = array('version' => '1.6','core' => TRUE, 'ui' =>  
TRUE, 'css' => TRUE);
-$this->data['hideLanguageBar'] = TRUE;
-$this->includeAtTemplateBase('includes/header.php');
-
-?>
-
-
-
-
-<p style="text-align: right; margin-bottom: 1em;">[ <a href="?">return to  
list of all organizations</a> ]</p>
-
-<?php
-
-$t = $this;
-
-function presentRes($restag, $header = 'na', $descr = '') {
-
-       global $t;
-
-#      echo('<div>');
-       if (array_key_exists($restag, $t->data['res'])) {
-               $res = $t->data['res'][$restag];
-               if ($res[0]) {
-                       echo('<h3><a href="#">');
-                       echo('<img style="display: inline; border: none; 
position: relative;  
top: 3px" src="/' . $t->data['baseurlpath'] . 'resources/icons/accept.png"  
/>&nbsp;');
-                       echo($header);
-                       if (isset($res['time'])) {
-                               if ($res['time'] > 0.7) {
-                                       echo('<span style="color: #a00; 
font-weight: bold"> (' .  
number_format(1000*$res['time'], 0) . ' ms)</span> slow response');
-                               } else {
-                                       echo(' (' . 
number_format(1000*$res['time'], 0) . ' ms)');
-                               }
-                       }
-                       echo('</a></h3>');
-                       echo('<div class="testtext ok">');
-                       if (!empty($descr))
-                               echo('<p>' .  $descr . '</p>');
-                       echo('<p>OK: ' . $res[1] . '</p>');
-                       if (isset($res['expire'])) {
-                               echo('<p>Certificate expires in ' . 
$res['expire'] . ' days</p>');
-                       }
-                       if (isset($res['expireText'])) {
-                               echo('<p>Certificate expires on ' . 
$res['expireText'] . '</p>');
-                       }
-                       echo('</div>');
-               } else {
-                       echo('<h3><a href="#">');
-                       echo('<img style="display: inline; border: none; 
position: relative;  
top: 3px" src="/' . $t->data['baseurlpath'] . 'resources/icons/delete.png"  
/>&nbsp;');
-                       echo($header);
-                       echo('</a></h3>');
-                       echo('<div class="testtext failed">');
-                       if (!empty($descr))
-                               echo('<p>' .  $descr . '</p>');
-                       echo('<p>' . $res[1] . '</p>');
-                       if (isset($res['expire'])) {
-                               echo('<p>Certificate expires in ' . 
$res['expire'] . ' days</p>');
-                       }
-                       if (isset($res['expireText'])) {
-                               echo('<p>Certificate expires on ' . 
$res['expireText'] . '</p>');
-                       }
-                       echo('</div>');
-               }
-       } else {
-//             echo('<h3><a href="#">');
-//             echo('<img style="display: inline; position: relative; top: 
3px"  
src="/' . $t->data['baseurlpath'] . 'resources/icons/bullet16_grey.png"  
/>&nbsp;');
-//             echo($header);
-//             echo(' (NA)</a></h3>');
-//             echo('<div>NA</div>');
-       }
-#      echo('</div>');
-}
-
-
-$ok = TRUE;
-foreach ($this->data['res'] AS $tag => $res) {
-       if ($tag == 'time') continue;
-       if ($res[0] == 0)  $ok = FALSE;
-#      echo ('failed: ' . $tag . '[' . $res[0] . ']'); }
-}
-
-
-
-echo('<div id="tabdiv">
-       <ul class="tabset_tabs">
-               <li><a href="#ldaptests">LDAP Tests</a></li>
-               <li><a href="#debug">Debug log</a></li>');
-
-if (array_key_exists('secretURL', $this->data)) {
-       echo('<li><a href="#access">Access URL</a></li>');
-}
-
-       echo('<li><a href="#cli">Command line</a></li>');
-
-echo ('</ul>');
-
-echo '<div id="ldaptests" class="tabset_content">';
-
-
-?>
-
-
-
-
-
-<div id="ldapstatus" >
-
-<?php
-if ($ok) {
-       echo('<h3><a href="#">');
-       echo('<img style="display: inline; position: relative; border: none; 
top:  
3px" src="/' . $t->data['baseurlpath'] . 'resources/icons/accept.png"  
/>&nbsp;');
-       echo('Overall status');
-       echo('</a></h3>');
-       echo('<div>All checks was OK</div>');
-} else {
-       echo('<h3><a href="#">');
-       echo('<img style="display: inline; position: relative; border: none; 
top:  
3px" src="/' . $t->data['baseurlpath'] . 'resources/icons/delete.png"  
/>&nbsp;');
-       echo('Overall status');
-       echo('</a></h3>');
-       echo('<div>At least one test failed.</div>');
-}
-
-presentRes('config', 'Check configuration', 'Checking configuration if all  
parameters are set properly');
-presentRes('ping', 'Ping', 'Trying to setup a TCP socket against the LDAP  
host.');
-presentRes('cert', 'Check certificate');
-presentRes('adminBind', 'Admin bind()', 'Trying to bind() with the LDAP  
admin user');
-presentRes('ldapSearchBogus', 'Bogus search', 'Trying to search LDAP with  
a bogus user (should return zero results, and no error)');
-presentRes('configTest', 'Test user configured', 'Check if test-user is  
configured.');
-presentRes('ldapSearchTestUser', 'Search for test user', 'Search LDAP for  
the DN of the test user given a specific eduPersonPrincipalName');
-presentRes('ldapBindTestUser', 'Test user bind()', 'Trying to bind() as  
the DN found when searching for the test user');
-presentRes('getTestOrg', 'Get organization attributes', 'Getting  
attributes from referred eduOrgDN and eduOrgUnitDN (from test user)');
-presentRes('configMeta', 'Contact information registered', 'Checking for  
additional contact addresss in configuration.');
-presentRes('schema', 'Schema version', 'Checking if most recent version of  
the LDAP schema is used.');
-
-?>
-</div><!-- end ldap status -->
-</div><!-- end ldap test tab -->
-
-
-<?php
-
-echo '<div id="cli" class="tabset_content">';
-foreach($this->data['cli'] AS $clientry) {
-       echo('<p>' . $clientry[0] . '</p>');
-       echo('<pre>' . $clientry[1] . '</pre>');
-}
-echo '</div>';
-
-
-
-echo '<div id="debug" class="tabset_content">';
-
-#echo('<h3><a href="#">Debug log</a></h3>');
-echo('<pre >');
-echo join("\n", $this->data['debugLog']);
-echo('</pre>');
-
-echo('</div><!-- end debug tab -->');
-
-
-if (array_key_exists('secretURL', $this->data)) {
-
-       echo('<div id="access">');
-       echo('<p>This page can be accessed by this secret URL:<br />');
-#      echo('<pre  style="border: 1px solid #aaa; background: #eee; color:  
#999;c padding: .1em; margin: .2em;">');
-
-       echo('<input type="text" style="width: 95%" value="' .  
htmlentities($this->data['secretURL']) . '" />');
-#      echo('</pre>');
-       echo('</p></div>');
-
-}
-
-echo('</div><!-- end all tabs -->');
-
-
-
-$this->includeAtTemplateBase('includes/footer.php');
-
=======================================
--- /trunk/modules/ldapstatus/templates/ldapstatus.php  Wed Jul 15 04:15:54  
2009
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-$this->data['header'] = 'LDAP status page';
-$this->data['head'] = '<style>
-table.statustable td {
-       border-bottom: 1px solid #eee;
-}
-a {
-       color: #333;
-       text-decoration: none;
-       border-bottom: 1px dotted #aaa;
-}
-a:hover {
-       border-bottom: 1px solid #aaa;
-}
-div#content {
-       margin: .4em ! important;
-}
-body {
-       padding: 0px ! important;
-}
-div.corner_t {
-    max-width: none ! important;
-}
-</style>';
-$this->includeAtTemplateBase('includes/header.php');
-
-?>
-
-<h2>LDAP test</h2>
-
-<table class="attributes" style="font-size: small; width: 100%; border:  
1px solid #aaa">
-       <tr>
-               <th>Name of institusion</th>
-               <th><a href="?sort=conf">Conf</a></th>
-               <th><a href="?sort=ping">Ping</a></th>
-               <th colspan="4"><a href="?sort=cert">Cert</a></th>
-               <th><a href="?sort=adminBind">Admin</a></th>
-               <th><a href="?sort=ldapSearchBogus">S=bogus</a></th>
-               <th><a href="?sort=configTest">test</a></th>
-               <th><a href="?sort=ldapSearchTestUser">S=test</a></th>
-               <th><a href="?sort=ldapBindTestUser">T-bind()</a></th>
-               <th><a href="?sort=getTestOrg">Org-info</a></th>
-               <th><a href="?sort=configMeta">Meta</a></th>
-               <th><a href="?sort=schema">Schema</a></th>
-               <th><a href="?sort=time">Time</a></th>
-       </tr>
-
-<?php
-
-function showRes($key, $res, $template) {
-       echo('<td>');
-       if (array_key_exists($key, $res)) {
-               if ($res[$key][0]) {
-                       echo '<img src="/' .  
$template->data['baseurlpath'] . 'resources/icons/accept.png" ' .
-                               'alt="' . htmlspecialchars($res[$key][1]) .  '"
-                               title="' . htmlspecialchars($res[$key][1]) .  '"
-                               />';
-               } else {
-                       echo '<img src="/' .  
$template->data['baseurlpath'] . 'resources/icons/delete.png" ' .
-                               'alt="' . htmlspecialchars($res[$key][1]) .  '"
-                               title="' . htmlspecialchars($res[$key][1]) .  '"
-                               />';
-               }
-       } else {
-               echo('<span style="color: #b4b4b4; font-size: 
x-small">NA</span>');
-       }
-       echo('</td>');
-}
-
-
-
-
-$i = 0;
-$classes = array('odd', 'even');
-
-# $this->data['results']
-foreach($this->data['sortedOrgIndex'] as $orgkey) {
-       $ress = $this->data['results'][$orgkey];
-       foreach($ress AS $i => $res) {
-
-               echo('<tr class="' . ($classes[($i++ % 2)]) . '">');
-               if (array_key_exists('description', 
$this->data['orgconfig'][$orgkey])) {
-                       echo('<td><a href="?orgtest=' . htmlentities($orgkey) . 
'">');
-                       echo htmlspecialchars(
-                               $this->getTranslation(
-                                                
SimpleSAML_Utilities::arrayize($this->data['orgconfig'][$orgkey]['description'],
 'en')
-                                       )
-                               );
-                       if(count($ress) > 1) {
-                               echo(' (location ' . ($i) . ')');
-                       }
-                       echo('</a></td>');
-               } else {
-                       echo('<td><span style="color: #b4b4b4; font-size: 
x-small">NA</span>  
<tt>' . $orgkey . '</tt></td>');
-               }
-               showRes('config',  $res, $this);
-               showRes('ping',  $res, $this);
-
-               showRes('cert',  $res, $this);
-
-               echo('<td>' .
-                       (isset($res['cert']['expire']) ? $res['cert']['expire'] 
. '' :
-                               '<span style="color: #b4b4b4; font-size: 
x-small">NA</span>'  ).
-                       '</td>');
-
-               echo('<td>' .
-                       (isset($res['cert']['expireText']) ? 
$res['cert']['expireText'] :
-                               '<span style="color: #b4b4b4; font-size: 
x-small">NA</span>'  ).
-                       '</td>');
-
-               echo('<td>');
-               if (isset($res['cert']['issuer']) && 
isset($res['cert']['subject'])) {
-                       if ($res['cert']['subject'] === $res['cert']['issuer']) 
{
-                               echo ('<a title="' .  
htmlspecialchars($res['cert']['issuer']) . '">S</a>');
-                       } elseif (in_array($res['cert']['issuer'], array(
-                                       '/C=BE/O=Cybertrust/OU=Educational 
CA/CN',
-                                       's',
-                               ))) {
-                               echo ('<a title="' .  
htmlspecialchars($res['cert']['issuer']) . '">C</a>');
-                       } else {
-                               echo ('<a title="' .  
htmlspecialchars($res['cert']['issuer']) . '">U</a>');
-                       }
-               } else {
-                       echo('<span style="color: #b4b4b4; font-size: 
x-small">NA</span>');
-               }
-               echo('</td>');
-
-               showRes('adminBind',  $res, $this);
-               showRes('ldapSearchBogus',  $res, $this);
-               showRes('configTest',  $res, $this);
-               showRes('ldapSearchTestUser',  $res, $this);
-               showRes('ldapBindTestUser',  $res, $this);
-               showRes('getTestOrg',  $res, $this);
-               showRes('configMeta',  $res, $this);
-               showRes('schema',  $res, $this);
-
-
-               if ($res['time'] > 2.0) {
-                       echo('<td style="text-align: right; color: #700">' .  
ceil($res['time']*1000) . '&nbsp;ms</td>');
-               } else if ($res['time'] > 0.3) {
-                       echo('<td style="text-align: right">' .  
ceil($res['time']*1000) . '&nbsp;ms</td>');
-               } else {
-                       echo('<td style="text-align: right; color: #060">' .  
ceil($res['time']*1000) . '&nbsp;ms</td>');
-               }
-
-               echo('</tr>');
-
-               if ($this->data['showcomments'] && array_key_exists('comment',  
$this->data['orgconfig'][$orgkey])) {
-                       echo('<tr><td style="color: #400; padding-left: 5em; 
font-family:  
\'Arial Narrow\'; font-size: 85%" colspan="11">' .  
$this->data['orgconfig'][$orgkey]['comment'] . '</td></tr>');
-               }
-       }
-
-}
-?>
-</table>
-
-
-<?php
-
-echo('<p>Loaded ' . $this->data['completeNo'] . ' of ' .  
$this->data['completeOf'] . ' organizations</p>');
-
-$sum =  $this->data['lightCounter'][0] + $this->data['lightCounter'][1] +  
$this->data['lightCounter'][2];
-
-
-if ($sum > 0) {
-       echo('<table class="statustable" style="border: 1px solid #ccc; width:  
400px">');
-       echo('<tr><th>Type</th><th>Counter</th><th>Percentage</th></tr>');
-       echo('<tr><td><img src="/' .  
$this->data['baseurlpath'] . 'resources/icons/accept.png" /></td><td>' .  
$this->data['lightCounter'][0] . '</td><td>' .
-               number_format(100 * $this->data['lightCounter'][0] / $sum,  
1) . ' %</td></tr>');
-       echo('<tr><td><img src="/' .  
$this->data['baseurlpath'] . 'resources/icons/delete.png" /></td><td>' .  
$this->data['lightCounter'][2] . '</td><td>' .
-               number_format(100 * $this->data['lightCounter'][2] / $sum,  
1) . ' %</td></tr>');
-       echo('<tr><td><span style="color: #b4b4b4; font-size:  
x-small">NA</span></td><td>' .  
$this->data['lightCounter'][1] . '</td><td>' .
-               number_format(100 * $this->data['lightCounter'][1] / $sum,  
1) . ' %</td></tr>');
-       echo('<tr><th>Sum</th><th>' . $sum . '</th><th>100 %</th></tr>');
-       echo('</table>');
-}
-if ($this->data['completeOf'] > $this->data['completeNo']) {
-       echo('<p>[ <a href="?">load more entries</a> | <a href="?reset=1">reset 
 
all entries</a> ]');
-} else {
-       echo('<p>[ <a href="?reset=1">reset all entries</a> ]');
-}
-if (!$this->data['showcomments']) {
-       echo('<p>[ <a href="?showcomments=1">show comments</a> ]');
-}
-
-
-?>
-
-<?php $this->includeAtTemplateBase('includes/footer.php'); ?>
=======================================
--- /trunk/modules/ldapstatus/www/hobbit.php    Mon Aug 31 06:04:18 2009
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-
-$config = SimpleSAML_Configuration::getInstance();
-$session = SimpleSAML_Session::getInstance();
-
-$authTokenContactsSP = sha1('ldapstatus:hobbit|' .  
SimpleSAML_Utilities::getSecretSalt());
-
-
-if (isset($_REQUEST['getToken'])) {
-       SimpleSAML_Utilities::requireAdmin();
-       echo $authTokenContactsSP; exit;
-}
-
-
-
-
-if (!array_key_exists('token', $_REQUEST)) {
-       throw new SimpleSAML_Error_BadRequest('Missing authToken.');
-}
-
-$token = $_REQUEST['token'];
-
-if ($token !== $authTokenContactsSP) {
-       throw new SimpleSAML_Error_Exception('Invalid AuthToken');
-}
-
-
-
-
-$ldapconfig =  
SimpleSAML_Configuration::getConfig('config-login-feide.php');
-$ldapStatusConfig =  
SimpleSAML_Configuration::getConfig('module_ldapstatus.php');
-
-$debug = $ldapconfig->getValue('ldapDebug', FALSE);
-$orgs = $ldapconfig->getValue('organizations');
-$locationTemplate = $ldapconfig->getValue('locationTemplate');
-
-
-$isAdmin = FALSE;
-$secretURL = NULL;
-
-$ignore = '';
-if (array_key_exists('ignore', $_REQUEST)) $ignore = '&ignore=' .  
$_REQUEST['ignore'];
-
-
-$secretKey = sha1('ldapstatus|' .  
SimpleSAML_Utilities::getSecretSalt() . '|hobbit');
-$secretURL = SimpleSAML_Utilities::addURLparameter(
-       SimpleSAML_Utilities::selfURLNoQuery(), array(
-               'key' => $secretKey,
-       )
-);
-
-function generateSecret($salt, $orgtest) {
-       $secretKey = sha1('ldapstatus|' . $salt . '|' . $orgtest);
-       return $secretKey;
-}
-
-
-
-header('Content-Type: text/plain');
-
-foreach($orgs AS $orgkey => $org) {
-
-       $url = SimpleSAML_Utilities::addURLparameter(
-               SimpleSAML_Utilities::selfURLhost() .  
SimpleSAML_Utilities::getFirstPathElement() . '/module.php/ldapstatus/',  
array(
-                       'orgtest' => $orgkey,
-                       'output' => 'text',
-                       'key' => 
generateSecret(SimpleSAML_Utilities::getSecretSalt(), $orgkey)
-               )
-       );
-
-       echo("0.0.0.0 " . $orgkey . " # noconn  feidesjekk:" . $url .  
$ignore . ";OOOKKK\n");
-
-}
-
-
=======================================
--- /trunk/modules/ldapstatus/www/index.php     Thu Aug 27 06:45:26 2009
+++ /dev/null
@@ -1,401 +0,0 @@
-<?php
-
-
-$config = SimpleSAML_Configuration::getInstance();
-$session = SimpleSAML_Session::getInstance();
-
-$ldapconfig =  
SimpleSAML_Configuration::getConfig('config-login-feide.php');
-$ldapStatusConfig =  
SimpleSAML_Configuration::getConfig('module_ldapstatus.php');
-
-$debug = $ldapconfig->getValue('ldapDebug', FALSE);
-$orgs = $ldapconfig->getValue('organizations');
-$locationTemplate = $ldapconfig->getValue('locationTemplate');
-
-if (array_key_exists('orgtest', $_REQUEST)) {
-       $orgtest = $_REQUEST['orgtest'];
-       if (!array_key_exists($orgtest, $orgs)) {
-               throw new SimpleSAML_Error_NotFound('The organization ' .  
var_export($orgtest, TRUE) . ' could not be found.');
-       }
-       $orgConfig =  
SimpleSAML_Configuration::loadFromArray($orgs[$orgtest], 'org:[' .  
$orgtest . ']');
-
-       $secretKey = sha1('ldapstatus|' .  
SimpleSAML_Utilities::getSecretSalt() . '|' . $_REQUEST['orgtest']);
-       $secretURL = SimpleSAML_Utilities::addURLparameter(
-               SimpleSAML_Utilities::selfURLNoQuery(), array(
-                       'orgtest' => $_REQUEST['orgtest'],
-                       'key' => $secretKey,
-               )
-       );
-
-} else {
-       $orgtest = NULL;
-       $orgConfig = NULL;
-
-       $secretKey = NULL;
-       $secretURL = NULL;
-}
-
-$authsource = $ldapconfig->getString('ldapstatusAuth', NULL);
-if ($session->isValid($authsource)) {
-       $attributes = $session->getAttributes();
-} else {
-       $attributes = array();
-}
-
-$useridattr =  
$ldapconfig->getString('useridattr', 'eduPersonPrincipalName');
-if (isset($attributes[$useridattr][0])) {
-       $userId = $attributes[$useridattr][0];
-} else {
-       $userId = NULL;
-}
-
-
-$globalAllowedUsers = $ldapconfig->getArray('adminAccess', array());
-$globalAdminACL = $ldapconfig->getValue('adminACL');
-if (!is_null($globalAdminACL) && !is_string($globalAdminACL)  
&& !is_array($globalAdminACL)) {
-       throw new SimpleSAML_Error_Exception('The \'adminACL\' option must be  
either a string or an array.');
-}
-
-
-/* First check for global admin access. */
-$isAdmin = SimpleSAML_Utilities::isAdmin();
-if ($isAdmin) {
-       SimpleSAML_Logger::debug('LDAPStatus auth - logged in as admin, access  
granted');
-}
-
-/* Global admin user list. */
-if (!$isAdmin && !empty($globalAllowedUsers)) {
-       if ($authsource === NULL) {
-               throw new SimpleSAML_Error_Exception('The \'ldapstatusAuth\' 
option must  
be set if the \'adminAccess\' option is set.');
-       }
-
-       if (!$session->isValid($authsource)) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - global adminAccess: 
Not  
logged in with authsource ' . var_export($authsource, TRUE));
-       } elseif (is_null($userId)) {
-               throw new Exception('User ID is missing');
-       } else if (!in_array($userId, $globalAllowedUsers)) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - global adminAccess: 
User ' .  
var_export($userId, TRUE) . ' not in allowed user list.');
-       } else {
-               $isAdmin = TRUE;
-               SimpleSAML_Logger::debug('LDAPStatus auth - global adminAccess: 
User ' .  
var_export($userId, TRUE) . ' granted access by allowed user list.');
-       }
-} elseif (!$isAdmin) {
-       SimpleSAML_Logger::debug('LDAPStatus auth - global adminAccess: Not  
configured.');
-}
-
-/* Global admin ACL list. */
-if (!$isAdmin && !is_null($globalAdminACL)) {
-       $globalAdminACL = new sspmod_core_ACL($globalAdminACL);
-
-       if ($authsource === NULL) {
-               throw new SimpleSAML_Error_Exception('The \'ldapstatusAuth\' 
option must  
be set if the \'adminACL\' option is set.');
-       }
-
-       if (!$session->isValid($authsource)) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - global ACL: Not 
logged in  
with authsource ' . var_export($authsource, TRUE));
-       } elseif (!$globalAdminACL->allows($attributes)) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - global ACL: ACL 
does not  
grant this user global admin access.');
-       } else {
-               $isAdmin = TRUE;
-               SimpleSAML_Logger::debug('LDAPStatus auth - global ACL: Admin 
access  
granted.');
-       }
-} elseif (!$isAdmin) {
-       SimpleSAML_Logger::debug('LDAPStatus auth - global ACL: Not 
configured.');
-}
-
-
-if (!$isAdmin && !is_null($orgConfig)) {
-
-       $orgAllowedUsers = $orgConfig->getArray('adminAccess', array());
-       $orgAdminACL = $orgConfig->getValue('adminACL');
-       if (!is_null($orgAdminACL) && !is_string($orgAdminACL)  
&& !is_array($orgAdminACL)) {
-               throw new SimpleSAML_Error_Exception('The organization\'s 
\'adminACL\'  
option must be either a string or an array.');
-       }
-
-       if (array_key_exists('key', $_REQUEST) && $_REQUEST['key'] == 
$secretKey  
) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - org secretKey: 
Allowed  
access.');
-               $isAdmin = TRUE;
-       }
-
-       /* Organization admin user list. */
-       if (!$isAdmin && !empty($orgAllowedUsers)) {
-               if ($authsource === NULL) {
-                       throw new SimpleSAML_Error_Exception('The 
\'ldapstatusAuth\' option  
must be set if the \'adminAccess\' option is set.');
-               }
-
-               if (!$session->isValid($authsource)) {
-                       SimpleSAML_Logger::debug('LDAPStatus auth - org 
adminAccess: Not logged  
in with authsource ' . var_export($authsource, TRUE));
-               } elseif (is_null($userId)) {
-                       throw new Exception('User ID is missing');
-               } else if (!in_array($userId, $orgAllowedUsers)) {
-                       SimpleSAML_Logger::debug('LDAPStatus auth - org 
adminAccess: User ' .  
var_export($userId, TRUE) . ' not in allowed user list.');
-               } else {
-                       $isAdmin = TRUE;
-                       SimpleSAML_Logger::debug('LDAPStatus auth - org 
adminAccess: User ' .  
var_export($userId, TRUE) . ' granted access by allowed user list.');
-               }
-       } elseif (!$isAdmin) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - org adminAccess: 
Not  
configured.');
-       }
-
-       /* Organization admin ACL list. */
-       if (!$isAdmin && !is_null($orgAdminACL)) {
-               $orgAdminACL = new sspmod_core_ACL($orgAdminACL);
-
-               if ($authsource === NULL) {
-                       throw new SimpleSAML_Error_Exception('The 
\'ldapstatusAuth\' option  
must be set if the \'adminACL\' option is set.');
-               }
-
-               if (!$session->isValid($authsource)) {
-                       SimpleSAML_Logger::debug('LDAPStatus auth - org ACL: 
Not logged in with  
authsource ' . var_export($authsource, TRUE));
-               } elseif (!$orgAdminACL->allows($attributes)) {
-                       SimpleSAML_Logger::debug('LDAPStatus auth - org ACL: 
ACL does not grant  
this user access.');
-               } else {
-                       $isAdmin = TRUE;
-                       SimpleSAML_Logger::debug('LDAPStatus auth - org ACL: 
Admin access  
granted.');
-               }
-       } elseif (!$isAdmin) {
-               SimpleSAML_Logger::debug('LDAPStatus auth - org ACL: Not 
configured.');
-       }
-}
-
-if (!$isAdmin) {
-       if ($authsource === NULL) {
-               /* No authsource configured - attempt global admin login. */
-               SimpleSAML_Utilities::requireAdmin();
-               $isAdmin = TRUE;
-       } elseif ($session->isValid($authsource)) {
-               throw new SimpleSAML_Error_Exception('Access denied to current 
user.');
-       } else {
-               /* Attempt to authenticate with the authsource. */
-               SimpleSAML_Auth_Default::initLogin($authsource,  
SimpleSAML_Utilities::selfURL());
-       }
-}
-
-
-
-function backtrace() {
-       return join(' - ', debug_backtrace());
-}
-
-function myErrorHandler($errno, $errstr, $errfile, $errline) {
-
-
-       echo('<div style="border: 1px dotted #ccc; margin: .3em;  
padding: .4em;">');
-       switch ($errno) {
-               case E_USER_ERROR:
-                       echo('<p>PHP_ERROR   : [' . $errno . '] ' . $errstr . 
'. Fatal error on  
line ' . $errline . ' in file ' . $errfile);
-                       break;
-
-               case E_USER_WARNING:
-                       echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . 
'. Warning on  
line ' . $errline . ' in file ' . $errfile);
-                       break;
-
-               case E_USER_NOTICE:
-                       echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . 
'. Warning on  
line ' . $errline . ' in file ' . $errfile);
-                       break;
-
-               default:
-                       echo('<p>PHP_UNKNOWN : [' . $errno . '] ' . $errstr . 
'. Unknown error  
on line ' . $errline . ' in file ' . $errfile);
-                       break;
-    }
-
-#    echo('<div style="font-style:monospace; font-size: x-small; margin:  
1em; color: #966"><li>' . join('</li><li>',  
debug_backtrace()) . '</li></div>');
-    echo('<pre style="font-style:monospace; font-size: small; margin: 1em;  
color: #966">');
-    echo(debug_print_backtrace());
-    echo('</pre>');
-       echo('</div>');
-
-
-    flush();
-
-    /* Don't execute PHP internal error handler */
-    return true;
-}
-
-
-
-
-
-
-
-
-$results = $session->getData('module:ldapstatus', 'results');
-if (empty($results)) {
-       $results = array();
-} elseif (array_key_exists('reset', $_GET) && $_GET['reset'] === '1') {
-       $results = array();
-}
-
-#echo('<pre>'); print_r($results); exit;
-
-
-$start = microtime(TRUE);
-$previous = microtime(TRUE);
-
-$maxtime = $ldapStatusConfig->getValue('maxExecutionTime', 15);
-
-
-if (array_key_exists('orgtest', $_REQUEST)) {
-       #$old_error_handler = set_error_handler("myErrorHandler");
-       $cli = array();
-       $locindex = 0;
-       if (array_key_exists('locindex', $_REQUEST)) $locindex =  
$_REQUEST['locindex'];
-
-       SimpleSAML_Logger::setCaptureLog();
-
-       $orgconfig =  
SimpleSAML_Configuration::loadFromArray($orgs[$_REQUEST['orgtest']], 'org:[' .  
$_REQUEST['orgtest'] . ']');
-       $orgloc = $orgs[$_REQUEST['orgtest']]['locations'][$locindex];
-       $orgloc = mergeWithTemplate($orgloc, $locationTemplate);
-       $classname =  
SimpleSAML_Module::resolveClass($orgloc['testType'], 'Auth_Backend_Test');
-       $tester = new $classname(
-                       SimpleSAML_Configuration::loadFromArray($orgloc, 
'locat...@[' .  
$_REQUEST['orgtest'] . ']'),
-                       $orgconfig);
-
-       $res = $tester->test();
-
-       // Machine readable output
-       if(array_key_exists('output', $_REQUEST) && $_REQUEST['output']  
=== 'text') {
-
-               $ignores = array();
-               if(array_key_exists('ignore', $_REQUEST)) {
-                       $ignores = explode(',', $_REQUEST['ignore']);
-               }
-
-               $ok = TRUE;
-               foreach ($res AS $tag => $resEntry) {
-                       if (in_array($tag, $ignores)) continue;
-                       if ($tag == 'time') continue;
-                       if ($resEntry[0] == 0) {
-                               $ok = FALSE;
-                               echo("Error (" . $tag . ") : " . $resEntry[1] . 
"\n");
-                       }
-               }
-               if ($ok) echo('OOOKKK');
-               exit;
-       }
-
-
-       $t = new  
SimpleSAML_XHTML_Template($config, 'ldapstatus:ldapsinglehost.php');
-       $t->data['res'] = $res;
-       $t->data['cli'] = $tester->getCLI();
-       $t->data['org'] = $orgs[$_REQUEST['orgtest']];
-       $t->data['debugLog'] = SimpleSAML_Logger::getCapturedLog();
-       if ($isAdmin) $t->data['secretURL'] = $secretURL;
-       $t->show();
-       exit;
-}
-
-function mergeWithTemplate($location, $template) {
-       foreach($template AS $key => $value) {
-               if (!array_key_exists($key, $location)) $location[$key] = 
$value;
-       }
-       return $location;
-}
-
-$start = microtime(TRUE);
-foreach($orgs AS $orgkey => $org) {
-       if (array_key_exists($orgkey, $results)) continue;
-       $orgconfig = SimpleSAML_Configuration::loadFromArray($org, 'org:[' .  
$orgkey . ']');
-       $orglocs = $org['locations'];
-       $results[$orgkey] = array();
-       foreach($orglocs AS $orgloc) {
-               $orgloc = mergeWithTemplate($orgloc, $locationTemplate);
-               $classname =  
SimpleSAML_Module::resolveClass($orgloc['testType'], 'Auth_Backend_Test');
-               $tester = new $classname(
-                       SimpleSAML_Configuration::loadFromArray($orgloc, 
'locat...@[' .  
$orgkey . ']'),
-                       $orgconfig);
-               $results[$orgkey][] = $tester->test();
-       }
-       if ((microtime(TRUE) - $start) > $maxtime) {
-               SimpleSAML_Logger::debug('ldapstatus: Completing execution 
after maxtime  
[' .(microtime(TRUE) - $start) . ' of maxtime ' . $maxtime . ']');
-               break;
-       }
-
-}
-
-
-
-$session->setData('module:ldapstatus', 'results', $results);
-
-#echo '<pre>'; print_r($results); exit;
-
-$lightCounter = array(0,0,0);
-
-
-
-function resultCode($res, $sortby = NULL) {
-       global $lightCounter;
-       $code = '';
-       $columns =  
array('config', 'ping', 'cert', 'adminBind', 'ldapSearchBogus', 'configTest', 
'ldapSearchTestUser', 'ldapBindTestUser', 'getTestOrg', 'configMeta', 'schema');
-
-       if (!empty($sortby) && in_array($sortby, $columns)) {
-
-
-               if (array_key_exists($sortby, $res)) {
-
-                       if ($res[$sortby][0]) {
-                               $code .= '0';
-                       } else {
-                               $code .= '2';
-                       }
-
-               } else {
-                       $code .= '1';
-               }
-
-               if ($sortby == 'cert') {
-                       if (array_key_exists($sortby, $res) && 
isset($res[$sortby]['expire']))
-                               $code .= sprintf("%05s", (99999 - 
$res[$sortby]['expire']) );
-                       else
-                               $code .= '-----';
-               }
-
-               $code .= '|';
-       }
-       if ($sortby === 'time') {
-               if (array_key_exists($sortby, $res))
-                       $code .= sprintf("%05s", floor(1000*$res[$sortby]) );
-               else
-                       $code .= '-----';
-               $code .= '|';
-       }
-
-       foreach ($columns AS $c) {
-               if (array_key_exists($c, $res)) {
-                       if ($res[$c][0]) {
-                               $code .= '0';
-                               $lightCounter[0]++;
-                       } else {
-                               $code .= '2';
-                               $lightCounter[2]++;
-                       }
-
-               } else {
-                       $code .= '0';
-                       $lightCounter[1]++;
-               }
-       }
-       return $code;
-}
-
-
-$ressortable = array();
-foreach ($results AS $key => $res) {
-       $ressortable[$key] = resultCode($res[0], (isset($_REQUEST['sort']) ?  
$_REQUEST['sort'] : NULL));
-}
-arsort($ressortable);
-#echo '<pre>'; print_r($ressortable); exit;
-
-
-$t = new SimpleSAML_XHTML_Template($config, 'ldapstatus:ldapstatus.php');
-
-$t->data['showcomments'] = array_key_exists('showcomments', $_REQUEST);
-$t->data['completeNo'] = count($results);
-$t->data['completeOf'] = count($orgs);
-$t->data['results'] = $results;
-$t->data['orgconfig'] = $orgs;
-$t->data['lightCounter'] = $lightCounter;
-$t->data['sortedOrgIndex'] = array_keys($ressortable);
-$t->show();
-exit;
-
-?>

--

You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.


Reply via email to