From: Julio Sánchez Fernández Date: Mon, 19 Apr 1999 18:21:53 +0000 (+0000) Subject: Beginning of ROOT DSE support X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~160 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=01385acc2a4265ac03bff0cc141cb37211b07b10;p=openldap Beginning of ROOT DSE support --- diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in index 11030fac1a..2a9a0fbe17 100644 --- a/servers/slapd/Makefile.in +++ b/servers/slapd/Makefile.in @@ -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 diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index aeb502a41c..696691dd18 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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)); diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c new file mode 100644 index 0000000000..56cc7ad593 --- /dev/null +++ b/servers/slapd/root_dse.c @@ -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 + +#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 ); +} + diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 3c1bce5336..0b76e934db 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -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 */