2 /* root_dse.c - Provides the ROOT DSA-Specific Entry
4 * Copyright 1999 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( Connection *conn, Operation *op, char **attrs, int attrsonly )
26 struct berval *vals[2];
32 e = (Entry *) ch_calloc( 1, sizeof(Entry) );
35 e->e_dn = ch_strdup( LDAP_ROOT_DSE );
36 e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
37 (void) dn_normalize( e->e_ndn );
40 for ( i = 0; i < nbackends; i++ ) {
41 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
42 val.bv_val = backends[i].be_suffix[j];
43 val.bv_len = strlen( val.bv_val );
44 attr_merge( e, "namingContexts", vals );
48 /* altServer unsupported */
50 /* supportedControl */
51 for ( i=0; supportedControls[i] != NULL; i++ ) {
52 val.bv_val = supportedControls[i];
53 val.bv_len = strlen( val.bv_val );
54 attr_merge( e, "supportedControl", vals );
57 /* supportedExtension */
58 for ( i=0; (val.bv_val = get_supported_extop(i)) != NULL; i++ ) {
59 val.bv_len = strlen( val.bv_val );
60 attr_merge( e, "supportedExtension", vals );
63 /* supportedLDAPVersion */
64 for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
67 val.bv_len = strlen( val.bv_val );
68 attr_merge( e, "supportedLDAPVersion", vals );
71 /* supportedSASLMechanism */
72 if( supportedSASLMechanisms != NULL ) {
73 for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
74 val.bv_val = supportedSASLMechanisms[i];
75 val.bv_len = strlen( val.bv_val );
76 attr_merge( e, "supportedSASLMechanisms", vals );
80 #ifdef SLAPD_ACI_ENABLED
81 /* supportedACIMechanisms */
82 for ( i=0; (val.bv_val = get_supported_acimech(i)) != NULL; i++ ) {
83 val.bv_len = strlen( val.bv_val );
84 attr_merge( e, "supportedACIMechanisms", vals );
88 if ( default_referral != NULL ) {
89 attr_merge( e, "ref", default_referral );
93 val.bv_len = sizeof("top")-1;
94 attr_merge( e, "objectClass", vals );
96 val.bv_val = "LDAProotDSE";
97 val.bv_len = sizeof("LDAProotDSE")-1;
98 attr_merge( e, "objectClass", vals );
100 send_search_entry( &backends[0], conn, op,
101 e, attrs, attrsonly, NULL );
102 send_search_result( conn, op, LDAP_SUCCESS,
103 NULL, NULL, NULL, NULL, 1 );