]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/root_dse.c
Fix access_allowed() error checking bug
[openldap] / servers / slapd / root_dse.c
index 6225622ab148638f612ab366c079f93332cee7a8..86777acfaed502efc10f7f5c0f8de6033c158880 100644 (file)
  */
 
 #include "portable.h"
+#include "slapi_common.h"
 
 #include <stdio.h>
 #include <ac/string.h>
 
 #include "slap.h"
+#include "slapi.h"
 #include <ldif.h>
 #include "lber_pvt.h"
+#include "slapi/slapi_utils.h"
+
+struct berval *ns_get_supported_extop (int);
 
 static struct berval supportedFeatures[] = {
        BER_BVC(LDAP_FEATURE_ALL_OPERATIONAL_ATTRS), /* all Operational Attributes ("+") */
@@ -64,7 +69,18 @@ root_dse_info(
 
        vals[1].bv_val = NULL;
 
-       e = (Entry *) ch_calloc( 1, sizeof(Entry) );
+       e = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
+
+       if( e == NULL ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG( OPERATION, ERR,
+                       "root_dse_info: SLAP_CALLOC failed", 0, 0, 0 );
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "root_dse_info: SLAP_CALLOC failed", 0, 0, 0 );
+#endif
+               return LDAP_OTHER;
+       }
 
        e->e_attrs = NULL;
        e->e_name.bv_val = ch_strdup( LDAP_ROOT_DSE );
@@ -123,6 +139,14 @@ root_dse_info(
                        return LDAP_OTHER;
        }
 
+#if defined( LDAP_SLAPI )
+       /* netscape supportedExtension */
+       for ( i = 0; (bv = ns_get_supported_extop(i)) != NULL; i++ ) {
+               vals[0] = *bv;
+               attr_merge( e, ad_supportedExtension, vals );
+       }
+#endif /* defined( LDAP_SLAPI ) */
+
        /* supportedFeatures */
        if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
                return LDAP_OTHER;
@@ -193,7 +217,17 @@ int read_root_dse_file( const char *fname )
                return EXIT_FAILURE;
        }
 
-       usr_attr = (Entry *) ch_calloc( 1, sizeof(Entry) );
+       usr_attr = (Entry *) SLAP_CALLOC( 1, sizeof(Entry) );
+       if( usr_attr == NULL ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG( OPERATION, ERR,
+                       "read_root_dse_file: SLAP_CALLOC failed", 0, 0, 0 );
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "read_root_dse_file: SLAP_CALLOC failed", 0, 0, 0 );
+#endif
+               return LDAP_OTHER;
+       }
        usr_attr->e_attrs = NULL;
 
        while( ldif_read_record( fp, &lineno, &buf, &lmax ) ) {
@@ -203,7 +237,6 @@ int read_root_dse_file( const char *fname )
                if( e == NULL ) {
                        fprintf( stderr, "root_dse: could not parse entry (line=%d)\n",
                                lineno );
-                       entry_free( e );
                        entry_free( usr_attr );
                        usr_attr = NULL;
                        return EXIT_FAILURE;