1 /* operational.c - routines to deal with on-the-fly operational attrs */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2001-2004 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
21 * helpers for on-the-fly operational attribute generation
25 slap_operational_subschemaSubentry( Backend *be )
29 /* The backend wants to take care of it */
30 if ( be && be->be_schemadn.bv_val ) return NULL;
32 a = ch_malloc( sizeof( Attribute ) );
33 a->a_desc = slap_schema.si_ad_subschemaSubentry;
35 a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
36 ber_dupbv( a->a_vals, &frontendDB->be_schemadn );
37 a->a_vals[1].bv_len = 0;
38 a->a_vals[1].bv_val = NULL;
40 a->a_nvals = ch_malloc( 2 * sizeof( struct berval ) );
41 ber_dupbv( a->a_nvals, &frontendDB->be_schemandn );
42 a->a_nvals[1].bv_len = 0;
43 a->a_nvals[1].bv_val = NULL;
52 slap_operational_entryDN( Entry *e )
56 a = ch_malloc( sizeof( Attribute ) );
57 a->a_desc = slap_schema.si_ad_entryDN;
59 a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
60 ber_dupbv( a->a_vals, &e->e_name );
61 a->a_vals[1].bv_len = 0;
62 a->a_vals[1].bv_val = NULL;
64 a->a_nvals = ch_malloc( 2 * sizeof( struct berval ) );
65 ber_dupbv( a->a_nvals, &e->e_nname );
66 a->a_nvals[1].bv_len = 0;
67 a->a_nvals[1].bv_val = NULL;
76 slap_operational_hasSubordinate( int hs )
81 val = hs ? slap_true_bv : slap_false_bv;
83 a = ch_malloc( sizeof( Attribute ) );
84 a->a_desc = slap_schema.si_ad_hasSubordinates;
85 a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
87 ber_dupbv( &a->a_vals[0], &val );
88 a->a_vals[1].bv_val = NULL;
90 a->a_nvals = a->a_vals;