',$counter++%2==0?'even':'odd');
printf('%s | ',$backend);
$key = sprintf($child,$index,$dn);
echo '';
- if (isset($results[$key]['seeAlso'])) {
- $seealso = is_array($results[$key]['seeAlso']) ? $results[$key]['seeAlso'] : array($results[$key]['seeAlso']);
+ if (isset($results[$key]['seealso'])) {
+ $seealso = is_array($results[$key]['seealso']) ? $results[$key]['seealso'] : array($results[$key]['seealso']);
foreach ($seealso as $db)
- if (isset($results[$db]['namingContexts']))
- printf('%s ',isset($results[$db]['labeledURI']) ? $results[$db]['labeledURI'] : _('Internal'),$results[$db]['namingContexts']);
+ if (isset($results[$db]['namingcontexts']))
+ printf('%s ',
+ isset($results[$db]['labeleduri']) ? implode(' ',$results[$db]['labeleduri']) : _('Internal'),
+ implode(' ',$results[$db]['namingcontexts']));
else
- printf('%s ',$results[$db]['monitoredInfo']);
+ printf('%s ',implode(' ',$results[$db]['monitoredinfo']));
} else {
echo ' ';
@@ -101,7 +100,7 @@ foreach (array(
else
$sc = $results[$key][$attr];
- if (strcasecmp('supportedControl',$attr) == 0)
+ if (strcasecmp('supportedcontrol',$attr) == 0)
foreach ($sc as $control) {
$oidtotext = support_oid_to_text($control);
@@ -133,44 +132,44 @@ echo '';
echo '';
printf('%s | %s | ',
- _('Total Connections'),$results['cn=Total,cn=Connections,cn=Monitor']['monitorCounter']);
+ _('Total Connections'),$results['cn=Total,cn=Connections,cn=Monitor']['monitorcounter']);
printf('%s | %s | ',
- _('Current Connections'),$results['cn=Current,cn=Connections,cn=Monitor']['monitorCounter']);
+ _('Current Connections'),$results['cn=Current,cn=Connections,cn=Monitor']['monitorcounter']);
# Look for some connections
foreach ($results as $key => $value) {
if (preg_match('/^cn=Connection.*,cn=Connections,cn=Monitor$/',$key)) {
echo '';
- printf('%s | ',$results[$key]['cn']);
+ printf('%s | ',$results[$key]['cn'][0]);
echo '';
echo '';
$counter = 0;
foreach (array(
- 'monitorConnectionActivityTime',
- 'monitorConnectionAuthzDN',
- 'monitorConnectionGet',
- 'monitorConnectionListener',
- 'monitorConnectionLocalAddress',
- 'monitorConnectionMask',
- 'monitorConnectionNumber',
- 'monitorConnectionOpsCompleted',
- 'monitorConnectionOpsExecuting',
- 'monitorConnectionOpsPending',
- 'monitorConnectionOpsReceived',
- 'monitorConnectionPeerAddress',
- 'monitorConnectionPeerDomain',
- 'monitorConnectionProtocol',
- 'monitorConnectionRead',
- 'monitorConnectionStartTime',
- 'monitorConnectionWrite'
+ 'monitorconnectionactivitytime',
+ 'monitorconnectionauthzdn',
+ 'monitorconnectionget',
+ 'monitorconnectionlistener',
+ 'monitorconnectionlocaladdress',
+ 'monitorconnectionmask',
+ 'monitorconnectionnumber',
+ 'monitorconnectionopscompleted',
+ 'monitorconnectionopsexecuting',
+ 'monitorconnectionopspending',
+ 'monitorconnectionopsreceived',
+ 'monitorconnectionpeeraddress',
+ 'monitorconnectionpeerdomain',
+ 'monitorconnectionprotocol',
+ 'monitorconnectionread',
+ 'monitorconnectionstarttime',
+ 'monitorconnectionwrite'
) as $metric) {
printf('',$counter++%2==0?'even':'odd');
printf('%s | %s | ',
- $metric,isset($results[$key][$metric]) ? $results[$key][$metric] : ' ');
+ $metric,isset($results[$key][$metric]) ? $results[$key][$metric][0] : ' ');
echo ' ';
}
@@ -196,51 +195,48 @@ foreach (array(
'cn=Waiters,cn=Monitor'
) as $dn ) {
- if (is_array($results[$dn]['description']))
- $description = implode(' ',$results[$dn]['description']);
- else
- $description = $results[$dn]['description'];
-
+ $description = implode(' ',$results[$dn]['description']);
$description = preg_replace('/"/','\'',$description);
+
printf('%s | ',$description,$dn);
echo '';
echo '';
echo '';
- if (isset($results[$dn]['monitorOpInitiated']))
+ if (isset($results[$dn]['monitoropinitiated']))
printf('%s | %s | ',
- 'monitorOpInitiated',$results[$dn]['monitorOpInitiated']);
- if (isset($results[$dn]['monitorOpCompleted']))
+ 'monitorOpInitiated',$results[$dn]['monitoropinitiated'][0]);
+ if (isset($results[$dn]['monitoropcompleted']))
printf('%s | %s | ',
- 'monitorOpCompleted',$results[$dn]['monitorOpCompleted']);
- if (isset($results[$dn]['monitoredInfo']))
+ 'monitorOpCompleted',$results[$dn]['monitoropcompleted'][0]);
+ if (isset($results[$dn]['monitoredinfo']))
printf('%s | %s | ',
- 'monitoredInfo',$results[$dn]['monitoredInfo']);
+ 'monitoredInfo',$results[$dn]['monitoredinfo'][0]);
# Look for some connecitons
foreach ($results as $key => $value) {
if (preg_match('/^.*,'.$dn.'$/',$key)) {
echo '';
- printf('%s | ',$results[$key]['cn']);
+ printf('%s | ',$results[$key]['cn'][0]);
echo '';
echo '';
foreach (array(
- 'labeledURI',
- 'monitorConnectionLocalAddress',
- 'monitoredInfo',
- 'monitorCounter',
- 'monitorOpInitiated',
- 'monitorOpCompleted',
- 'monitorTimestamp'
+ 'labeleduri',
+ 'monitorconnectionlocaladdress',
+ 'monitoredinfo',
+ 'monitorcounter',
+ 'monitoropinitiated',
+ 'monitoropcompleted',
+ 'monitortimestamp'
) as $metric) {
if (isset($results[$key][$metric])) {
printf('',$counter++%2==0?'even':'odd');
printf('%s | %s | ',
- $metric,$results[$key][$metric]);
+ $metric,$results[$key][$metric][0]);
echo ' ';
}
diff --git a/htdocs/server_info.php b/htdocs/server_info.php
index efc1ffb..064f946 100644
--- a/htdocs/server_info.php
+++ b/htdocs/server_info.php
@@ -29,11 +29,18 @@ foreach ($attrs as $key => $values) {
if ($key == 'dn')
continue;
- $href = sprintf('cmd.php?cmd=schema&server_id=%s&view=attributes&viewvalue=%s',$app['server']->getIndex(),$key);
-
echo '';
- printf('%s',
- $href,_('Click to view the schema definition for attribute type'),$key,$key);
+
+ $sattr = $app['server']->getSchemaAttribute($key);
+
+ if ($sattr) {
+ $href = sprintf('cmd.php?cmd=schema&server_id=%s&view=attributes&viewvalue=%s',$app['server']->getIndex(),$sattr->getName());
+ printf('%s',
+ $href,_('Click to view the schema definition for attribute type'),$sattr->getName(false),$sattr->getName(false));
+
+ } else
+ echo $key;
+
echo ' | ';
echo ' | ';
diff --git a/lib/Tree.php b/lib/Tree.php
index c5af3d2..de6f441 100644
--- a/lib/Tree.php
+++ b/lib/Tree.php
@@ -146,7 +146,7 @@ abstract class Tree {
$server = $this->getServer();
$dnlower = $this->indexDN($dn);
- if (! ($dn = $server->dnExists($dn)))
+ if (! ($server->dnExists($dn)))
return;
if (isset($this->entries[$dnlower]))
diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php
index 527c4c7..0c8e1c1 100644
--- a/lib/ds_ldap.php
+++ b/lib/ds_ldap.php
@@ -361,18 +361,20 @@ class ldap extends DS {
if ($debug)
debug_dump(array('query'=>$query,'server'=>$this->getIndex(),'con'=>$this->connect($method)));
+ $resource = $this->connect($method,$debug);
+
switch ($query['scope']) {
case 'base':
- $search = @ldap_read($this->connect($method,$debug),$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
+ $search = @ldap_read($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
break;
case 'one':
- $search = @ldap_list($this->connect($method,$debug),$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
+ $search = @ldap_list($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
break;
case 'sub':
default:
- $search = @ldap_search($this->connect($method,$debug),$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
+ $search = @ldap_search($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
break;
}
@@ -389,71 +391,48 @@ class ldap extends DS {
$return = array();
# Get the first entry identifier
- if ($entry_id = ldap_first_entry($this->connect($method,$debug),$search)) {
-
- if ($debug)
- debug_dump(array('entry_id'=>$entry_id));
+ if ($entries = ldap_get_entries($resource,$search)) {
+ # Remove the count
+ if (isset($entries['count']))
+ unset($entries['count']);
# Iterate over the entries
- while ($entry_id) {
+ foreach ($entries as $a => $entry) {
+ if (! isset($entry['dn']))
+ debug_dump_backtrace('No DN?',1);
- # Get the distinguished name of the entry
- $dn = ldap_get_dn($this->connect($method,$debug),$entry_id);
-
- if (DEBUG_ENABLED)
- debug_log('Got DN [%s].',64,__FILE__,__LINE__,__METHOD__,$dn);
-
- $return[$dn]['dn'] = $dn;
-
- # Get the attributes of the entry
- $attrs = ldap_get_attributes($this->connect($method,$debug),$entry_id);
-
- if (DEBUG_ENABLED)
- debug_log('Got ATTRS [%s].',64,__FILE__,__LINE__,__METHOD__,$attrs);
-
- # Get the first attribute of the entry
- if ($attr = ldap_first_attribute($this->connect($method,$debug),$entry_id,$attrs)) {
-
- if (DEBUG_ENABLED)
- debug_log('Processing ATTR [%s].',64,__FILE__,__LINE__,__METHOD__,$attr);
-
- # Iterate over the attributes
- while ($attr) {
- # It seems that OpenDS complains when you do a ldap_get_values on these attributes - we'll skip them as a workaround
- # This is probably the bug https://opends.dev.java.net/issues/show_bug.cgi?id=3446
- #@todo we probably shouldnt completely ignore the isMemberOf ?
- if (in_array($attr,array('isMemberOf'))) {
- $attr = ldap_next_attribute($this->connect($method,$debug),$entry_id,$attrs);
- continue;
- }
-
- if ($this->isAttrBinary($attr))
- $values = ldap_get_values_len($this->connect($method,$debug),$entry_id,$attr);
- else
- $values = ldap_get_values($this->connect($method,$debug),$entry_id,$attr);
-
- # Get the number of values for this attribute
- $count = $values['count'];
- unset($values['count']);
-
- if ($count == 1)
- $return[$dn][$attr] = $values[0];
- else
- $return[$dn][$attr] = $values;
-
- $attr = ldap_next_attribute($this->connect($method,$debug),$entry_id,$attrs);
- } # end while attr
+ # Remove the none entry references.
+ if (! is_array($entry)) {
+ unset($entries[$a]);
+ continue;
}
- $entry_id = ldap_next_entry($this->connect($method,$debug),$entry_id);
+ $dn = $entry['dn'];
+ unset($entry['dn']);
- } # End while entry_id
+ # Iterate over the attributes
+ foreach ($entry as $b => $attrs) {
+ # Remove the none entry references.
+ if (! is_array($attrs)) {
+ unset($entry[$b]);
+ continue;
+ }
+
+ # Remove the count
+ if (isset($entry[$b]['count']))
+ unset($entry[$b]['count']);
+ }
+
+ # Our queries always include the DN (the only value not an array).
+ $entry['dn'] = $dn;
+ $return[$dn] = $entry;
+ }
+
+ # Sort our results
+ foreach ($return as $key=> $values)
+ ksort($return[$key]);
}
- # Sort our results
- foreach ($return as $key=> $values)
- ksort($return[$key]);
-
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return);
@@ -763,9 +742,6 @@ class ldap extends DS {
$results = $this->getDNAttrValues('',$method);
if (isset($results['namingcontexts'])) {
- if (! is_array($results['namingcontexts']))
- $results['namingcontexts'] = array($results['namingcontexts']);
-
if (DEBUG_ENABLED)
debug_log('LDAP Entries:%s',80,__FILE__,__LINE__,__METHOD__,implode('|',$results['namingcontexts']));
@@ -792,8 +768,8 @@ class ldap extends DS {
$results = $this->getDNAttrValues($dn,$method);
- if (isset($results['dn'][0]))
- return $results['dn'][0];
+ if ($results)
+ return $results;
else
return false;
}
| | |
| | |
|