diff --git a/modules/ldapstatus/lib/LDAPTester.php b/modules/ldapstatus/lib/LDAPTester.php index 214b59a33ce217b89b7b3dfb8b40309ca62b0cd3..197731bea20512478211fd9647087726050ca6d7 100644 --- a/modules/ldapstatus/lib/LDAPTester.php +++ b/modules/ldapstatus/lib/LDAPTester.php @@ -43,6 +43,15 @@ class sspmod_ldapstatus_LDAPTester { } + private function checkParameter($conf, $req) { + $res = $this->checkConfig($conf, array($req)); + if ($res[0]) { + return 'Parameter [' . $req . '] found'; + } else { + return 'Parameter [' . $req . '] NOT found'; + } + } + private function log($str) { if ($this->debugOutput) { echo '<p>' . $str; @@ -85,7 +94,12 @@ class sspmod_ldapstatus_LDAPTester { $result['time'] = microtime(TRUE) - $start; 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')); + $urldef = explode(' ', $this->orgconfig['hostname']); $url = parse_url($urldef[0]); $port = 389; @@ -95,6 +109,9 @@ class sspmod_ldapstatus_LDAPTester { $this->log('ldapstatus Url parse [' . $this->orgconfig['hostname'] . '] => [' . $url['host'] . ']:[' . $port . ']' ); + + + $result['ping'] = $this->phpping($url['host'], $port); if (!$result['ping'][0]) { diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php index 2aaedd1b3f4353c9507b70651ec25e8cd2bd7e64..50cab23a1d32961769640eb2dadd9f1e3f93a988 100644 --- a/modules/ldapstatus/www/index.php +++ b/modules/ldapstatus/www/index.php @@ -11,25 +11,39 @@ if (!$session->isValid('login-admin') ) { } -function myErrorHandler($errno, $errstr, $errfile, $errline) { - - switch ($errno) { - case E_USER_ERROR: - echo('<p>PHP_ERROR : [' . $errno . '] ' . $errstr . '. Fatal error on line ' . $errline . ' in file ' . $errfile); - break; +function backtrace() { + return join(' - ', debug_backtrace()); +} - case E_USER_WARNING: - echo('<p>PHP_WARNING : [' . $errno . '] ' . $errstr . '. Warning on line ' . $errline . ' in file ' . $errfile); - break; +function myErrorHandler($errno, $errstr, $errfile, $errline) { - 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="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 */