fix overlay access control; cleanup

This commit is contained in:
Pierangelo Masarati 2005-04-18 09:16:26 +00:00
parent f2c4803dbd
commit f6d136a99a
2 changed files with 19 additions and 8 deletions

View file

@ -1523,9 +1523,10 @@ backend_attribute(
if ( a ) {
BerVarray v;
if ( op->o_conn && access > ACL_NONE && access_allowed( op,
e, entry_at, NULL, access,
&acl_state ) == 0 ) {
if ( op->o_conn && access > ACL_NONE &&
access_allowed( op, e, entry_at, NULL,
access, &acl_state ) == 0 )
{
rc = LDAP_INSUFFICIENT_ACCESS;
goto freeit;
}
@ -1535,11 +1536,10 @@ backend_attribute(
v = op->o_tmpalloc( sizeof(struct berval) * ( i + 1 ),
op->o_tmpmemctx );
for ( i = 0,j = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ )
for ( i = 0, j = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ )
{
if ( op->o_conn && access > ACL_NONE &&
access_allowed( op, e,
entry_at,
access_allowed( op, e, entry_at,
&a->a_nvals[i],
access,
&acl_state ) == 0 )

View file

@ -261,6 +261,7 @@ over_access_allowed(
{
slap_overinfo *oi;
slap_overinst *on;
BackendInfo *bi = op->o_bd->bd_info;
BackendDB *be = op->o_bd, db;
int rc = SLAP_CB_CONTINUE;
@ -287,14 +288,22 @@ over_access_allowed(
}
}
if ( rc == SLAP_CB_CONTINUE && oi->oi_orig->bi_access_allowed ) {
if ( rc == SLAP_CB_CONTINUE ) {
BI_access_allowed *bi_access_allowed;
/* if the database structure was changed, o_bd points to a
* copy of the structure; put the original bd_info in place */
if ( SLAP_ISOVERLAY( op->o_bd ) ) {
op->o_bd->bd_info = oi->oi_orig;
}
rc = oi->oi_orig->bi_access_allowed( op, e,
if ( oi->oi_orig->bi_access_allowed ) {
bi_access_allowed = oi->oi_orig->bi_access_allowed;
} else {
bi_access_allowed = slap_access_allowed;
}
rc = bi_access_allowed( op, e,
desc, val, access, state, maskp );
}
/* should not fall thru this far without anything happening... */
@ -304,6 +313,8 @@ over_access_allowed(
}
op->o_bd = be;
op->o_bd->bd_info = bi;
return rc;
}
#endif /* SLAP_OVERLAY_ACCESS */