ACL checks when modifying user-modifiable attributes as non-root user.
}
for ( ; mlist != NULL; mlist = mlist->sml_next ) {
+ /*
+ * Internal mods are ignored by ACL_WRITE checking
+ */
+ if ( mlist->sml_flags & SLAP_MOD_INTERNAL ) {
+ Debug( LDAP_DEBUG_ACL, "acl: internal mod %s:"
+ " modify access granted\n",
+ mlist->sml_desc->ad_cname.bv_val, 0, 0 );
+ continue;
+ }
+
/*
* no-user-modification operational attributes are ignored
* by ACL_WRITE checking as any found here are not provided
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = LDAP_MOD_ADD;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod = (Modifications *) malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE;
+ mod->sml_flags = 0;
mod->sml_type = a_new_desc->ad_cname;
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = mop;
+ mod->sml_flags = 0;
mod->sml_type = tmp.sml_type;
mod->sml_values = tmp.sml_values;
mod->sml_nvalues = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
mod->sml_values =
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_entryUUID;
mod->sml_values =
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_creatorsName;
mod->sml_values =
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_createTimestamp;
mod->sml_values =
if ( SLAP_LASTMOD( op->o_bd )) {
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_entryCSN;
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_modifiersName;
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
mod->sml_op = mop;
+ mod->sml_flags = SLAP_MOD_INTERNAL;
mod->sml_type.bv_val = NULL;
mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
mod->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
mod_tmp->sml_nvalues = NULL;
}
mod_tmp->sml_op = SLAP_MOD_SOFTADD;
+ mod_tmp->sml_flags = SLAP_MOD_INTERNAL;
mod_tmp->sml_next = mod;
mod = mod_tmp;
}
mod_tmp->sml_nvalues = NULL;
}
mod_tmp->sml_op = LDAP_MOD_DELETE;
+ mod_tmp->sml_flags = SLAP_MOD_INTERNAL;
mod_tmp->sml_next = mod;
mod = mod_tmp;
}
vals[1].bv_val = NULL;
vals[1].bv_len = 0;
mod.sml_op = LDAP_MOD_DELETE;
+ mod.sml_flags = 0;
mod.sml_desc = ad_queryid;
mod.sml_type = ad_queryid->ad_cname;
mod.sml_values = vals;
m = ch_calloc( sizeof(Modifications), 1 );
m->sml_op = LDAP_MOD_DELETE;
+ m->sml_flags = 0;
m->sml_type = ad_pwdAccountLockedTime->ad_cname;
m->sml_desc = ad_pwdAccountLockedTime;
m->sml_next = *mod;
m = ch_calloc( sizeof(Modifications), 1 );
m->sml_op = LDAP_MOD_ADD;
+ m->sml_flags = 0;
m->sml_type = ad_pwdFailureTime->ad_cname;
m->sml_desc = ad_pwdFailureTime;
m->sml_values = ch_calloc( sizeof(struct berval), 2 );
*/
m = ch_calloc( sizeof(Modifications), 1 );
m->sml_op = LDAP_MOD_REPLACE;
+ m->sml_flags = 0;
m->sml_type = ad_pwdAccountLockedTime->ad_cname;
m->sml_desc = ad_pwdAccountLockedTime;
m->sml_values = ch_calloc( sizeof(struct berval), 2 );
if ( attr_find( e->e_attrs, ad_pwdFailureTime )) {
m = ch_calloc( sizeof(Modifications), 1 );
m->sml_op = LDAP_MOD_DELETE;
+ m->sml_flags = 0;
m->sml_type = ad_pwdFailureTime->ad_cname;
m->sml_desc = ad_pwdFailureTime;
m->sml_next = mod;
*/
m = ch_calloc( sizeof(Modifications), 1 );
m->sml_op = LDAP_MOD_ADD;
+ m->sml_flags = 0;
m->sml_type = ad_pwdGraceUseTime->ad_cname;
m->sml_desc = ad_pwdGraceUseTime;
m->sml_values = ch_calloc( sizeof(struct berval), 2 );
if (pp.pwdSafeModify && oldpw.bv_val ) {
ml = (Modifications *) ch_malloc( sizeof( Modifications ) );
ml->sml_op = LDAP_MOD_DELETE;
+ ml->sml_flags = SLAP_MOD_INTERNAL;
ml->sml_desc = pp.ad;
ml->sml_type = pp.ad->ad_cname;
ml->sml_values = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
mods->sml_op = LDAP_MOD_DELETE;
mods->sml_values = NULL;
}
+ mods->sml_flags = SLAP_MOD_INTERNAL;
mods->sml_nvalues = NULL;
mods->sml_next = NULL;
modtail->sml_next = mods;
if (attr_find(e->e_attrs, ad_pwdGraceUseTime )) {
mods = (Modifications *) ch_malloc( sizeof( Modifications ) );
mods->sml_op = LDAP_MOD_DELETE;
+ mods->sml_flags = SLAP_MOD_INTERNAL;
mods->sml_type.bv_val = NULL;
mods->sml_desc = ad_pwdGraceUseTime;
mods->sml_values = NULL;
if ((zapReset) && (attr_find(e->e_attrs, ad_pwdReset ))) {
mods = (Modifications *) ch_malloc( sizeof( Modifications ) );
mods->sml_op = LDAP_MOD_DELETE;
+ mods->sml_flags = SLAP_MOD_INTERNAL;
mods->sml_type.bv_val = NULL;
mods->sml_desc = ad_pwdReset;
mods->sml_values = NULL;
*/
mods = (Modifications *) ch_malloc( sizeof( Modifications ) );
mods->sml_op = LDAP_MOD_DELETE;
+ mods->sml_flags = SLAP_MOD_INTERNAL;
mods->sml_type.bv_val = NULL;
mods->sml_desc = ad_pwdHistory;
mods->sml_nvalues = NULL;
if ((pa = attr_find( e->e_attrs, pp.ad )) != NULL) {
mods = (Modifications *) ch_malloc( sizeof( Modifications ) );
mods->sml_op = LDAP_MOD_ADD;
+ mods->sml_flags = SLAP_MOD_INTERNAL;
mods->sml_type.bv_val = NULL;
mods->sml_desc = ad_pwdHistory;
mods->sml_nvalues = NULL;
mp->sml_values[1].bv_val = mp->sml_nvalues[1].bv_val = NULL;
mp->sml_op = LDAP_MOD_ADD;
+ mp->sml_flags = 0;
ber_dupbv(&mp->sml_values[0], &dd->nothing);
ber_dupbv(&mp->sml_nvalues[0], &dd->nnothing);
mp->sml_next = ma;
mp->sml_values[1].bv_len = mp->sml_nvalues[1].bv_len = 0;
mp->sml_values[1].bv_val = mp->sml_nvalues[1].bv_val = NULL;
mp->sml_op = LDAP_MOD_DELETE;
+ mp->sml_flags = 0;
ber_dupbv(&mp->sml_values[0], &dd->dn);
ber_dupbv(&mp->sml_nvalues[0], &mp->sml_values[0]);
mp->sml_next = ma;
}
mp = ch_malloc(sizeof(Modifications));
mp->sml_op = LDAP_MOD_ADD;
+ mp->sml_flags = 0;
mp->sml_desc = ia->attr; /* XXX */
mp->sml_type = ia->attr->ad_cname;
mp->sml_values = ch_malloc(2 * sizeof(BerValue));
ip->mm = mp;
mp = ch_malloc(sizeof(Modifications));
mp->sml_op = LDAP_MOD_DELETE;
+ mp->sml_flags = 0;
mp->sml_desc = ia->attr; /* XXX */
mp->sml_type = ia->attr->ad_cname;
mp->sml_values = ch_malloc(2 * sizeof(BerValue));
mod.sml_nvalues = NULL;
mod.sml_desc = slap_schema.si_ad_contextCSN;
mod.sml_op = LDAP_MOD_REPLACE;
+ mod.sml_flags = 0;
mod.sml_next = NULL;
cb.sc_response = slap_null_cb;
ml->sml_nvalues = NULL;
ml->sml_desc = slap_schema.si_ad_userPassword;
ml->sml_op = LDAP_MOD_REPLACE;
+ ml->sml_flags = 0;
ml->sml_next = qpw->rs_mods;
qpw->rs_mods = ml;
for (i=0; pr[i].name; i++) {
mod = (Modifications *)ch_malloc( sizeof(Modifications) );
mod->sml_op = LDAP_MOD_REPLACE;
+ mod->sml_flags = 0;
ber_str2bv( pr[i].name, 0, 0, &mod->sml_type );
mod->sml_values = (struct berval *)ch_malloc( (pr[i].nvalues + 1) *
sizeof(struct berval));
* A list of LDAPMods
*/
typedef struct slap_mod {
- int sm_op;
+ short sm_op;
+ short sm_flags;
+/* Set for internal mods, will bypass ACL checks. Only needed when
+ * running as non-root user, for user modifiable attributes.
+ */
+#define SLAP_MOD_INTERNAL 0x01
+
AttributeDescription *sm_desc;
struct berval sm_type;
BerVarray sm_values;
typedef struct slap_mod_list {
Modification sml_mod;
#define sml_op sml_mod.sm_op
+#define sml_flags sml_mod.sm_flags
#define sml_desc sml_mod.sm_desc
#define sml_type sml_mod.sm_type
#define sml_values sml_mod.sm_values
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = LDAP_MOD_ADD;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = LDAP_MOD_ADD;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod = (Modifications *)ch_malloc( sizeof(Modifications) );
mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = pMod->mod_op & LDAP_MOD_OP;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
char textbuf[SLAP_TEXT_BUFLEN];
mod.sm_op = LDAP_MOD_ADD;
+ mod.sm_flags = 0;
mod.sm_desc = NULL;
mod.sm_type.bv_val = (char *)type;
mod.sm_type.bv_len = strlen( type );
char textbuf[SLAP_TEXT_BUFLEN];
mod.sm_op = LDAP_MOD_DELETE;
+ mod.sm_flags = 0;
mod.sm_desc = NULL;
mod.sm_type.bv_val = (char *)type;
mod.sm_type.bv_len = strlen( type );
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = (*modp)->mod_op & (~LDAP_MOD_BVALUES);
+ mod->sml_flags = 0;
mod->sml_type.bv_val = (*modp)->mod_type;
mod->sml_type.bv_len = strlen( mod->sml_type.bv_val );
mod->sml_desc = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
for ( i = 0; i < dni.attrs; i++ ) {
mod = ch_malloc( sizeof( Modifications ) );
mod->sml_op = LDAP_MOD_DELETE;
+ mod->sml_flags = 0;
mod->sml_desc = dni.ads[i];
mod->sml_type = mod->sml_desc->ad_cname;
mod->sml_values = NULL;
mod = (Modifications *)ch_calloc(1, sizeof(Modifications));
mod->sml_op = LDAP_MOD_REPLACE;
+ mod->sml_flags = 0;
mod->sml_desc = slap_schema.si_ad_entryUUID;
mod->sml_type = mod->sml_desc->ad_cname;
ber_dupbv( &uuid_bv, &syncUUID_strrep );
if ( rs_delete.sr_err == LDAP_NOT_ALLOWED_ON_NONLEAF ) {
Modifications mod1, mod2;
mod1.sml_op = LDAP_MOD_REPLACE;
+ mod1.sml_flags = 0;
mod1.sml_desc = slap_schema.si_ad_objectClass;
mod1.sml_type = mod1.sml_desc->ad_cname;
mod1.sml_values = &gcbva[0];
mod1.sml_next = &mod2;
mod2.sml_op = LDAP_MOD_REPLACE;
+ mod2.sml_flags = 0;
mod2.sml_desc = slap_schema.si_ad_structuralObjectClass;
mod2.sml_type = mod2.sml_desc->ad_cname;
mod2.sml_values = &gcbva[1];