mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-31 20:19:34 -05:00
added backend-side support for on-the-fly operational attributes; added hasSubordinates to schema and back-ldbm
This commit is contained in:
parent
d71888c0aa
commit
e36bde9180
10 changed files with 97 additions and 6 deletions
|
|
@ -5,13 +5,13 @@ SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c \
|
|||
compare.c group.c modify.c modrdn.c delete.c init.c \
|
||||
config.c bind.c attr.c filterindex.c unbind.c close.c \
|
||||
alias.c tools.c key.c extended.c passwd.c sasl.c \
|
||||
referral.c attribute.c
|
||||
referral.c attribute.c operational.c
|
||||
OBJS = idl.lo add.lo search.lo cache.lo dbcache.lo dn2id.lo entry.lo \
|
||||
id2entry.lo index.lo id2children.lo nextid.lo abandon.lo \
|
||||
compare.lo group.lo modify.lo modrdn.lo delete.lo init.lo \
|
||||
config.lo bind.lo attr.lo filterindex.lo unbind.lo close.lo \
|
||||
alias.lo tools.lo key.lo extended.lo passwd.lo sasl.lo \
|
||||
referral.lo attribute.lo
|
||||
referral.lo attribute.lo operational.lo
|
||||
|
||||
LDAP_INCDIR= ../../../include
|
||||
LDAP_LIBDIR= ../../../libraries
|
||||
|
|
|
|||
|
|
@ -88,6 +88,12 @@ extern int ldbm_back_attribute LDAP_P(( BackendDB *bd,
|
|||
AttributeDescription* entry_at,
|
||||
struct berval ***vals));
|
||||
|
||||
extern int ldbm_back_operational LDAP_P((BackendDB *bd,
|
||||
Connection *conn, Operation *op,
|
||||
Entry *e,
|
||||
char **attrs,
|
||||
int opattrs,
|
||||
Attribute **a ));
|
||||
|
||||
/* hooks for slap tools */
|
||||
extern int ldbm_tool_entry_open LDAP_P(( BackendDB *be, int mode ));
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ ldbm_back_initialize(
|
|||
bi->bi_acl_group = ldbm_back_group;
|
||||
bi->bi_acl_attribute = ldbm_back_attribute;
|
||||
bi->bi_chk_referrals = ldbm_back_referrals;
|
||||
bi->bi_operational = ldbm_back_operational;
|
||||
|
||||
/*
|
||||
* hooks for slap tools
|
||||
|
|
|
|||
54
servers/slapd/back-ldbm/operational.c
Normal file
54
servers/slapd/back-ldbm/operational.c
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/* operational.c - ldbm backend operational attributes function */
|
||||
/*
|
||||
* Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/socket.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
#include "proto-back-ldbm.h"
|
||||
|
||||
/*
|
||||
* sets the supported operational attributes (if required)
|
||||
*/
|
||||
|
||||
int
|
||||
ldbm_back_operational(
|
||||
BackendDB *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e,
|
||||
char **attrs,
|
||||
int opattrs,
|
||||
Attribute **a )
|
||||
{
|
||||
Attribute **aa = a;
|
||||
|
||||
assert( e );
|
||||
|
||||
if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1087,9 +1087,11 @@ Attribute *backend_operational(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry *e )
|
||||
Entry *e,
|
||||
char **attrs,
|
||||
int opattrs )
|
||||
{
|
||||
Attribute *a = NULL;
|
||||
Attribute *a = NULL, **ap = &a;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_DN
|
||||
a = ch_malloc( sizeof( Attribute ) );
|
||||
|
|
@ -1101,7 +1103,19 @@ Attribute *backend_operational(
|
|||
a->a_vals[1] = NULL;
|
||||
|
||||
a->a_next = NULL;
|
||||
ap = &a->a_next;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If operational attributes (allegedly) are required,
|
||||
* and the backend supports specific operational attributes,
|
||||
* add them to the attribute list
|
||||
*/
|
||||
if ( ( opattrs || attrs ) && be->be_operational != NULL ) {
|
||||
( void )be->be_operational( be, conn, op, e,
|
||||
attrs, opattrs, ap );
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,9 @@ LDAP_SLAPD_F (Attribute *) backend_operational(
|
|||
BackendDB *,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
Entry * );
|
||||
Entry *e,
|
||||
char **attrs,
|
||||
int opattrs );
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -839,7 +839,7 @@ send_search_entry(
|
|||
|
||||
/* eventually will loop through generated operational attributes */
|
||||
/* only have subschemaSubentry implemented */
|
||||
aa = backend_operational( be, conn, op, e );
|
||||
aa = backend_operational( be, conn, op, e, attrs, opattrs );
|
||||
|
||||
for (a = aa ; a != NULL; a = a->a_next ) {
|
||||
AttributeDescription *desc = a->a_desc;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ attributetype ( 2.5.18.4 NAME 'modifiersName'
|
|||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
|
||||
SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
|
||||
|
||||
attributetype ( 2.5.18.9 NAME 'hasSubordinates'
|
||||
DESC 'X.501: entry has children'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
|
||||
|
||||
attributetype ( 2.5.18.10 NAME 'subschemaSubentry'
|
||||
DESC 'RFC2252: name of controlling subschema entry'
|
||||
EQUALITY distinguishedNameMatch
|
||||
|
|
|
|||
|
|
@ -165,6 +165,8 @@ struct slap_schema_ad_map {
|
|||
offsetof(struct slap_internal_schema, si_ad_modifiersName) },
|
||||
{ "modifyTimestamp", NULL, NULL, NULL,
|
||||
offsetof(struct slap_internal_schema, si_ad_modifyTimestamp) },
|
||||
{ "hasSubordinates", NULL, NULL, NULL,
|
||||
offsetof(struct slap_internal_schema, si_ad_hasSubordinates) },
|
||||
{ "subschemaSubentry", NULL, NULL, NULL,
|
||||
offsetof(struct slap_internal_schema, si_ad_subschemaSubentry) },
|
||||
|
||||
|
|
|
|||
|
|
@ -483,6 +483,7 @@ struct slap_internal_schema {
|
|||
AttributeDescription *si_ad_createTimestamp;
|
||||
AttributeDescription *si_ad_modifiersName;
|
||||
AttributeDescription *si_ad_modifyTimestamp;
|
||||
AttributeDescription *si_ad_hasSubordinates;
|
||||
AttributeDescription *si_ad_subschemaSubentry;
|
||||
|
||||
/* root DSE attribute descriptions */
|
||||
|
|
@ -918,6 +919,7 @@ struct slap_backend_db {
|
|||
#define be_chk_referrals bd_info->bi_chk_referrals
|
||||
#define be_group bd_info->bi_acl_group
|
||||
#define be_attribute bd_info->bi_acl_attribute
|
||||
#define be_operational bd_info->bi_operational
|
||||
|
||||
#define be_controls bd_info->bi_controls
|
||||
|
||||
|
|
@ -1139,6 +1141,10 @@ struct slap_backend_info {
|
|||
AttributeDescription *entry_at,
|
||||
struct berval ***vals ));
|
||||
|
||||
int (*bi_operational) LDAP_P((Backend *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
Entry *e, char **attrs, int opattrs, Attribute **a ));
|
||||
|
||||
int (*bi_connection_init) LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c));
|
||||
int (*bi_connection_destroy) LDAP_P((BackendDB *bd,
|
||||
|
|
|
|||
Loading…
Reference in a new issue