Beginning of ROOT DSE support

This commit is contained in:
Julio Sánchez Fernández 1999-04-19 18:21:53 +00:00
parent bb7a0b816e
commit 01385acc2a
4 changed files with 79 additions and 2 deletions

View file

@ -10,14 +10,16 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \
value.c ava.c bind.c unbind.c abandon.c filterentry.c \
phonetic.c acl.c str2filter.c aclparse.c init.c user.c \
repl.c lock.c \
suffixalias.c schema.c schemaparse.c monitor.c configinfo.c
suffixalias.c schema.c schemaparse.c monitor.c configinfo.c \
root_dse.c
OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
attr.o entry.o config.o backend.o result.o operation.o \
dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \
value.o ava.o bind.o unbind.o abandon.o filterentry.o \
phonetic.o acl.o str2filter.o aclparse.o init.o user.o \
repl.o lock.o \
suffixalias.o schema.o schemaparse.o monitor.o configinfo.o
suffixalias.o schema.o schemaparse.o monitor.o configinfo.o \
root_dse.o
LDAP_INCDIR= ../../include
LDAP_LIBDIR= ../../libraries

View file

@ -329,6 +329,7 @@ extern void slap_set_shutdown LDAP_P((int sig));
extern void slap_do_nothing LDAP_P((int sig));
extern void config_info LDAP_P((Connection *conn, Operation *op));
extern void root_dse_info LDAP_P((Connection *conn, Operation *op));
extern void do_abandon LDAP_P((Connection *conn, Operation *op));
extern void do_add LDAP_P((Connection *conn, Operation *op));
extern void do_bind LDAP_P((Connection *conn, Operation *op));

70
servers/slapd/root_dse.c Normal file
View file

@ -0,0 +1,70 @@
/* root_dse.c - Provides the ROOT DSA-Specific Entry
*
* Copyright 1999 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted only
* as authorized by the OpenLDAP Public License. A copy of this
* license is available at http://www.OpenLDAP.org/license.html or
* in file LICENSE in the top-level directory of the distribution.
*/
#include "portable.h"
#include <stdio.h>
#include "ldapconfig.h"
#include "slap.h"
void
root_dse_info( Connection *conn, Operation *op )
{
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) );
e->e_attrs = NULL;
e->e_dn = ch_strdup( LDAP_ROOT_DSE );
e->e_ndn = dn_normalize_case( ch_strdup( LDAP_ROOT_DSE ));
e->e_private = NULL;
for ( i = 0; i < nbackends; i++ ) {
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
strcpy( buf, backends[i].be_suffix[j] );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "namingContexts", vals );
}
}
#if defined( SLAPD_SCHEMA_DN )
val.bv_val = ch_strdup( SLAPD_SCHEMA_DN );
val.bv_len = strlen( va.bv_val );
attr_merge( e, "subschemaSubentry", vals );
ldap_memfree( val.bv_val );
#endif
/* altServer unsupported */
/* supportedExtension: no extensions supported */
/* supportedControl: no controls supported */
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
sprintf(buf,"%d",i);
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "supportedLDAPVersion", 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 );
}

View file

@ -126,6 +126,10 @@ do_search(
goto return_results;
}
#endif
if ( strcmp( base, LDAP_ROOT_DSE ) == 0 ) {
root_dse_info( conn, op );
goto return_results;
}
}
#endif /* monitor or config or schema dn */