X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Fconfiginfo.c;h=51874a539f4ce5d3b28a3c33d0828cfec43b36c7;hb=b09727567d047cb79c8da8545cca9c8355822185;hp=744d611ad80c5c57eebe378f542459699bd97999;hpb=2a869f5a99f537b246ba8640502e2a86117cb6e8;p=openldap diff --git a/servers/slapd/configinfo.c b/servers/slapd/configinfo.c index 744d611ad8..51874a539f 100644 --- a/servers/slapd/configinfo.c +++ b/servers/slapd/configinfo.c @@ -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. @@ -18,20 +23,16 @@ #include #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 */