2 /* root_dse.c - Provides the ROOT DSA-Specific Entry
4 * Copyright 1999-2000 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms are permitted only
8 * as authorized by the OpenLDAP Public License. A copy of this
9 * license is available at http://www.OpenLDAP.org/license.html or
10 * in file LICENSE in the top-level directory of the distribution.
16 #include <ac/string.h>
21 root_dse_info( Entry **entry, const char **text )
26 struct berval *vals[2];
29 #ifdef SLAPD_SCHEMA_NOT_COMPAT
30 AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
31 AttributeDescription *ad_namingContexts = slap_schema.si_ad_namingContexts;
32 AttributeDescription *ad_supportedControl = slap_schema.si_ad_supportedControl;
33 AttributeDescription *ad_supportedExtension = slap_schema.si_ad_supportedExtension;
34 AttributeDescription *ad_supportedLDAPVersion = slap_schema.si_ad_supportedLDAPVersion;
35 AttributeDescription *ad_supportedSASLMechanisms = slap_schema.si_ad_supportedSASLMechanisms;
36 # ifdef SLAPD_ACI_ENABLED
37 AttributeDescription *ad_supportedACIMechanisms = slap_schema.si_ad_supportedACIMechanisms;
39 AttributeDescription *ad_ref = slap_schema.si_ad_ref;
41 char *ad_objectClass = "objectClass";
42 char *ad_namingContexts = "namingContexts";
43 char *ad_supportedControl = "supportedControl";
44 char *ad_supportedExtension = "supportedExtension";
45 char *ad_supportedLDAPVersion = "supportedLDAPVersion";
46 char *ad_supportedSASLMechanisms = "supportedSASLMechanisms";
47 # ifdef SLAPD_ACI_ENABLED
48 char *ad_supportedACIMechanisms = "supportedACIMechanisms";
56 e = (Entry *) ch_calloc( 1, sizeof(Entry) );
59 e->e_dn = ch_strdup( LDAP_ROOT_DSE );
60 e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
61 (void) dn_normalize( e->e_ndn );
65 val.bv_len = sizeof("top")-1;
66 attr_merge( e, ad_objectClass, vals );
68 val.bv_val = "OpenLDAProotDSE";
69 val.bv_len = sizeof("OpenLDAProotDSE")-1;
70 attr_merge( e, ad_objectClass, vals );
72 for ( i = 0; i < nbackends; i++ ) {
73 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
74 val.bv_val = backends[i].be_suffix[j];
75 val.bv_len = strlen( val.bv_val );
76 attr_merge( e, ad_namingContexts, vals );
80 /* altServer unsupported */
82 /* supportedControl */
83 for ( i=0; supportedControls[i] != NULL; i++ ) {
84 val.bv_val = supportedControls[i];
85 val.bv_len = strlen( val.bv_val );
86 attr_merge( e, ad_supportedControl, vals );
89 /* supportedExtension */
90 for ( i=0; (val.bv_val = get_supported_extop(i)) != NULL; i++ ) {
91 val.bv_len = strlen( val.bv_val );
92 attr_merge( e, ad_supportedExtension, vals );
95 /* supportedLDAPVersion */
96 for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
99 val.bv_len = strlen( val.bv_val );
100 attr_merge( e, ad_supportedLDAPVersion, vals );
103 /* supportedSASLMechanism */
104 if( supportedSASLMechanisms != NULL ) {
105 for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
106 val.bv_val = supportedSASLMechanisms[i];
107 val.bv_len = strlen( val.bv_val );
108 attr_merge( e, ad_supportedSASLMechanisms, vals );
112 #ifdef SLAPD_ACI_ENABLED
113 /* supportedACIMechanisms */
114 for ( i=0; (val.bv_val = get_supported_acimech(i)) != NULL; i++ ) {
115 val.bv_len = strlen( val.bv_val );
116 attr_merge( e, ad_supportedACIMechanisms, vals );
120 if ( default_referral != NULL ) {
121 attr_merge( e, ad_ref, default_referral );