Diff for /servers/slapd/root_dse.c between versions 1.47 and 1.55

version 1.47, 2001/12/19 21:41:00 version 1.55, 2002/01/04 20:17:47
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/servers/slapd/root_dse.c,v 1.46 2001/12/10 11:09:41 hyc Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/root_dse.c,v 1.54 2002/01/03 07:02:17 kurt Exp $ */
 /* root_dse.c - Provides the ROOT DSA-Specific Entry  /* root_dse.c - Provides the ROOT DSA-Specific Entry
  *   *
  * Copyright 1999-2000 The OpenLDAP Foundation.   * Copyright 1999-2002 The OpenLDAP Foundation.
  * All rights reserved.   * All rights reserved.
  *   *
  * Redistribution and use in source and binary forms are permitted only   * Redistribution and use in source and binary forms are permitted only
Line 19 Line 19
 #include <ldif.h>  #include <ldif.h>
   
 static char *supportedFeatures[] = {  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.1", /* all Operational Attributes ("+") */
         "1.3.6.1.4.1.4203.1.5.2", /* OCs in Attributes List */          "1.3.6.1.4.1.4203.1.5.2", /* OCs in Attributes List */
           "1.3.6.1.4.1.4203.1.5.3", /* (&) and (|) search filters */
         NULL          NULL
 };  };
   
Line 34  root_dse_info( Line 35  root_dse_info(
 {  {
         char buf[BUFSIZ];          char buf[BUFSIZ];
         Entry           *e;          Entry           *e;
         struct berval   val;          struct berval   vals[2];
         struct berval   *vals[2];  
         int             i, j;          int             i, j;
         char ** supportedSASLMechanisms;          char ** supportedSASLMechanisms;
   
Line 60  root_dse_info( Line 60  root_dse_info(
   
         Attribute *a;          Attribute *a;
   
         vals[0] = &val;          vals[1].bv_val = NULL;
         vals[1] = NULL;  
   
         e = (Entry *) ch_calloc( 1, sizeof(Entry) );          e = (Entry *) ch_calloc( 1, sizeof(Entry) );
   
         e->e_attrs = NULL;          e->e_attrs = NULL;
         e->e_dn = ch_strdup( LDAP_ROOT_DSE );          e->e_name.bv_val = ch_strdup( LDAP_ROOT_DSE );
         e->e_ndn = ch_strdup( LDAP_ROOT_DSE );          e->e_name.bv_len = sizeof( LDAP_ROOT_DSE )-1;
         (void) dn_normalize( e->e_ndn );          e->e_nname.bv_val = ch_strdup( LDAP_ROOT_DSE );
           e->e_nname.bv_len = sizeof( LDAP_ROOT_DSE )-1;
   
           /* the DN is an empty string so no pretty/normalization is needed */
           assert( !e->e_name.bv_len );
           assert( !e->e_nname.bv_len );
   
         e->e_private = NULL;          e->e_private = NULL;
   
         val.bv_val = "OpenLDAProotDSE";          vals[0].bv_val = "OpenLDAProotDSE";
         val.bv_len = sizeof("OpenLDAProotDSE")-1;          vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
         attr_merge( e, ad_structuralObjectClass, vals );          attr_merge( e, ad_structuralObjectClass, vals );
   
         val.bv_val = "top";          vals[0].bv_val = "top";
         val.bv_len = sizeof("top")-1;          vals[0].bv_len = sizeof("top")-1;
         attr_merge( e, ad_objectClass, vals );          attr_merge( e, ad_objectClass, vals );
   
         val.bv_val = "OpenLDAProotDSE";          vals[0].bv_val = "OpenLDAProotDSE";
         val.bv_len = sizeof("OpenLDAProotDSE")-1;          vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
         attr_merge( e, ad_objectClass, vals );          attr_merge( e, ad_objectClass, vals );
   
         for ( i = 0; i < nbackends; i++ ) {          for ( i = 0; i < nbackends; i++ ) {
                 if ( backends[i].be_glueflags & SLAP_GLUE_SUBORDINATE )                  if ( backends[i].be_glueflags & SLAP_GLUE_SUBORDINATE )
                         continue;                          continue;
                 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {                  for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
                         val.bv_val = backends[i].be_suffix[j];                          vals[0] = *backends[i].be_suffix[j];
                         val.bv_len = strlen( val.bv_val );  
                         attr_merge( e, ad_namingContexts, vals );                          attr_merge( e, ad_namingContexts, vals );
                 }                  }
         }          }
Line 97  root_dse_info( Line 101  root_dse_info(
   
         /* supportedControl */          /* supportedControl */
         for ( i=0; supportedControls[i] != NULL; i++ ) {          for ( i=0; supportedControls[i] != NULL; i++ ) {
                 val.bv_val = supportedControls[i];                  vals[0].bv_val = supportedControls[i];
                 val.bv_len = strlen( val.bv_val );                  vals[0].bv_len = strlen( vals[0].bv_val );
                 attr_merge( e, ad_supportedControl, vals );                  attr_merge( e, ad_supportedControl, vals );
         }          }
   
         /* supportedExtension */          /* supportedExtension */
         for ( i=0; (val.bv_val = get_supported_extop(i)) != NULL; i++ ) {          for ( i=0; (vals[0].bv_val = get_supported_extop(i)) != NULL; i++ ) {
                 val.bv_len = strlen( val.bv_val );                  vals[0].bv_len = strlen( vals[0].bv_val );
                 attr_merge( e, ad_supportedExtension, vals );                  attr_merge( e, ad_supportedExtension, vals );
         }          }
   
         /* supportedFeatures */          /* supportedFeatures */
         for ( i=0; supportedFeatures[i] != NULL; i++ ) {          for ( i=0; supportedFeatures[i] != NULL; i++ ) {
                 val.bv_val = supportedFeatures[i];                  vals[0].bv_val = supportedFeatures[i];
                 val.bv_len = strlen( val.bv_val );                  vals[0].bv_len = strlen( vals[0].bv_val );
                 attr_merge( e, ad_supportedFeatures, vals );                  attr_merge( e, ad_supportedFeatures, vals );
         }          }
   
         /* supportedLDAPVersion */          /* supportedLDAPVersion */
         for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {          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 ) )                          ( i < LDAP_VERSION3 ) )
                 {                  {
                         /* version 2 and lower are disallowed */                          /* version 2 and lower are disallowed */
                         continue;                          continue;
                 }                  }
                 sprintf(buf,"%d",i);                  sprintf(buf,"%d",i);
                 val.bv_val = buf;                  vals[0].bv_val = buf;
                 val.bv_len = strlen( val.bv_val );                  vals[0].bv_len = strlen( vals[0].bv_val );
                 attr_merge( e, ad_supportedLDAPVersion, vals );                  attr_merge( e, ad_supportedLDAPVersion, vals );
         }          }
   
Line 134  root_dse_info( Line 138  root_dse_info(
   
         if( supportedSASLMechanisms != NULL ) {          if( supportedSASLMechanisms != NULL ) {
                 for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {                  for ( i=0; supportedSASLMechanisms[i] != NULL; i++ ) {
                         val.bv_val = supportedSASLMechanisms[i];                          vals[0].bv_val = supportedSASLMechanisms[i];
                         val.bv_len = strlen( val.bv_val );                          vals[0].bv_len = strlen( vals[0].bv_val );
                         attr_merge( e, ad_supportedSASLMechanisms, vals );                          attr_merge( e, ad_supportedSASLMechanisms, vals );
                 }                  }
                 charray_free( supportedSASLMechanisms );                  charray_free( supportedSASLMechanisms );
Line 192  int read_root_dse_file( const char *fnam Line 196  int read_root_dse_file( const char *fnam
                         return EXIT_FAILURE;                          return EXIT_FAILURE;
                 }                  }
   
                 if( dn_normalize( e->e_ndn ) == NULL ) {                  /* make sure the DN is the empty DN */
                         fprintf( stderr, "root_dse: invalid dn=\"%s\" (line=%d)\n",                  if( e->e_nname.bv_len ) {
                                 e->e_dn, lineno );  
                         entry_free( e );  
                         entry_free( usr_attr );  
                         usr_attr = NULL;  
                         return EXIT_FAILURE;  
                 }  
   
                 /* make sure the DN is a valid rootdse(rootdse is a null string) */  
                 if( strcmp(e->e_ndn, "") != 0 ) {  
                         fprintf( stderr,                          fprintf( stderr,
                                 "root_dse: invalid rootDSE - dn=\"%s\" (line=%d)\n",                                  "root_dse: invalid rootDSE - dn=\"%s\" (line=%d)\n",
                                 e->e_dn, lineno );                                  e->e_dn, lineno );
Line 227  int read_root_dse_file( const char *fnam Line 222  int read_root_dse_file( const char *fnam
   
         ch_free( buf );          ch_free( buf );
   
         Debug(LDAP_DEBUG_CONFIG,"rootDSE file %s read.\n", fname, 0, 0);          Debug(LDAP_DEBUG_CONFIG, "rootDSE file %s read.\n", fname, 0, 0);
         return rc;          return rc;
 }  }

Removed from v.1.47  
changed lines
  Added in v.1.55


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org