]> git.sur5r.net Git - openldap/blob - servers/slapd/configinfo.c
very bad typo.
[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 <stdio.h>
14 #include <string.h>
15 #include <sys/types.h>
16 #include <sys/socket.h>
17 #include "slap.h"
18 #include "ldapconfig.h"
19
20 #if defined( SLAPD_CONFIG_DN )
21
22 extern int              nbackends;
23 extern Backend          *backends;
24 extern char             *default_referral;
25
26 /*
27  * no mutex protection in here - take our chances!
28  */
29
30 void
31 config_info( Connection *conn, Operation *op )
32 {
33         Entry           *e;
34         char            buf[BUFSIZ];
35         struct berval   val;
36         struct berval   *vals[2];
37         int             i, j;
38
39         vals[0] = &val;
40         vals[1] = NULL;
41
42         e = (Entry *) ch_calloc( 1, sizeof(Entry) );
43         /* initialize reader/writer lock */
44         entry_rdwr_init(e);
45
46         e->e_attrs = NULL;
47         e->e_dn = strdup( SLAPD_CONFIG_DN );
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         if ( default_referral != NULL ) {
61                 strcpy( buf, default_referral );
62                 val.bv_val = buf;
63                 val.bv_len = strlen( buf );
64                 attr_merge( e, "database", vals );
65         }
66
67         send_search_entry( &backends[0], conn, op, e, NULL, 0 );
68         send_ldap_search_result( conn, op, LDAP_SUCCESS, NULL, NULL, 1 );
69
70         entry_free( e );
71 }
72
73 #endif /* slapd_config_dn */