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 = ch_strdup( LDAP_ROOT_DSE );
36 (void) dn_normalize_case( e->e_ndn );
39 for ( i = 0; i < nbackends; i++ ) {
40 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
41 val.bv_val = backends[i].be_suffix[j];
42 val.bv_len = strlen( val.bv_val );
43 attr_merge( e, "namingContexts", vals );
47 #if defined( SLAPD_MONITOR_DN )
48 val.bv_val = SLAPD_MONITOR_DN;
49 val.bv_len = strlen( val.bv_val );
50 attr_merge( e, "namingContexts", vals );
51 /* subschemasubentry is added by send_search_entry() */
54 #if defined( SLAPD_CONFIG_DN )
55 val.bv_val = SLAPD_CONFIG_DN;
56 val.bv_len = strlen( val.bv_val );
57 attr_merge( e, "namingContexts", vals );
60 #if defined( SLAPD_SCHEMA_DN )
61 val.bv_val = SLAPD_SCHEMA_DN;
62 val.bv_len = strlen( val.bv_val );
63 attr_merge( e, "namingContexts", vals );
66 /* altServer unsupported */
68 /* supportedControl */
69 for ( i=0; supportedControls[i] != NULL; i++ ) {
70 val.bv_val = supportedControls[i];
71 val.bv_len = strlen( val.bv_val );
72 attr_merge( e, "supportedControl", vals );
75 /* supportedExtension */
76 for ( i=0; supportedExtensions[i] != NULL; i++ ) {
77 val.bv_val = supportedExtensions[i];
78 val.bv_len = strlen( val.bv_val );
79 attr_merge( e, "supportedExtension", vals );
82 /* supportedLDAPVersion */
83 for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
86 val.bv_len = strlen( val.bv_val );
87 attr_merge( e, "supportedLDAPVersion", vals );
90 /* supportedSASLMechanism */
91 if( supportedSASLMechanisms != NULL ) {
92 for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
93 val.bv_val = supportedSASLMechanisms[i];
94 val.bv_len = strlen( val.bv_val );
95 attr_merge( e, "supportedSASLMechanisms", vals );
99 if ( default_referral != NULL ) {
100 attr_merge( e, "ref", default_referral );
104 val.bv_len = sizeof("top")-1;
105 attr_merge( e, "objectClass", vals );
107 val.bv_val = "extenisbleObject";
108 val.bv_len = sizeof("extenisbleObject")-1;
109 attr_merge( e, "objectClass", vals );
111 send_search_entry( &backends[0], conn, op,
112 e, attrs, attrsonly, NULL );
113 send_search_result( conn, op, LDAP_SUCCESS,
114 NULL, NULL, NULL, NULL, 1 );