]> git.sur5r.net Git - openldap/blob - servers/slapd/operational.c
Berkeley DB 4.2 support (DB 4.2 required by default)
[openldap] / servers / slapd / operational.c
1 /* operational.c - routines to deal with on-the-fly operational attrs */
2 /*
3  * Copyright 2001-2003 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #include "portable.h"
8
9 #include "slap.h"
10
11 /*
12  * helpers for on-the-fly operational attribute generation
13  */
14
15 Attribute *
16 slap_operational_subschemaSubentry( Backend *be )
17 {
18         Attribute       *a;
19
20         /* The backend wants to take care of it */
21         if ( be && be->be_schemadn.bv_val ) return NULL;
22
23         a = ch_malloc( sizeof( Attribute ) );
24         a->a_desc = slap_schema.si_ad_subschemaSubentry;
25
26         a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
27         ber_dupbv( a->a_vals, &global_schemadn );
28         a->a_vals[1].bv_len = 0;
29         a->a_vals[1].bv_val = NULL;
30
31         a->a_nvals = ch_malloc( 2 * sizeof( struct berval ) );
32         ber_dupbv( a->a_nvals, &global_schemandn );
33         a->a_nvals[1].bv_len = 0;
34         a->a_nvals[1].bv_val = NULL;
35
36         a->a_next = NULL;
37         a->a_flags = 0;
38
39         return a;
40 }
41
42 Attribute *
43 slap_operational_hasSubordinate( int hs )
44 {
45         Attribute       *a;
46         struct berval   val;
47
48         if ( hs ) {
49                 val = slap_true_bv;
50
51         } else {
52                 val = slap_false_bv;
53         }
54
55         a = ch_malloc( sizeof( Attribute ) );
56         a->a_desc = slap_schema.si_ad_hasSubordinates;
57         a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
58
59         ber_dupbv( &a->a_vals[0], &val );
60         a->a_vals[1].bv_val = NULL;
61
62         a->a_nvals = a->a_vals;
63
64         a->a_next = NULL;
65         a->a_flags = 0;
66
67         return a;
68 }
69