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 <ac/string.h>
18 #include "ldap_defaults.h"
22 root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
27 struct berval *vals[2];
33 e = (Entry *) ch_calloc( 1, sizeof(Entry) );
36 e->e_dn = ch_strdup( LDAP_ROOT_DSE );
37 e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
38 (void) dn_normalize_case( e->e_ndn );
41 for ( i = 0; i < nbackends; i++ ) {
42 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
43 val.bv_val = backends[i].be_suffix[j];
44 val.bv_len = strlen( val.bv_val );
45 attr_merge( e, "namingContexts", vals );
49 #if defined( SLAPD_MONITOR_DN )
50 val.bv_val = SLAPD_MONITOR_DN;
51 val.bv_len = strlen( val.bv_val );
52 attr_merge( e, "namingContexts", vals );
53 /* subschemasubentry is added by send_search_entry() */
56 #if defined( SLAPD_CONFIG_DN )
57 val.bv_val = SLAPD_CONFIG_DN;
58 val.bv_len = strlen( val.bv_val );
59 attr_merge( e, "namingContexts", vals );
62 #if defined( SLAPD_SCHEMA_DN )
63 val.bv_val = SLAPD_SCHEMA_DN;
64 val.bv_len = strlen( val.bv_val );
65 attr_merge( e, "namingContexts", vals );
68 /* altServer unsupported */
70 /* supportedControl */
71 for ( i=0; supportedControls[i] != NULL; i++ ) {
72 val.bv_val = supportedControls[i];
73 val.bv_len = strlen( val.bv_val );
74 attr_merge( e, "supportedControl", vals );
77 /* supportedExtension */
78 for ( i=0; supportedExtensions[i] != NULL; i++ ) {
79 val.bv_val = supportedExtensions[i];
80 val.bv_len = strlen( val.bv_val );
81 attr_merge( e, "supportedExtension", vals );
84 /* supportedLDAPVersion */
85 for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
88 val.bv_len = strlen( val.bv_val );
89 attr_merge( e, "supportedLDAPVersion", vals );
92 /* supportedSASLMechanism */
93 if( supportedSASLMechanisms != NULL ) {
94 for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
95 val.bv_val = supportedSASLMechanisms[i];
96 val.bv_len = strlen( val.bv_val );
97 attr_merge( e, "supportedSASLMechanisms", vals );
101 if ( default_referral != NULL ) {
102 attr_merge( e, "ref", default_referral );
106 val.bv_len = sizeof("top")-1;
107 attr_merge( e, "objectClass", vals );
109 val.bv_val = "LDAPsubentry";
110 val.bv_len = sizeof("LDAPsubentry")-1;
111 attr_merge( e, "objectClass", vals );
113 val.bv_val = "extensibleObject";
114 val.bv_len = sizeof("extensibleObject")-1;
115 attr_merge( e, "objectClass", vals );
117 send_search_entry( &backends[0], conn, op,
118 e, attrs, attrsonly, NULL );
119 send_search_result( conn, op, LDAP_SUCCESS,
120 NULL, NULL, NULL, NULL, 1 );