version 1.19.2.8, 2008/04/14 20:13:41
|
version 1.19.2.9, 2008/05/27 20:18:19
|
Line 1
|
Line 1
|
/* refint.c - referential integrity module */ |
/* refint.c - referential integrity module */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/refint.c,v 1.19.2.7 2008/04/14 20:10:54 quanah Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/refint.c,v 1.19.2.8 2008/04/14 20:13:41 quanah Exp $ */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
* Copyright 2004-2008 The OpenLDAP Foundation. |
* Copyright 2004-2008 The OpenLDAP Foundation. |
Line 81 typedef struct refint_data_s {
|
Line 81 typedef struct refint_data_s {
|
BerValue dn; /* basedn in parent, */ |
BerValue dn; /* basedn in parent, */ |
BerValue nothing; /* the nothing value, if needed */ |
BerValue nothing; /* the nothing value, if needed */ |
BerValue nnothing; /* normalized nothingness */ |
BerValue nnothing; /* normalized nothingness */ |
|
BerValue refint_dn; /* modifier's name */ |
|
BerValue refint_ndn; /* normalized modifier's name */ |
struct re_s *qtask; |
struct re_s *qtask; |
refint_q *qhead; |
refint_q *qhead; |
refint_q *qtail; |
refint_q *qtail; |
Line 93 static MatchingRule *mr_dnSubtreeMatch;
|
Line 95 static MatchingRule *mr_dnSubtreeMatch;
|
|
|
enum { |
enum { |
REFINT_ATTRS = 1, |
REFINT_ATTRS = 1, |
REFINT_NOTHING |
REFINT_NOTHING, |
|
REFINT_MODIFIERSNAME |
}; |
}; |
|
|
static ConfigDriver refint_cf_gen; |
static ConfigDriver refint_cf_gen; |
Line 110 static ConfigTable refintcfg[] = {
|
Line 113 static ConfigTable refintcfg[] = {
|
"( OLcfgOvAt:11.2 NAME 'olcRefintNothing' " |
"( OLcfgOvAt:11.2 NAME 'olcRefintNothing' " |
"DESC 'Replacement DN to supply when needed' " |
"DESC 'Replacement DN to supply when needed' " |
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL }, |
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL }, |
|
{ "refint_modifiersName", "DN", 2, 2, 0, |
|
ARG_DN|ARG_MAGIC|REFINT_MODIFIERSNAME, refint_cf_gen, |
|
"( OLcfgOvAt:11.3 NAME 'olcRefintModifiersName' " |
|
"DESC 'The DN to use as modifiersName' " |
|
"SYNTAX OMsDN SINGLE-VALUE )", NULL, NULL }, |
{ NULL, NULL, 0, 0, 0, ARG_IGNORED } |
{ NULL, NULL, 0, 0, 0, ARG_IGNORED } |
}; |
}; |
|
|
Line 118 static ConfigOCs refintocs[] = {
|
Line 126 static ConfigOCs refintocs[] = {
|
"NAME 'olcRefintConfig' " |
"NAME 'olcRefintConfig' " |
"DESC 'Referential integrity configuration' " |
"DESC 'Referential integrity configuration' " |
"SUP olcOverlayConfig " |
"SUP olcOverlayConfig " |
"MAY ( olcRefintAttribute $ olcRefintNothing ) )", |
"MAY ( olcRefintAttribute " |
|
"$ olcRefintNothing " |
|
"$ olcRefintModifiersName " |
|
") )", |
Cft_Overlay, refintcfg }, |
Cft_Overlay, refintcfg }, |
{ NULL, 0, NULL } |
{ NULL, 0, NULL } |
}; |
}; |
Line 157 refint_cf_gen(ConfigArgs *c)
|
Line 168 refint_cf_gen(ConfigArgs *c)
|
} |
} |
rc = 0; |
rc = 0; |
break; |
break; |
|
case REFINT_MODIFIERSNAME: |
|
if ( !BER_BVISEMPTY( &dd->refint_dn )) { |
|
rc = value_add_one( &c->rvalue_vals, |
|
&dd->refint_dn ); |
|
if ( rc ) return rc; |
|
rc = value_add_one( &c->rvalue_nvals, |
|
&dd->refint_ndn ); |
|
return rc; |
|
} |
|
rc = 0; |
|
break; |
default: |
default: |
abort (); |
abort (); |
} |
} |
Line 196 refint_cf_gen(ConfigArgs *c)
|
Line 218 refint_cf_gen(ConfigArgs *c)
|
dd->nnothing.bv_len = 0; |
dd->nnothing.bv_len = 0; |
rc = 0; |
rc = 0; |
break; |
break; |
|
case REFINT_MODIFIERSNAME: |
|
if ( dd->refint_dn.bv_val ) |
|
ber_memfree ( dd->refint_dn.bv_val ); |
|
if ( dd->refint_ndn.bv_val ) |
|
ber_memfree ( dd->refint_ndn.bv_val ); |
|
dd->refint_dn.bv_len = 0; |
|
dd->refint_ndn.bv_len = 0; |
|
rc = 0; |
|
break; |
default: |
default: |
abort (); |
abort (); |
} |
} |
Line 233 refint_cf_gen(ConfigArgs *c)
|
Line 264 refint_cf_gen(ConfigArgs *c)
|
dd->nnothing = c->value_ndn; |
dd->nnothing = c->value_ndn; |
rc = 0; |
rc = 0; |
break; |
break; |
|
case REFINT_MODIFIERSNAME: |
|
if ( dd->refint_dn.bv_val ) |
|
ber_memfree ( dd->refint_dn.bv_val ); |
|
if ( dd->refint_ndn.bv_val ) |
|
ber_memfree ( dd->refint_ndn.bv_val ); |
|
dd->refint_dn = c->value_dn; |
|
dd->refint_ndn = c->value_ndn; |
|
rc = 0; |
|
break; |
default: |
default: |
abort (); |
abort (); |
} |
} |
Line 302 refint_open(
|
Line 342 refint_open(
|
return -1; |
return -1; |
ber_dupbv( &id->dn, &be->be_nsuffix[0] ); |
ber_dupbv( &id->dn, &be->be_nsuffix[0] ); |
} |
} |
|
if ( BER_BVISNULL( &id->refint_dn ) ) { |
|
ber_dupbv( &id->refint_dn, &refint_dn ); |
|
ber_dupbv( &id->refint_ndn, &refint_ndn ); |
|
} |
return(0); |
return(0); |
} |
} |
|
|
Line 339 refint_close(
|
Line 383 refint_close(
|
BER_BVZERO( &id->nothing ); |
BER_BVZERO( &id->nothing ); |
ch_free( id->nnothing.bv_val ); |
ch_free( id->nnothing.bv_val ); |
BER_BVZERO( &id->nnothing ); |
BER_BVZERO( &id->nnothing ); |
|
ch_free( id->refint_dn.bv_val ); |
|
BER_BVZERO( &id->refint_dn ); |
|
ch_free( id->refint_ndn.bv_val ); |
|
BER_BVZERO( &id->refint_ndn ); |
|
|
return(0); |
return(0); |
} |
} |
Line 580 refint_repair(
|
Line 628 refint_repair(
|
m->sml_nvalues = m->sml_values+2; |
m->sml_nvalues = m->sml_values+2; |
BER_BVZERO( &m->sml_values[1] ); |
BER_BVZERO( &m->sml_values[1] ); |
BER_BVZERO( &m->sml_nvalues[1] ); |
BER_BVZERO( &m->sml_nvalues[1] ); |
m->sml_values[0] = refint_dn; |
m->sml_values[0] = id->refint_dn; |
m->sml_nvalues[0] = refint_ndn; |
m->sml_nvalues[0] = id->refint_ndn; |
} |
} |
if ( !BER_BVISEMPTY( &rq->newdn ) || ( ra->next && |
if ( !BER_BVISEMPTY( &rq->newdn ) || ( ra->next && |
ra->attr == ra->next->attr ) ) |
ra->attr == ra->next->attr ) ) |