]> git.sur5r.net Git - openldap/blob - servers/slapd/configinfo.c
5d45069fa91d2cb278f6f4b66ef80a145055da4d
[openldap] / servers / slapd / configinfo.c
1 /*
2  * Copyright (c) 1995 Regents of the University of Michigan.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of Michigan at Ann Arbor. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12
13 #include "portable.h"
14
15 #include <stdio.h>
16
17 #include <ac/string.h>
18 #include <ac/socket.h>
19
20 #include "ldap_defaults.h"
21 #include "slap.h"
22
23 #if defined( SLAPD_CONFIG_DN )
24
25 /*
26  * no mutex protection in here - take our chances!
27  */
28
29 void
30 config_info( Connection *conn, Operation *op )
31 {
32         Entry           *e;
33         char            buf[BUFSIZ];
34         struct berval   val;
35         struct berval   *vals[2];
36         int             i, j;
37
38         vals[0] = &val;
39         vals[1] = NULL;
40
41         e = (Entry *) ch_calloc( 1, sizeof(Entry) );
42
43         e->e_attrs = NULL;
44         e->e_dn = ch_strdup( SLAPD_CONFIG_DN );
45         e->e_ndn = ch_strdup( SLAPD_CONFIG_DN );
46         (void) dn_normalize_case( e->e_ndn );
47         e->e_private = NULL;
48
49         for ( i = 0; i < nbackends; i++ ) {
50                 strcpy( buf, backends[i].be_type );
51                 for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
52                         strcat( buf, " : " );
53                         strcat( buf, backends[i].be_suffix[j] );
54                 }
55                 val.bv_val = buf;
56                 val.bv_len = strlen( buf );
57                 attr_merge( e, "database", vals );
58         }
59
60         send_search_entry( &backends[0], conn, op, e,
61                 NULL, 0, 1, NULL );
62         send_search_result( conn, op, LDAP_SUCCESS,
63                 NULL, NULL, NULL, NULL, 1 );
64
65         entry_free( e );
66 }
67
68 #endif /* slapd_config_dn */