]> git.sur5r.net Git - openldap/commitdiff
Beginning of ROOT DSE support
authorJulio Sánchez Fernández <jsanchez@openldap.org>
Mon, 19 Apr 1999 18:21:53 +0000 (18:21 +0000)
committerJulio Sánchez Fernández <jsanchez@openldap.org>
Mon, 19 Apr 1999 18:21:53 +0000 (18:21 +0000)
servers/slapd/Makefile.in
servers/slapd/proto-slap.h
servers/slapd/root_dse.c [new file with mode: 0644]
servers/slapd/search.c

index 11030fac1aa234e65ee2a7b844031cdcab10b878..2a9a0fbe17b5267da3fc6a0a57d451200714454d 100644 (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
index aeb502a41c00ca0ed89209b87de7064021847572..696691dd18738fb7333ae474d69fabd26e2c7602 100644 (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));
diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c
new file mode 100644 (file)
index 0000000..56cc7ad
--- /dev/null
@@ -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 );
+}
+
index 3c1bce5336c84b628e5e3f76bb4bf7917fab8c71..0b76e934dbd08ed0fa93d39b123ccbac4f7fc70b 100644 (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 */