]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/configinfo.c
Clean up
[openldap] / servers / slapd / configinfo.c
index 744d611ad80c5c57eebe378f542459699bd97999..51874a539f4ce5d3b28a3c33d0828cfec43b36c7 100644 (file)
@@ -1,3 +1,8 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 /*
  * Copyright (c) 1995 Regents of the University of Michigan.
  * All rights reserved.
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldapconfig.h"
 
 #if defined( SLAPD_CONFIG_DN )
 
-extern int             nbackends;
-extern Backend         *backends;
-extern char            *default_referral;
-
 /*
  * no mutex protection in here - take our chances!
  */
 
-void
-config_info( Connection *conn, Operation *op )
+int
+config_info(
+       Entry **entry, const char **text )
 {
        Entry           *e;
        char            buf[BUFSIZ];
@@ -43,11 +44,38 @@ config_info( Connection *conn, Operation *op )
        vals[1] = NULL;
 
        e = (Entry *) ch_calloc( 1, sizeof(Entry) );
-       /* initialize reader/writer lock */
-       entry_rdwr_init(e);
 
        e->e_attrs = NULL;
-       e->e_dn = strdup( SLAPD_CONFIG_DN );
+       e->e_dn = ch_strdup( SLAPD_CONFIG_DN );
+       e->e_ndn = ch_strdup( SLAPD_CONFIG_DN );
+       (void) dn_normalize( e->e_ndn );
+       e->e_private = NULL;
+
+       val.bv_val = "top";
+       val.bv_len = sizeof("top")-1;
+       attr_merge( e, "objectClass", vals );
+
+       val.bv_val = "LDAPsubentry";
+       val.bv_len = sizeof("LDAPsubentry")-1;
+       attr_merge( e, "objectClass", vals );
+
+       val.bv_val = "extensibleObject";
+       val.bv_len = sizeof("extensibleObject")-1;
+       attr_merge( e, "objectClass", vals );
+
+       {
+               char *rdn = ch_strdup( SLAPD_CONFIG_DN );
+               val.bv_val = strchr( rdn, '=' );
+
+               if( val.bv_val != NULL ) {
+                       *val.bv_val = '\0';
+                       val.bv_len = strlen( ++val.bv_val );
+
+                       attr_merge( e, rdn, vals );
+               }
+
+               free( rdn );
+       }
 
        for ( i = 0; i < nbackends; i++ ) {
                strcpy( buf, backends[i].be_type );
@@ -60,17 +88,8 @@ config_info( Connection *conn, Operation *op )
                attr_merge( e, "database", vals );
        }
 
-       if ( default_referral != NULL ) {
-               strcpy( buf, default_referral );
-               val.bv_val = buf;
-               val.bv_len = strlen( buf );
-               attr_merge( e, "database", vals );
-       }
-
-       send_search_entry( &backends[0], conn, op, e, NULL, 0 );
-       send_ldap_search_result( conn, op, LDAP_SUCCESS, NULL, NULL, 1 );
-
-       entry_free( e );
+       *entry = e;
+       return LDAP_SUCCESS;
 }
 
 #endif /* slapd_config_dn */