1999-09-08 15:06:24 -04:00
|
|
|
/* $OpenLDAP$ */
|
1999-04-19 14:21:53 -04:00
|
|
|
/* root_dse.c - Provides the ROOT DSA-Specific Entry
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1999 The OpenLDAP Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms are permitted only
|
|
|
|
|
* as authorized by the OpenLDAP Public License. A copy of this
|
|
|
|
|
* license is available at http://www.OpenLDAP.org/license.html or
|
|
|
|
|
* in file LICENSE in the top-level directory of the distribution.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1999-08-17 17:21:43 -04:00
|
|
|
#include <ac/string.h>
|
|
|
|
|
|
1999-04-19 14:21:53 -04:00
|
|
|
#include "slap.h"
|
|
|
|
|
|
|
|
|
|
void
|
1999-04-20 08:17:14 -04:00
|
|
|
root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
1999-04-19 14:21:53 -04:00
|
|
|
{
|
1999-07-07 14:51:39 -04:00
|
|
|
char buf[BUFSIZ];
|
1999-04-19 14:21:53 -04:00
|
|
|
Entry *e;
|
|
|
|
|
struct berval val;
|
|
|
|
|
struct berval *vals[2];
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
|
|
vals[0] = &val;
|
|
|
|
|
vals[1] = NULL;
|
|
|
|
|
|
|
|
|
|
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
|
|
|
|
|
|
|
|
|
|
e->e_attrs = NULL;
|
|
|
|
|
e->e_dn = ch_strdup( LDAP_ROOT_DSE );
|
1999-07-22 13:14:42 -04:00
|
|
|
e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
|
1999-09-23 21:46:37 -04:00
|
|
|
(void) dn_normalize( e->e_ndn );
|
1999-04-19 14:21:53 -04:00
|
|
|
e->e_private = NULL;
|
|
|
|
|
|
|
|
|
|
for ( i = 0; i < nbackends; i++ ) {
|
|
|
|
|
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_val = backends[i].be_suffix[j];
|
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-04-19 14:21:53 -04:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-03 15:58:05 -04:00
|
|
|
#if defined( SLAPD_MONITOR_DN )
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_val = SLAPD_MONITOR_DN;
|
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-06-03 15:58:05 -04:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
1999-07-07 14:51:39 -04:00
|
|
|
/* subschemasubentry is added by send_search_entry() */
|
1999-06-03 15:58:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined( SLAPD_CONFIG_DN )
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_val = SLAPD_CONFIG_DN;
|
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-06-03 15:58:05 -04:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-04-19 14:21:53 -04:00
|
|
|
#if defined( SLAPD_SCHEMA_DN )
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_val = SLAPD_SCHEMA_DN;
|
1999-05-28 14:56:47 -04:00
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-06-03 15:58:05 -04:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
1999-04-19 14:21:53 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* altServer unsupported */
|
|
|
|
|
|
1999-07-01 17:20:45 -04:00
|
|
|
/* supportedControl */
|
|
|
|
|
for ( i=0; supportedControls[i] != NULL; i++ ) {
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_val = supportedControls[i];
|
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-07-01 17:20:45 -04:00
|
|
|
attr_merge( e, "supportedControl", vals );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* supportedExtension */
|
1999-11-17 13:59:41 -05:00
|
|
|
for ( i=0; (val.bv_val = get_supported_extension(i)) != NULL; i++ ) {
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-07-01 17:20:45 -04:00
|
|
|
attr_merge( e, "supportedExtension", vals );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* supportedLDAPVersion */
|
1999-04-19 14:21:53 -04:00
|
|
|
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
|
|
|
|
|
sprintf(buf,"%d",i);
|
|
|
|
|
val.bv_val = buf;
|
1999-07-07 14:51:39 -04:00
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-04-19 14:21:53 -04:00
|
|
|
attr_merge( e, "supportedLDAPVersion", vals );
|
|
|
|
|
}
|
1999-07-01 17:20:45 -04:00
|
|
|
|
|
|
|
|
/* supportedSASLMechanism */
|
1999-08-02 22:37:42 -04:00
|
|
|
if( supportedSASLMechanisms != NULL ) {
|
|
|
|
|
for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
|
|
|
|
|
val.bv_val = supportedSASLMechanisms[i];
|
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
|
|
|
|
attr_merge( e, "supportedSASLMechanisms", vals );
|
|
|
|
|
}
|
1999-07-01 17:20:45 -04:00
|
|
|
}
|
|
|
|
|
|
1999-11-22 13:44:07 -05:00
|
|
|
#ifdef SLAPD_ACI_ENABLED
|
|
|
|
|
/* supportedACIMechanisms */
|
|
|
|
|
for ( i=0; (val.bv_val = get_supported_acimech(i)) != NULL; i++ ) {
|
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
|
|
|
|
attr_merge( e, "supportedACIMechanisms", vals );
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-07-15 22:45:46 -04:00
|
|
|
if ( default_referral != NULL ) {
|
|
|
|
|
attr_merge( e, "ref", default_referral );
|
|
|
|
|
}
|
1999-07-01 17:20:45 -04:00
|
|
|
|
1999-07-23 23:39:23 -04:00
|
|
|
val.bv_val = "top";
|
|
|
|
|
val.bv_len = sizeof("top")-1;
|
|
|
|
|
attr_merge( e, "objectClass", vals );
|
|
|
|
|
|
1999-11-16 20:47:49 -05:00
|
|
|
val.bv_val = "LDAProotDSE";
|
|
|
|
|
val.bv_len = sizeof("LDAProotDSE")-1;
|
1999-08-12 14:58:51 -04:00
|
|
|
attr_merge( e, "objectClass", vals );
|
|
|
|
|
|
1999-08-16 21:54:02 -04:00
|
|
|
val.bv_val = "extensibleObject";
|
|
|
|
|
val.bv_len = sizeof("extensibleObject")-1;
|
1999-07-23 23:39:23 -04:00
|
|
|
attr_merge( e, "objectClass", vals );
|
|
|
|
|
|
1999-07-15 22:45:46 -04:00
|
|
|
send_search_entry( &backends[0], conn, op,
|
1999-07-23 23:39:23 -04:00
|
|
|
e, attrs, attrsonly, NULL );
|
1999-07-15 22:45:46 -04:00
|
|
|
send_search_result( conn, op, LDAP_SUCCESS,
|
|
|
|
|
NULL, NULL, NULL, NULL, 1 );
|
1999-04-19 14:21:53 -04:00
|
|
|
|
|
|
|
|
entry_free( e );
|
|
|
|
|
}
|
|
|
|
|
|