schemaparse.c ad.c at.c mr.c syntax.c oc.c saslauthz.c \
configinfo.c starttls.c index.c sets.c referral.c \
root_dse.c sasl.c module.c suffixalias.c mra.c mods.c \
- limits.c backglue.c \
+ limits.c backglue.c operational.c \
$(@PLAT@_SRCS)
OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o \
configinfo.o starttls.o index.o sets.o referral.o \
root_dse.o sasl.o module.o suffixalias.o mra.o mods.o \
- limits.o backglue.o \
+ limits.o backglue.o operational.o \
$(@PLAT@_OBJS)
LDAP_INCDIR= ../../include
int hs;
hs = has_children( be, e );
-
- *aa = ch_malloc( sizeof( Attribute ) );
- (*aa)->a_desc = slap_schema.si_ad_hasSubordinates;
-
- (*aa)->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
- (*aa)->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
- (*aa)->a_vals[1] = NULL;
-
- (*aa)->a_next = NULL;
- aa = &(*aa)->a_next;
+ *aa = slap_operational_hasSubordinate( hs );
+ if ( *aa != NULL ) {
+ aa = &(*aa)->a_next;
+ }
}
return 0;
assert( mp );
hs = MONITOR_HAS_CHILDREN( mp );
-
- *aa = ch_malloc( sizeof( Attribute ) );
- (*aa)->a_desc = slap_schema.si_ad_hasSubordinates;
-
- (*aa)->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
- (*aa)->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
- (*aa)->a_vals[1] = NULL;
-
- (*aa)->a_next = NULL;
- aa = &(*aa)->a_next;
+ *aa = slap_operational_hasSubordinate( hs );
+ if ( *aa != NULL ) {
+ aa = &(*aa)->a_next;
+ }
}
return 0;
Attribute *a = NULL, **ap = &a;
#ifdef SLAPD_SCHEMA_DN
- a = ch_malloc( sizeof( Attribute ) );
- a->a_desc = slap_schema.si_ad_subschemaSubentry;
-
- /* Should be backend specific */
- a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
- a->a_vals[0] = ber_bvstrdup( SLAPD_SCHEMA_DN );
- a->a_vals[1] = NULL;
-
- a->a_next = NULL;
- ap = &a->a_next;
+ *ap = slap_operational_subschemaSubentry();
+ ap = &(*ap)->a_next;
#endif
/*
* and the backend supports specific operational attributes,
* add them to the attribute list
*/
- if ( ( opattrs || attrs ) && be->be_operational != NULL ) {
+ if ( ( opattrs || attrs ) && be && be->be_operational != NULL ) {
( void )be->be_operational( be, conn, op, e,
attrs, opattrs, ap );
}
--- /dev/null
+/* operational.c - routines to deal with on-the-fly operational attrs */
+/*
+ * Copyright 2001 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include "slap.h"
+
+/*
+ * helpers for on-the-fly operational attribute generation
+ */
+
+#ifdef SLAPD_SCHEMA_DN
+Attribute *
+slap_operational_subschemaSubentry( void )
+{
+ Attribute *a;
+
+ a = ch_malloc( sizeof( Attribute ) );
+ a->a_desc = slap_schema.si_ad_subschemaSubentry;
+
+ /* Should be backend specific */
+ a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
+ a->a_vals[0] = ber_bvstrdup( SLAPD_SCHEMA_DN );
+ a->a_vals[1] = NULL;
+
+ a->a_next = NULL;
+
+ return a;
+}
+#endif /* SLAPD_SCHEMA_DN */
+
+Attribute *
+slap_operational_hasSubordinate( int hs )
+{
+ Attribute *a;
+
+ a = ch_malloc( sizeof( Attribute ) );
+ a->a_desc = slap_schema.si_ad_hasSubordinates;
+
+ a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
+ a->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
+ a->a_vals[1] = NULL;
+
+ a->a_next = NULL;
+
+ return a;
+}
+
LDAP_SLAPD_V (int) krbv4_ldap_auth();
#endif
+/*
+ * operational.c
+ */
+LDAP_SLAPD_F (Attribute *) slap_operational_subschemaSubentry( void );
+LDAP_SLAPD_F (Attribute *) slap_operational_hasSubordinate( int has );
+
/*
* Other...
*/
{
return 0;
}
+
+Attribute *
+slap_operational_subschemaSubentry( void )
+{
+ return NULL;
+}
+
+Attribute *
+slap_operational_hasSubordinate( int hs )
+{
+ return NULL;
+}
+