1999-04-20 02:21:53 +08: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-18 05:21:43 +08:00
|
|
|
#include <ac/string.h>
|
|
|
|
|
1999-06-17 11:54:25 +08:00
|
|
|
#include "ldap_defaults.h"
|
1999-04-20 02:21:53 +08:00
|
|
|
#include "slap.h"
|
|
|
|
|
|
|
|
void
|
1999-04-20 20:17:14 +08:00
|
|
|
root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
1999-04-20 02:21:53 +08:00
|
|
|
{
|
1999-07-08 02:51:39 +08:00
|
|
|
char buf[BUFSIZ];
|
1999-04-20 02:21:53 +08: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-23 01:14:42 +08:00
|
|
|
e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
|
|
|
|
(void) dn_normalize_case( e->e_ndn );
|
1999-04-20 02:21:53 +08:00
|
|
|
e->e_private = NULL;
|
|
|
|
|
|
|
|
for ( i = 0; i < nbackends; i++ ) {
|
|
|
|
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_val = backends[i].be_suffix[j];
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-04-20 02:21:53 +08:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-04 03:58:05 +08:00
|
|
|
#if defined( SLAPD_MONITOR_DN )
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_val = SLAPD_MONITOR_DN;
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-06-04 03:58:05 +08:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
1999-07-08 02:51:39 +08:00
|
|
|
/* subschemasubentry is added by send_search_entry() */
|
1999-06-04 03:58:05 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined( SLAPD_CONFIG_DN )
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_val = SLAPD_CONFIG_DN;
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-06-04 03:58:05 +08:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
|
|
|
#endif
|
|
|
|
|
1999-04-20 02:21:53 +08:00
|
|
|
#if defined( SLAPD_SCHEMA_DN )
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_val = SLAPD_SCHEMA_DN;
|
1999-05-29 02:56:47 +08:00
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-06-04 03:58:05 +08:00
|
|
|
attr_merge( e, "namingContexts", vals );
|
1999-04-20 02:21:53 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* altServer unsupported */
|
|
|
|
|
1999-07-02 05:20:45 +08:00
|
|
|
/* supportedControl */
|
|
|
|
for ( i=0; supportedControls[i] != NULL; i++ ) {
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_val = supportedControls[i];
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-07-02 05:20:45 +08:00
|
|
|
attr_merge( e, "supportedControl", vals );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* supportedExtension */
|
|
|
|
for ( i=0; supportedExtensions[i] != NULL; i++ ) {
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_val = supportedExtensions[i];
|
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-07-02 05:20:45 +08:00
|
|
|
attr_merge( e, "supportedExtension", vals );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* supportedLDAPVersion */
|
1999-04-20 02:21:53 +08:00
|
|
|
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
|
|
|
|
sprintf(buf,"%d",i);
|
|
|
|
val.bv_val = buf;
|
1999-07-08 02:51:39 +08:00
|
|
|
val.bv_len = strlen( val.bv_val );
|
1999-04-20 02:21:53 +08:00
|
|
|
attr_merge( e, "supportedLDAPVersion", vals );
|
|
|
|
}
|
1999-07-02 05:20:45 +08:00
|
|
|
|
|
|
|
/* supportedSASLMechanism */
|
1999-08-03 10:37:42 +08: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-02 05:20:45 +08:00
|
|
|
}
|
|
|
|
|
1999-07-16 10:45:46 +08:00
|
|
|
if ( default_referral != NULL ) {
|
|
|
|
attr_merge( e, "ref", default_referral );
|
|
|
|
}
|
1999-07-02 05:20:45 +08:00
|
|
|
|
1999-07-24 11:39:23 +08:00
|
|
|
val.bv_val = "top";
|
|
|
|
val.bv_len = sizeof("top")-1;
|
|
|
|
attr_merge( e, "objectClass", vals );
|
|
|
|
|
1999-08-13 02:58:51 +08:00
|
|
|
val.bv_val = "LDAPsubentry";
|
|
|
|
val.bv_len = sizeof("LDAPsubentry")-1;
|
|
|
|
attr_merge( e, "objectClass", vals );
|
|
|
|
|
1999-08-17 09:54:02 +08:00
|
|
|
val.bv_val = "extensibleObject";
|
|
|
|
val.bv_len = sizeof("extensibleObject")-1;
|
1999-07-24 11:39:23 +08:00
|
|
|
attr_merge( e, "objectClass", vals );
|
|
|
|
|
1999-07-16 10:45:46 +08:00
|
|
|
send_search_entry( &backends[0], conn, op,
|
1999-07-24 11:39:23 +08:00
|
|
|
e, attrs, attrsonly, NULL );
|
1999-07-16 10:45:46 +08:00
|
|
|
send_search_result( conn, op, LDAP_SUCCESS,
|
|
|
|
NULL, NULL, NULL, NULL, 1 );
|
1999-04-20 02:21:53 +08:00
|
|
|
|
|
|
|
entry_free( e );
|
|
|
|
}
|
|
|
|
|