mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
allow to customize the modifiersName of internal modifications (partially addresses ITS#5505)
This commit is contained in:
parent
61198ee41c
commit
62904cf50d
@ -39,7 +39,7 @@ They should appear after the
|
|||||||
.B overlay
|
.B overlay
|
||||||
directive.
|
directive.
|
||||||
.TP
|
.TP
|
||||||
.B refint_attributes <attribute...>
|
.B refint_attributes <attribute> [...]
|
||||||
Specify one or more attributes for which integrity will be maintained
|
Specify one or more attributes for which integrity will be maintained
|
||||||
as described above.
|
as described above.
|
||||||
.TP
|
.TP
|
||||||
@ -49,6 +49,12 @@ would otherwise be deleted from an attribute. This can be useful in cases
|
|||||||
where the schema requires the existence of an attribute for which referential
|
where the schema requires the existence of an attribute for which referential
|
||||||
integrity is enforced. The attempted deletion of a required attribute will
|
integrity is enforced. The attempted deletion of a required attribute will
|
||||||
otherwise result in an Object Class Violation, causing the request to fail.
|
otherwise result in an Object Class Violation, causing the request to fail.
|
||||||
|
The string must be a valid DN.
|
||||||
|
.TP
|
||||||
|
.B refint_modifiersname <DN>
|
||||||
|
Specify the DN to be used as the modifiersName of the internal modifications
|
||||||
|
performed by the overlay.
|
||||||
|
It defaults to "\fIcn=Referential Integrity Overlay\fP".
|
||||||
.B
|
.B
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.TP
|
.TP
|
||||||
|
@ -81,6 +81,8 @@ 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;
|
||||||
@ -93,7 +95,8 @@ 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;
|
||||||
@ -110,6 +113,11 @@ 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 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,7 +126,10 @@ 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 }
|
||||||
};
|
};
|
||||||
@ -157,6 +168,17 @@ 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 ();
|
||||||
}
|
}
|
||||||
@ -196,6 +218,15 @@ 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 ();
|
||||||
}
|
}
|
||||||
@ -233,6 +264,15 @@ 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 ();
|
||||||
}
|
}
|
||||||
@ -302,6 +342,10 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,6 +383,10 @@ 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);
|
||||||
}
|
}
|
||||||
@ -580,8 +628,8 @@ 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 ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user