2009-06-30 08:12:47 +00:00
|
|
|
<?php
|
2009-06-30 08:13:22 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/server_info.php,v 1.11 2004/05/06 04:01:40 uugdave Exp $
|
2009-06-30 08:12:47 +00:00
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* server_info.php
|
|
|
|
* Fetches and displays all information that it can from the specified server
|
|
|
|
*
|
|
|
|
* Variables that come in as GET vars:
|
|
|
|
* - server_id
|
|
|
|
*/
|
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
require 'common.php';
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
// 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',
|
2009-06-30 08:12:47 +00:00
|
|
|
'tlsAvailableCipherSuites',
|
|
|
|
'tlsImplementationVersion',
|
|
|
|
'supportedSASLMechanisms',
|
|
|
|
'dsaVersion',
|
|
|
|
'myAccessPoint',
|
|
|
|
'dseType',
|
|
|
|
'+',
|
|
|
|
'*'
|
|
|
|
);
|
2009-06-30 08:09:20 +00:00
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
$server_id = $_GET['server_id'];
|
|
|
|
$server_name = $servers[$server_id]['name'];
|
2009-06-30 08:09:20 +00:00
|
|
|
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
2009-06-30 08:12:47 +00:00
|
|
|
|
|
|
|
// Fetch basic RootDSE attributes using the + and *.
|
2009-06-30 08:13:22 +00:00
|
|
|
$r = @ldap_read( $ds, '', 'objectClass=*', array( '+', '*' ) );
|
2009-06-30 08:05:37 +00:00
|
|
|
if( ! $r )
|
2009-06-30 08:12:47 +00:00
|
|
|
pla_error( $lang['could_not_fetch_server_info'], ldap_error( $ds ), ldap_errno( $ds ) );
|
2009-06-30 08:13:22 +00:00
|
|
|
$entry = @ldap_first_entry( $ds, $r );
|
|
|
|
if( ! $entry )
|
|
|
|
pla_error( $lang['could_not_fetch_server_info'], ldap_error( $ds ), ldap_errno( $ds ) );
|
|
|
|
$attrs = @ldap_get_attributes( $ds, $entry );
|
|
|
|
$count = @ldap_count_entries( $ds, $r );
|
2009-06-30 08:12:47 +00:00
|
|
|
|
|
|
|
// 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.
|
2009-06-30 08:13:22 +00:00
|
|
|
$r2 = @ldap_read( $ds, '', 'objectClass=*', $root_dse_attributes );
|
2009-06-30 08:12:47 +00:00
|
|
|
if( $r2 ) {
|
2009-06-30 08:13:22 +00:00
|
|
|
$entry2 = @ldap_first_entry( $ds, $r );
|
|
|
|
$attrs2 = @ldap_get_attributes( $ds, $entry );
|
2009-06-30 08:12:47 +00:00
|
|
|
for( $i=0; $i<$attrs2['count']; $i++ ) {
|
|
|
|
$attr = $attrs2[$i];
|
|
|
|
if( ! isset( $attrs[ $attr ] ) ) {
|
|
|
|
$attrs[ $attr ] = $attrs2[ $attr ];
|
|
|
|
$attrs[ 'count' ]++;
|
|
|
|
$attrs[] = $attr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unset( $attrs2, $entry, $entry2 );
|
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
include 'header.php';
|
|
|
|
?>
|
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
<h3 class="title"><?php echo $lang['server_info_for'] . htmlspecialchars( $server_name ); ?></h3>
|
|
|
|
<h3 class="subtitle"><?php echo $lang['server_reports_following']; ?></h3>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
<?php if( $count == 0 || $attrs['count'] == 0 ) { ?>
|
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
<br /><br /><center><?php echo $lang['nothing_to_report']; ?></center>
|
2009-06-30 08:05:37 +00:00
|
|
|
<?php exit; ?>
|
|
|
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
<table class="edit_dn">
|
|
|
|
<?php
|
|
|
|
for( $i=0; $i<$attrs['count']; $i++ ) {
|
|
|
|
$attr = $attrs[$i];
|
2009-06-30 08:12:47 +00:00
|
|
|
$schema_href = "schema.php?server_id=$server_id&view=attributes&viewvalue=$attr";
|
2009-06-30 08:09:20 +00:00
|
|
|
?>
|
|
|
|
|
2009-06-30 08:12:47 +00:00
|
|
|
<tr>
|
2009-06-30 08:09:20 +00:00
|
|
|
<td class="attr">
|
|
|
|
<b>
|
|
|
|
<a title="<?php echo sprintf( $lang['attr_name_tooltip'], $attr ); ?>"
|
|
|
|
href="<?php echo $schema_href; ?>"><?php echo htmlspecialchars( $attr ); ?>
|
|
|
|
</b>
|
|
|
|
</td>
|
2009-06-30 08:12:47 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2009-06-30 08:09:20 +00:00
|
|
|
<td class="val">
|
|
|
|
<?php for( $j=0; $j<$attrs[ $attr ][ 'count' ]; $j++ )
|
|
|
|
echo htmlspecialchars( $attrs[ $attr ][ $j ] ) . "<br />\n"; ?>
|
|
|
|
</td>
|
2009-06-30 08:12:47 +00:00
|
|
|
</tr>
|
2009-06-30 08:09:20 +00:00
|
|
|
|
2009-06-30 08:12:47 +00:00
|
|
|
<?php } ?>
|
2009-06-30 08:09:20 +00:00
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
</table>
|