mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-23 23:33:07 -05:00
rework be_isupdate accordingly to be_isroot
This commit is contained in:
parent
2808fb2cb7
commit
a11dc61e05
17 changed files with 38 additions and 29 deletions
|
|
@ -250,7 +250,7 @@ do_add( Operation *op, SlapReply *rs )
|
|||
*/
|
||||
if ( op->o_bd->be_add ) {
|
||||
/* do the update here */
|
||||
int repl_user = be_isupdate(op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ retry: /* transaction retry */
|
|||
/* no parent, must be root to delete */
|
||||
if( ! be_isroot( op ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op->o_bd, &op->o_ndn ) ) {
|
||||
|| be_isupdate( op ) ) {
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
/* check parent for "children" acl */
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ retry: /* transaction retry */
|
|||
isroot = be_isroot( op );
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op->o_bd, &op->o_ndn ) ) {
|
||||
|| be_isupdate( op ) ) {
|
||||
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
|
|
@ -608,7 +608,7 @@ retry: /* transaction retry */
|
|||
/* no parent, modrdn entry directly under root */
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
|
||||
|| be_isupdate( op->o_bd, &op->o_ndn ) ) {
|
||||
|| be_isupdate( op ) ) {
|
||||
np = (Entry *)&slap_entry_root;
|
||||
|
||||
/* check parent for "children" acl */
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ ldap_back_add(
|
|||
dc.ctx = "addAttrDN";
|
||||
#endif
|
||||
|
||||
isupdate = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
isupdate = be_isupdate( op );
|
||||
for (i=0, a=op->oq_add.rs_e->e_attrs; a; a=a->a_next) {
|
||||
if ( !isupdate && a->a_desc->ad_type->sat_no_user_mod ) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ ldap_back_modify(
|
|||
dc.ctx = "modifyAttrDN";
|
||||
#endif
|
||||
|
||||
isupdate = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
isupdate = be_isupdate( op );
|
||||
for (i=0, ml=op->oq_modify.rs_modlist; ml; ml=ml->sml_next) {
|
||||
int is_oc = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ ldbm_back_delete(
|
|||
} else {
|
||||
/* no parent, must be root to delete */
|
||||
if( ! be_isroot( op ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op->o_bd, &op->o_ndn ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op ) ) {
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
rc = access_allowed( op, p,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ ldbm_back_modrdn(
|
|||
/* no parent, must be root to modify rdn */
|
||||
isroot = be_isroot( op );
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op->o_bd, &op->o_ndn ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op ) ) {
|
||||
int can_access;
|
||||
p = (Entry *)&slap_entry_root;
|
||||
|
||||
|
|
@ -422,7 +422,7 @@ ldbm_back_modrdn(
|
|||
}
|
||||
|
||||
if ( ! isroot ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op->o_bd, &op->o_ndn ) ) {
|
||||
if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv ) || be_isupdate( op ) ) {
|
||||
int can_access;
|
||||
np = (Entry *)&slap_entry_root;
|
||||
|
||||
|
|
|
|||
|
|
@ -728,7 +728,13 @@ be_isroot_dn( Backend *be, struct berval *ndn )
|
|||
}
|
||||
|
||||
int
|
||||
be_isupdate( Backend *be, struct berval *ndn )
|
||||
be_isupdate( Operation *op )
|
||||
{
|
||||
return be_isupdate_dn( op->o_bd, &op->o_ndn );
|
||||
}
|
||||
|
||||
int
|
||||
be_isupdate_dn( Backend *be, struct berval *ndn )
|
||||
{
|
||||
if ( !ndn->bv_len ) {
|
||||
return( 0 );
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ do_delete(
|
|||
*/
|
||||
if ( op->o_bd->be_delete ) {
|
||||
/* do the update here */
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ do_modify(
|
|||
*/
|
||||
if ( op->o_bd->be_modify ) {
|
||||
/* do the update here */
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
|
||||
/* Multimaster slapd does not have to check for replicator dn
|
||||
* because it accepts each modify request
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ do_modrdn(
|
|||
*/
|
||||
if ( op->o_bd->be_modrdn ) {
|
||||
/* do the update here */
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
if ( !SLAP_SHADOW(op->o_bd) || repl_user )
|
||||
#else
|
||||
|
|
@ -483,7 +483,7 @@ slap_modrdn2mods(
|
|||
assert( new_rdn != NULL );
|
||||
assert( !op->orr_deleteoldrdn || old_rdn != NULL );
|
||||
|
||||
repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
repl_user = be_isupdate( op );
|
||||
|
||||
/* Add new attribute values to the entry */
|
||||
for ( a_cnt = 0; new_rdn[a_cnt]; a_cnt++ ) {
|
||||
|
|
|
|||
|
|
@ -1235,17 +1235,19 @@ ppolicy_add(
|
|||
static int
|
||||
ppolicy_modify( Operation *op, SlapReply *rs )
|
||||
{
|
||||
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
|
||||
int i, rc, mod_pw_only, pwmod, pwmop, deladd, hsize = 0;
|
||||
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
|
||||
int i, rc, mod_pw_only, pwmod, pwmop, deladd,
|
||||
hsize = 0;
|
||||
PassPolicy pp;
|
||||
Modifications *mods = NULL, *modtail, *ml, *delmod, *addmod;
|
||||
Modifications *mods = NULL, *modtail, *ml, *delmod, *addmod;
|
||||
Attribute *pa, *ha, *ra, at;
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
const char *txt;
|
||||
pw_hist *tl = NULL, *p;
|
||||
int zapReset, send_ctrl = 0;
|
||||
int zapReset, send_ctrl = 0;
|
||||
Entry *e;
|
||||
struct berval newpw = { 0, NULL }, oldpw = { 0, NULL }, *bv, cr[2];
|
||||
struct berval newpw = { 0, NULL }, oldpw = { 0, NULL },
|
||||
*bv, cr[2];
|
||||
LDAPPasswordPolicyError pErr = PP_noError;
|
||||
|
||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ rwm_add( Operation *op, SlapReply *rs )
|
|||
}
|
||||
|
||||
/* Count number of attributes in entry */
|
||||
isupdate = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
isupdate = be_isupdate( op );
|
||||
for ( i = 0, ap = &op->oq_add.rs_e->e_attrs; *ap; ) {
|
||||
struct berval mapped;
|
||||
Attribute *a;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ int passwd_extop(
|
|||
|
||||
#ifndef SLAPD_MULTIMASTER
|
||||
/* This does not apply to multi-master case */
|
||||
if(!( !SLAP_SHADOW( op->o_bd ) || be_isupdate( op->o_bd, &op->o_ndn ))) {
|
||||
if(!( !SLAP_SHADOW( op->o_bd ) || be_isupdate( op ))) {
|
||||
/* we SHOULD return a referral in this case */
|
||||
BerVarray defref = op->o_bd->be_update_refs
|
||||
? op->o_bd->be_update_refs : default_referral;
|
||||
|
|
|
|||
|
|
@ -225,7 +225,8 @@ LDAP_SLAPD_F (int) be_issuffix LDAP_P(( Backend *be,
|
|||
LDAP_SLAPD_F (int) be_isroot LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_isroot_dn LDAP_P(( Backend *be, struct berval *ndn ));
|
||||
LDAP_SLAPD_F (int) be_isroot_pw LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_isupdate LDAP_P(( Backend *be, struct berval *ndn ));
|
||||
LDAP_SLAPD_F (int) be_isupdate LDAP_P(( Operation *op ));
|
||||
LDAP_SLAPD_F (int) be_isupdate_dn LDAP_P(( Backend *be, struct berval *ndn ));
|
||||
LDAP_SLAPD_F (struct berval *) be_root_dn LDAP_P(( Backend *be ));
|
||||
LDAP_SLAPD_F (int) be_entry_get_rw LDAP_P(( struct slap_op *o,
|
||||
struct berval *ndn, ObjectClass *oc,
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ slapi_int_ldapmod_to_entry(
|
|||
if ( op->o_bd == NULL ) {
|
||||
rc = LDAP_PARTIAL_RESULTS;
|
||||
} else {
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_bd->be_rootdn );
|
||||
int repl_user = be_isupdate_dn( op->o_bd, &op->o_bd->be_rootdn );
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
|
||||
int update = op->o_bd->be_update_ndn.bv_len;
|
||||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
|
|
@ -557,7 +557,7 @@ slapi_delete_internal(
|
|||
op->o_ndn = pConn->c_ndn = op->o_bd->be_rootndn;
|
||||
|
||||
if ( op->o_bd->be_delete ) {
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
|
||||
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
|
||||
if ( log_change ) op->o_callback = &cb;
|
||||
|
|
@ -636,7 +636,7 @@ slapi_int_add_entry_locked(
|
|||
op->oq_add.rs_e = *e;
|
||||
|
||||
if ( op->o_bd->be_add ) {
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
|
||||
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
|
||||
if ( log_changes ) op->o_callback = &cb;
|
||||
|
|
@ -827,7 +827,7 @@ slapi_modrdn_internal(
|
|||
op->oq_modrdn.rs_deleteoldrdn = deloldrdn;
|
||||
|
||||
if ( op->o_bd->be_modrdn ) {
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
|
||||
slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
|
||||
if ( log_change ) op->o_callback = &cb;
|
||||
|
|
@ -1018,7 +1018,7 @@ slapi_modify_internal(
|
|||
op->oq_modify.rs_modlist = modlist;
|
||||
|
||||
if ( op->o_bd->be_modify ) {
|
||||
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
int repl_user = be_isupdate( op );
|
||||
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
|
||||
int update = op->o_bd->be_update_ndn.bv_len;
|
||||
const char *text = NULL;
|
||||
|
|
|
|||
|
|
@ -2462,7 +2462,7 @@ int slapi_int_pblock_set_operation( Slapi_PBlock *pb, Operation *op )
|
|||
|
||||
if ( op->o_bd != NULL ) {
|
||||
isRoot = be_isroot( op );
|
||||
isUpdateDn = be_isupdate( op->o_bd, &op->o_ndn );
|
||||
isUpdateDn = be_isupdate( op );
|
||||
}
|
||||
|
||||
rc = slapi_int_pblock_set_backend( pb, op->o_bd );
|
||||
|
|
|
|||
Loading…
Reference in a new issue