1 /* root_dse.c - Provides the ROOT DSA-Specific Entry
3 * Copyright 1999 The OpenLDAP Foundation.
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
16 #include "ldap_defaults.h"
20 root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
25 struct berval *vals[2];
31 e = (Entry *) ch_calloc( 1, sizeof(Entry) );
34 e->e_dn = ch_strdup( LDAP_ROOT_DSE );
35 e->e_ndn = dn_normalize_case( ch_strdup( LDAP_ROOT_DSE ));
38 for ( i = 0; i < nbackends; i++ ) {
39 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
40 strcpy( buf, backends[i].be_suffix[j] );
42 val.bv_len = strlen( buf );
43 attr_merge( e, "namingContexts", vals );
47 #if defined( SLAPD_MONITOR_DN )
48 strcpy( buf, SLAPD_MONITOR_DN );
50 val.bv_len = strlen( buf );
51 attr_merge( e, "namingContexts", vals );
54 #if defined( SLAPD_CONFIG_DN )
55 strcpy( buf, SLAPD_CONFIG_DN );
57 val.bv_len = strlen( buf );
58 attr_merge( e, "namingContexts", vals );
61 #if defined( SLAPD_SCHEMA_DN )
62 strcpy( buf, SLAPD_SCHEMA_DN );
64 val.bv_len = strlen( val.bv_val );
65 attr_merge( e, "namingContexts", vals );
66 attr_merge( e, "subschemaSubentry", vals );
67 ldap_memfree( val.bv_val );
70 /* altServer unsupported */
72 /* supportedControl */
73 for ( i=0; supportedControls[i] != NULL; i++ ) {
74 strcpy( buf, supportedControls[i] );
76 val.bv_len = strlen( buf );
77 attr_merge( e, "supportedControl", vals );
80 /* supportedExtension */
81 for ( i=0; supportedExtensions[i] != NULL; i++ ) {
82 strcpy( buf, supportedExtensions[i] );
84 val.bv_len = strlen( buf );
85 attr_merge( e, "supportedExtension", vals );
88 /* supportedLDAPVersion */
89 for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
92 val.bv_len = strlen( buf );
93 attr_merge( e, "supportedLDAPVersion", vals );
96 /* supportedSASLMechanism */
97 for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
98 strcpy( buf, supportedSASLMechanisms[i] );
100 val.bv_len = strlen( buf );
101 attr_merge( e, "supportedSASLMechanism", vals );
105 send_search_entry( &backends[0], conn, op, e, attrs, attrsonly );
106 send_ldap_search_result( conn, op, LDAP_SUCCESS, NULL, NULL, 1 );