1999-09-09 03:06:24 +08:00
|
|
|
/* $OpenLDAP$ */
|
1999-08-07 07:07:46 +08:00
|
|
|
/*
|
2000-05-13 10:47:56 +08:00
|
|
|
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
|
1999-08-07 07:07:46 +08:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
1998-08-09 08:43:13 +08:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#include "portable.h"
|
|
|
|
|
1998-08-09 08:43:13 +08:00
|
|
|
#include <stdio.h>
|
1998-10-25 09:41:42 +08:00
|
|
|
|
|
|
|
#include <ac/string.h>
|
|
|
|
#include <ac/socket.h>
|
|
|
|
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
#include "slap.h"
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
#if defined( SLAPD_CONFIG_DN )
|
|
|
|
|
|
|
|
/*
|
|
|
|
* no mutex protection in here - take our chances!
|
|
|
|
*/
|
|
|
|
|
2000-05-17 00:42:01 +08:00
|
|
|
int
|
1999-07-24 11:39:23 +08:00
|
|
|
config_info(
|
2000-05-17 00:42:01 +08:00
|
|
|
Entry **entry, char **text )
|
1998-08-09 08:43:13 +08:00
|
|
|
{
|
|
|
|
Entry *e;
|
|
|
|
char buf[BUFSIZ];
|
|
|
|
struct berval val;
|
|
|
|
struct berval *vals[2];
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
vals[0] = &val;
|
|
|
|
vals[1] = NULL;
|
|
|
|
|
|
|
|
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
|
1998-09-21 04:22:46 +08:00
|
|
|
|
1998-08-09 08:43:13 +08:00
|
|
|
e->e_attrs = NULL;
|
1998-11-28 04:21:54 +08:00
|
|
|
e->e_dn = ch_strdup( SLAPD_CONFIG_DN );
|
1999-07-23 01:14:42 +08:00
|
|
|
e->e_ndn = ch_strdup( SLAPD_CONFIG_DN );
|
1999-09-24 09:46:37 +08:00
|
|
|
(void) dn_normalize( e->e_ndn );
|
1999-02-11 02:28:25 +08:00
|
|
|
e->e_private = NULL;
|
1998-08-09 08:43:13 +08:00
|
|
|
|
2000-05-17 00:42:01 +08:00
|
|
|
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 );
|
|
|
|
|
1999-07-24 11:39:23 +08:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
1998-08-09 08:43:13 +08:00
|
|
|
for ( i = 0; i < nbackends; i++ ) {
|
|
|
|
strcpy( buf, backends[i].be_type );
|
|
|
|
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
|
|
|
|
strcat( buf, " : " );
|
|
|
|
strcat( buf, backends[i].be_suffix[j] );
|
|
|
|
}
|
|
|
|
val.bv_val = buf;
|
|
|
|
val.bv_len = strlen( buf );
|
|
|
|
attr_merge( e, "database", vals );
|
|
|
|
}
|
|
|
|
|
2000-05-17 00:42:01 +08:00
|
|
|
*entry = e;
|
|
|
|
return LDAP_SUCCESS;
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* slapd_config_dn */
|