isCommandAvailable('server_info'))
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server information')),'error','index.php');
# The attributes we'll examine when searching the LDAP server's RootDSE
$root_dse_attributes = array(
'namingContexts',
'subschemaSubentry',
'altServer',
'supportedExtension',
'supportedControl',
'supportedSASLMechanisms',
'supportedLDAPVersion',
'currentTime',
'dsServiceName',
'defaultNamingContext',
'schemaNamingContext',
'configurationNamingContext',
'rootDomainNamingContext',
'supportedLDAPPolicies',
'highestCommittedUSN',
'dnsHostName',
'ldapServiceName',
'serverName',
'supportedCapabilities',
'changeLog',
'tlsAvailableCipherSuites',
'tlsImplementationVersion',
'supportedSASLMechanisms',
'dsaVersion',
'myAccessPoint',
'dseType',
'+',
'*'
);
# Fetch basic RootDSE attributes using the + and *.
$attrs = $ldapserver->search(null,'','objectClass=*',array('+','*'),'base');
$attrs = array_pop($attrs);
/* After fetching the "basic" attributes from the RootDSE, try fetching the
more advanced ones (from ths list). Add them to the list of attrs to display
if they weren't already fetched. (this was added as a work-around for OpenLDAP
on RHEL 3. */
$attrs2 = $ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base');
$attrs2 = array_pop($attrs2);
if (is_array($attrs2))
foreach ($attrs2 as $attr => $values)
if (! isset($attrs[$attr]))
$attrs[$attr] = $attrs2[$attr];
printf('
%s%s
',_('Server info for: '),htmlspecialchars($ldapserver->name));
printf('%s
',_('Server reports the following information about itself'));
if (count($attrs) == 0) {
echo '
';
printf('%s',_('This server has nothing to report.'));
return;
}
echo '';
foreach ($attrs as $attr => $values) {
if ($attr == 'dn')
continue;
$schema_href = sprintf('cmd.php?cmd=schema&server_id=%s&view=attributes&viewvalue=%s',$ldapserver->server_id,$attr);
echo '';
printf('%s',
$attr,$schema_href,htmlspecialchars($attr));
echo ' |
';
echo ' | ';
echo '';
if (is_array($values))
foreach ($values as $value) {
$oidtext = '';
print '';
if (preg_match('/^[0-9]+\.[0-9]+/',$value)) {
printf(' | ',
IMGDIR,htmlspecialchars($value), htmlspecialchars($value));
if ($oidtext = support_oid_to_text($value))
if (isset($oidtext['ref']))
printf('%s | ',$oidtext['ref'],$oidtext['title']);
else
printf('%s | ',$oidtext['title']);
else
if (strlen($value) > 0)
printf('%s | ',$value);
} else {
printf('%s | ',htmlspecialchars($value));
}
print ' ';
if (isset($oidtext['desc']) && trim($oidtext['desc']))
printf('%s | ',$oidtext['desc']);
}
else
printf('%s | ',htmlspecialchars($values));
echo ' ';
echo ' |
';
}
echo '
';
?>