/* $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. * * Redistribution and use in source and binary forms are permitted * provided that this notice is preserved and that due credit is given * to the University of Michigan at Ann Arbor. The name of the University * may not be used to endorse or promote products derived from this * software without specific prior written permission. This software * is provided ``as is'' without express or implied warranty. */ #include "portable.h" #include #include #include #include "slap.h" #if defined( SLAPD_CONFIG_DN ) /* * no mutex protection in here - take our chances! */ int config_info( Entry **entry, const char **text ) { Entry *e; char buf[BUFSIZ]; struct berval val, *ndn = NULL; struct berval *vals[2]; int i, j; vals[0] = &val; vals[1] = NULL; e = (Entry *) ch_calloc( 1, sizeof(Entry) ); e->e_private = NULL; e->e_attrs = NULL; e->e_name.bv_val = SLAPD_CONFIG_DN; e->e_name.bv_len = sizeof( SLAPD_CONFIG_DN ) - 1; e->e_attrs = NULL; ber_str2bv( SLAPD_CONFIG_DN, sizeof(SLAPD_CONFIG_DN)-1, 1, &e->e_name ); (void) dnNormalize( NULL, &e->e_name, &ndn ); e->e_nname = *ndn; free( 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 ); { val.bv_val = strchr( e->e_dn, '=' ); if( val.bv_val != NULL ) { *val.bv_val++ = '\0'; val.bv_len = e->e_name.bv_len - (val.bv_val-e->e_dn); attr_merge( e, rdn, vals ); val.bv_val[-1] = '='; } } for ( i = 0; i < nbackends; i++ ) { char *ptr = slap_strcopy( buf, backends[i].be_type ); for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) { ptr = slap_strcopy( ptr, " : " ); ptr = slap_strcopy( ptr, backends[i].be_suffix[j]->bv_val ); } val.bv_val = buf; val.bv_len = ptr - buf; attr_merge( e, "database", vals ); } *entry = e; return LDAP_SUCCESS; } #endif /* slapd_config_dn */