]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/configinfo.c
Preliminary Make rules to allow building backends as modules.
[openldap] / servers / slapd / configinfo.c
index 744d611ad80c5c57eebe378f542459699bd97999..565a606647e6a7fa7fe1929bd8383b0c2e9cb666 100644 (file)
 #include <ac/string.h>
 #include <ac/socket.h>
 
+#include "ldap_defaults.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 )
+config_info(
+       Connection *conn,
+       Operation *op,
+       char **attrs,
+       int attrsonly )
 {
        Entry           *e;
        char            buf[BUFSIZ];
@@ -43,11 +43,26 @@ 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_case( e->e_ndn );
+       e->e_private = NULL;
+
+       {
+               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,15 +75,18 @@ 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 );
-       }
+       val.bv_val = "top";
+       val.bv_len = sizeof("top")-1;
+       attr_merge( e, "objectClass", vals );
+
+       val.bv_val = "extenisbleObject";
+       val.bv_len = sizeof("extenisbleObject")-1;
+       attr_merge( e, "objectClass", vals );
 
-       send_search_entry( &backends[0], conn, op, e, NULL, 0 );
-       send_ldap_search_result( conn, op, LDAP_SUCCESS, NULL, NULL, 1 );
+       send_search_entry( &backends[0], conn, op, e,
+               attrs, attrsonly, NULL );
+       send_search_result( conn, op, LDAP_SUCCESS,
+               NULL, NULL, NULL, NULL, 1 );
 
        entry_free( e );
 }