--- servers/slapd/root_dse.c 2001/10/23 21:29:41 1.41 +++ servers/slapd/root_dse.c 2001/12/26 15:24:18 1.50 @@ -1,4 +1,4 @@ -/* $OpenLDAP: pkg/ldap/servers/slapd/root_dse.c,v 1.40 2001/09/09 02:01:07 kurt Exp $ */ +/* $OpenLDAP: pkg/ldap/servers/slapd/root_dse.c,v 1.49 2001/12/25 18:48:26 kurt Exp $ */ /* root_dse.c - Provides the ROOT DSA-Specific Entry * * Copyright 1999-2000 The OpenLDAP Foundation. @@ -16,9 +16,11 @@ #include #include "slap.h" +#include static char *supportedFeatures[] = { "1.3.6.1.4.1.4203.1.5.1", /* All Operational Attributes ("+") */ + "1.3.6.1.4.1.4203.1.5.2", /* OCs in Attributes List */ NULL }; @@ -37,14 +39,24 @@ root_dse_info( int i, j; char ** supportedSASLMechanisms; - AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass; - AttributeDescription *ad_namingContexts = slap_schema.si_ad_namingContexts; - AttributeDescription *ad_supportedControl = slap_schema.si_ad_supportedControl; - AttributeDescription *ad_supportedExtension = slap_schema.si_ad_supportedExtension; - AttributeDescription *ad_supportedLDAPVersion = slap_schema.si_ad_supportedLDAPVersion; - AttributeDescription *ad_supportedSASLMechanisms = slap_schema.si_ad_supportedSASLMechanisms; - AttributeDescription *ad_supportedFeatures = slap_schema.si_ad_supportedFeatures; - AttributeDescription *ad_ref = slap_schema.si_ad_ref; + AttributeDescription *ad_structuralObjectClass + = slap_schema.si_ad_structuralObjectClass; + AttributeDescription *ad_objectClass + = slap_schema.si_ad_objectClass; + AttributeDescription *ad_namingContexts + = slap_schema.si_ad_namingContexts; + AttributeDescription *ad_supportedControl + = slap_schema.si_ad_supportedControl; + AttributeDescription *ad_supportedExtension + = slap_schema.si_ad_supportedExtension; + AttributeDescription *ad_supportedLDAPVersion + = slap_schema.si_ad_supportedLDAPVersion; + AttributeDescription *ad_supportedSASLMechanisms + = slap_schema.si_ad_supportedSASLMechanisms; + AttributeDescription *ad_supportedFeatures + = slap_schema.si_ad_supportedFeatures; + AttributeDescription *ad_ref + = slap_schema.si_ad_ref; Attribute *a; @@ -56,9 +68,13 @@ root_dse_info( e->e_attrs = NULL; e->e_dn = ch_strdup( LDAP_ROOT_DSE ); e->e_ndn = ch_strdup( LDAP_ROOT_DSE ); - (void) dn_normalize( e->e_ndn ); + /* the DN is an empty string so no normalization needed */ e->e_private = NULL; + val.bv_val = "OpenLDAProotDSE"; + val.bv_len = sizeof("OpenLDAProotDSE")-1; + attr_merge( e, ad_structuralObjectClass, vals ); + val.bv_val = "top"; val.bv_len = sizeof("top")-1; attr_merge( e, ad_objectClass, vals ); @@ -68,9 +84,10 @@ root_dse_info( attr_merge( e, ad_objectClass, vals ); for ( i = 0; i < nbackends; i++ ) { + if ( backends[i].be_glueflags & SLAP_GLUE_SUBORDINATE ) + continue; for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) { - val.bv_val = backends[i].be_suffix[j]; - val.bv_len = strlen( val.bv_val ); + val = *backends[i].be_suffix[j]; attr_merge( e, ad_namingContexts, vals ); } } @@ -99,7 +116,7 @@ root_dse_info( /* supportedLDAPVersion */ for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) { - if (( global_disallows & SLAP_DISALLOW_BIND_V2 ) && + if (!( global_allows & SLAP_ALLOW_BIND_V2 ) && ( i < LDAP_VERSION3 ) ) { /* version 2 and lower are disallowed */ @@ -120,6 +137,7 @@ root_dse_info( val.bv_len = strlen( val.bv_val ); attr_merge( e, ad_supportedSASLMechanisms, vals ); } + charray_free( supportedSASLMechanisms ); } if ( default_referral != NULL ) { @@ -145,7 +163,6 @@ root_dse_info( int read_root_dse_file( const char *fname ) { FILE *fp; - char *line, *savefname, *saveline; int rc = 0, lineno = 0, lmax = 0; char *buf = NULL; @@ -163,7 +180,6 @@ int read_root_dse_file( const char *fnam usr_attr->e_attrs = NULL; while( ldif_read_record( fp, &lineno, &buf, &lmax ) ) { - ID id; Entry *e = str2entry( buf ); if( e == NULL ) { @@ -172,15 +188,6 @@ int read_root_dse_file( const char *fnam entry_free( e ); entry_free( usr_attr ); usr_attr = NULL; - return EXIT_FAILURE; - } - - if( dn_normalize( e->e_ndn ) == NULL ) { - fprintf( stderr, "root_dse: invalid dn=\"%s\" (line=%d)\n", - e->e_dn, lineno ); - entry_free( e ); - entry_free( usr_attr ); - usr_attr = NULL; return EXIT_FAILURE; }