]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/operational.c
added backend-side support for on-the-fly operational attributes; added hasSubordinat...
[openldap] / servers / slapd / back-ldbm / operational.c
1 /* operational.c - ldbm backend operational attributes function */
2 /*
3  * Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #include "portable.h"
8
9 #include <stdio.h>
10
11 #include <ac/string.h>
12 #include <ac/socket.h>
13
14 #include "slap.h"
15 #include "back-ldbm.h"
16 #include "proto-back-ldbm.h"
17
18 /*
19  * sets the supported operational attributes (if required)
20  */
21
22 int
23 ldbm_back_operational(
24         BackendDB       *be,
25         Connection      *conn, 
26         Operation       *op,
27         Entry           *e,
28         char            **attrs,
29         int             opattrs,
30         Attribute       **a )
31 {
32         Attribute       **aa = a;
33
34         assert( e );
35
36         if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
37                 int     hs;
38
39                 hs = has_children( be, e );
40
41                 *aa = ch_malloc( sizeof( Attribute ) );
42                 (*aa)->a_desc = slap_schema.si_ad_hasSubordinates;
43
44                 (*aa)->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
45                 (*aa)->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
46                 (*aa)->a_vals[1] = NULL;
47
48                 (*aa)->a_next = NULL;
49                 aa = &(*aa)->a_next;
50         }
51         
52         return 0;
53 }
54