]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/operational.c
cleanup bind
[openldap] / servers / slapd / back-ldbm / operational.c
1 /* operational.c - ldbm backend operational attributes function */
2 /*
3  * Copyright 1998-2003 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 *hasSubordinates to LDAP_COMPARE_TRUE/LDAP_COMPARE_FALSE
20  * if the entry has children or not.
21  */
22 int
23 ldbm_back_hasSubordinates(
24         BackendDB       *be,
25         Connection      *conn, 
26         Operation       *op,
27         Entry           *e,
28         int             *hasSubordinates )
29 {
30         if ( has_children( be, e ) ) {
31                 *hasSubordinates = LDAP_COMPARE_TRUE;
32
33         } else {
34                 *hasSubordinates = LDAP_COMPARE_FALSE;
35         }
36
37         return 0;
38 }
39
40 /*
41  * sets the supported operational attributes (if required)
42  */
43 int
44 ldbm_back_operational(
45         BackendDB       *be,
46         Connection      *conn, 
47         Operation       *op,
48         Entry           *e,
49         AttributeName           *attrs,
50         int             opattrs,
51         Attribute       **a )
52 {
53         Attribute       **aa = a;
54
55         assert( e );
56
57         if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
58                 int     hs;
59
60                 hs = has_children( be, e );
61                 *aa = slap_operational_hasSubordinate( hs );
62                 if ( *aa != NULL ) {
63                         aa = &(*aa)->a_next;
64                 }
65         }
66         
67         return 0;
68 }
69