]> git.sur5r.net Git - openldap/blob - servers/slapd/operational.c
Added proposed request parameters to Operation. #ifdef'd, not active.
[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 )
22                 return NULL;
23
24         a = ch_malloc( sizeof( Attribute ) );
25         a->a_desc = slap_schema.si_ad_subschemaSubentry;
26
27         a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
28         ber_dupbv( a->a_vals, &global_schemadn );
29         a->a_vals[1].bv_len = 0;
30         a->a_vals[1].bv_val = NULL;
31
32 #ifdef SLAP_NVALUES
33         a->a_nvals = NULL;
34 #endif
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         char            *val;
47         ber_len_t       len;
48
49         if ( hs ) {
50                 val = "TRUE";
51                 len = sizeof( "TRUE" ) - 1;
52
53         } else {
54                 val = "FALSE";
55                 len = sizeof( "FALSE" ) - 1;
56
57         }
58
59         a = ch_malloc( sizeof( Attribute ) );
60         a->a_desc = slap_schema.si_ad_hasSubordinates;
61         a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
62
63         ber_str2bv( val, len, 1, a->a_vals );
64         a->a_vals[1].bv_val = NULL;
65
66 #ifdef SLAP_NVALUES
67         a->a_nvals = NULL;
68 #endif
69
70         a->a_next = NULL;
71         a->a_flags = 0;
72
73         return a;
74 }
75