mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 20:49:35 -05:00
better handling of on-the-fly operational attrs by means of helpers
This commit is contained in:
parent
3824672c49
commit
328d38713a
7 changed files with 83 additions and 33 deletions
|
|
@ -19,7 +19,7 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \
|
|||
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 \
|
||||
|
|
@ -32,7 +32,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -37,16 +37,10 @@ ldbm_back_operational(
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -42,16 +42,10 @@ monitor_back_operational(
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -1094,16 +1094,8 @@ Attribute *backend_operational(
|
|||
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
|
||||
|
||||
/*
|
||||
|
|
@ -1111,7 +1103,7 @@ Attribute *backend_operational(
|
|||
* 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 );
|
||||
}
|
||||
|
|
|
|||
51
servers/slapd/operational.c
Normal file
51
servers/slapd/operational.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -886,6 +886,12 @@ LDAP_SLAPD_V (char) *ldap_srvtab;
|
|||
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...
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -220,3 +220,16 @@ int read_root_dse_file ( const char *file )
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Attribute *
|
||||
slap_operational_subschemaSubentry( void )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Attribute *
|
||||
slap_operational_hasSubordinate( int hs )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue