From b831ebba7de43cc6f7f03c81c13bb30ffc63bfb6 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 26 Nov 2005 07:53:07 +0000 Subject: [PATCH] ITS#4218 streamline frontend/overlay access_allowed. Probably need to do the same for acl_group and acl_attribute. --- servers/slapd/acl.c | 9 +++------ servers/slapd/backover.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 423f1c92cd..48d5eb7f14 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -310,9 +310,10 @@ fe_access_allowed( */ be_orig = op->o_bd; - op->o_bd = select_backend( &op->o_req_ndn, 0, 0 ); if ( op->o_bd == NULL ) { - op->o_bd = frontendDB; + op->o_bd = select_backend( &op->o_req_ndn, 0, 0 ); + if ( op->o_bd == NULL ) + op->o_bd = frontendDB; } rc = slap_access_allowed( op, e, desc, val, access, state, maskp ); op->o_bd = be_orig; @@ -423,14 +424,10 @@ access_allowed_mask( desc, val, access, state, &mask ); } else { - BackendDB *be_orig = op->o_bd; - /* use default (but pass through frontend * for global ACL overlays) */ - op->o_bd = frontendDB; ret = frontendDB->bd_info->bi_access_allowed( op, e, desc, val, access, state, &mask ); - op->o_bd = be_orig; } if ( !ret ) { diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 136fb95ff0..b87500ebc2 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -252,7 +252,7 @@ over_access_allowed( { slap_overinfo *oi; slap_overinst *on; - BackendInfo *bi = op->o_bd->bd_info; + BackendInfo *bi; BackendDB *be = op->o_bd, db; int rc = SLAP_CB_CONTINUE; @@ -260,7 +260,13 @@ over_access_allowed( * when global overlays are used... */ assert( op->o_bd != NULL ); - oi = op->o_bd->bd_info->bi_private; + bi = op->o_bd->bd_info; + /* Were we invoked on the frontend? */ + if ( !bi->bi_access_allowed ) { + oi = frontendDB->bd_info->bi_private; + } else { + oi = op->o_bd->bd_info->bi_private; + } on = oi->oi_list; for ( ; on; on = on->on_next ) { -- 2.39.5