]> git.sur5r.net Git - openldap/blob - servers/slapd/operational.c
b9396b2473fd194affd1174765a1349981bedb1e
[openldap] / servers / slapd / operational.c
1 /* operational.c - routines to deal with on-the-fly operational attrs */
2 /*
3  * Copyright 2001-2002 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 #ifdef SLAPD_SCHEMA_DN
16 Attribute *
17 slap_operational_subschemaSubentry( Backend *be )
18 {
19         Attribute       *a;
20
21         /* The backend wants to take care of it */
22         if ( be && be->be_schemadn.bv_val )
23                 return NULL;
24
25         a = ch_malloc( sizeof( Attribute ) );
26         a->a_desc = slap_schema.si_ad_subschemaSubentry;
27
28         a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
29         ber_dupbv( a->a_vals, &global_schemadn );
30         a->a_vals[1].bv_val = NULL;
31
32         a->a_next = NULL;
33         a->a_flags = 0;
34
35         return a;
36 }
37 #endif /* SLAPD_SCHEMA_DN */
38
39 Attribute *
40 slap_operational_hasSubordinate( int hs )
41 {
42         Attribute       *a;
43         
44         a = ch_malloc( sizeof( Attribute ) );
45         a->a_desc = slap_schema.si_ad_hasSubordinates;
46
47         a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
48         ber_str2bv( hs ? "TRUE" : "FALSE",
49                 hs ? sizeof("TRUE")-1 : sizeof("FALSE")-1,
50                 1, a->a_vals );
51         a->a_vals[1].bv_val = NULL;
52
53         a->a_next = NULL;
54         a->a_flags = 0;
55
56         return a;
57 }
58