Permissive support for LDAP_MOD_INCREMENT -- treat absence of attribute

as if attribute existed with a value of 0
This commit is contained in:
Luke Howard 2006-01-19 22:06:24 +00:00
parent 17dbef6ba8
commit f341270a46

View File

@ -377,12 +377,20 @@ modify_increment_values(
a = attr_find( e->e_attrs, mod->sm_desc ); a = attr_find( e->e_attrs, mod->sm_desc );
if( a == NULL ) { if( a == NULL ) {
if ( permissive ) {
Modification modReplace = *mod;
modReplace.sm_op = LDAP_MOD_REPLACE;
return modify_add_values(e, &modReplace, permissive, text, textbuf, textlen);
} else {
*text = textbuf; *text = textbuf;
snprintf( textbuf, textlen, snprintf( textbuf, textlen,
"modify/increment: %s: no such attribute", "modify/increment: %s: no such attribute",
mod->sm_desc->ad_cname.bv_val ); mod->sm_desc->ad_cname.bv_val );
return LDAP_NO_SUCH_ATTRIBUTE; return LDAP_NO_SUCH_ATTRIBUTE;
} }
}
if ( !strcmp( a->a_desc->ad_type->sat_syntax_oid, SLAPD_INTEGER_SYNTAX )) { if ( !strcmp( a->a_desc->ad_type->sat_syntax_oid, SLAPD_INTEGER_SYNTAX )) {
int i; int i;