]> git.sur5r.net Git - openldap/blob - servers/slapd/root_dse.c
Move WAKE_LISTENER call behind &connection_mutex to eliminate
[openldap] / servers / slapd / root_dse.c
1 /* root_dse.c - Provides the ROOT DSA-Specific Entry
2  *
3  * Copyright 1999 The OpenLDAP Foundation.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11
12 #include "portable.h"
13
14 #include <stdio.h>
15
16 #include "ldapconfig.h"
17 #include "slap.h"
18
19 void
20 root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
21 {
22         Entry           *e;
23         char            buf[BUFSIZ];
24         struct berval   val;
25         struct berval   *vals[2];
26         int             i, j;
27
28         vals[0] = &val;
29         vals[1] = NULL;
30
31         e = (Entry *) ch_calloc( 1, sizeof(Entry) );
32
33         e->e_attrs = NULL;
34         e->e_dn = ch_strdup( LDAP_ROOT_DSE );
35         e->e_ndn = dn_normalize_case( ch_strdup( LDAP_ROOT_DSE ));
36         e->e_private = NULL;
37
38         for ( i = 0; i < nbackends; i++ ) {
39                 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
40                         strcpy( buf, backends[i].be_suffix[j] );
41                         val.bv_val = buf;
42                         val.bv_len = strlen( buf );
43                         attr_merge( e, "namingContexts", vals );
44                 }
45         }
46
47 #if defined( SLAPD_MONITOR_DN )
48         strcpy( buf, SLAPD_MONITOR_DN );
49         val.bv_val = buf;
50         val.bv_len = strlen( buf );
51         attr_merge( e, "namingContexts", vals );
52 #endif
53
54 #if defined( SLAPD_CONFIG_DN )
55         strcpy( buf, SLAPD_CONFIG_DN );
56         val.bv_val = buf;
57         val.bv_len = strlen( buf );
58         attr_merge( e, "namingContexts", vals );
59 #endif
60
61 #if defined( SLAPD_SCHEMA_DN )
62         val.bv_val = ch_strdup( SLAPD_SCHEMA_DN );
63         val.bv_len = strlen( val.bv_val );
64         attr_merge( e, "namingContexts", vals );
65         attr_merge( e, "subschemaSubentry", vals );
66         ldap_memfree( val.bv_val );
67 #endif
68
69         /* altServer unsupported */
70         /* supportedExtension: no extensions supported */
71         /* supportedControl: no controls supported */
72         /* supportedSASLMechanism: not yet */
73
74         for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
75                 sprintf(buf,"%d",i);
76                 val.bv_val = buf;
77                 val.bv_len = strlen( buf );
78                 attr_merge( e, "supportedLDAPVersion", vals );
79         }
80         
81         send_search_entry( &backends[0], conn, op, e, attrs, attrsonly );
82         send_ldap_search_result( conn, op, LDAP_SUCCESS, NULL, NULL, 1 );
83
84         entry_free( e );
85 }
86