From f341270a46b701f310355cadfe5450e7a94bea0f Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Thu, 19 Jan 2006 22:06:24 +0000 Subject: [PATCH] Permissive support for LDAP_MOD_INCREMENT -- treat absence of attribute as if attribute existed with a value of 0 --- servers/slapd/mods.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/servers/slapd/mods.c b/servers/slapd/mods.c index 76bb81f51e..f1dbdffcb8 100644 --- a/servers/slapd/mods.c +++ b/servers/slapd/mods.c @@ -377,11 +377,19 @@ modify_increment_values( a = attr_find( e->e_attrs, mod->sm_desc ); if( a == NULL ) { - *text = textbuf; - snprintf( textbuf, textlen, - "modify/increment: %s: no such attribute", - mod->sm_desc->ad_cname.bv_val ); - return LDAP_NO_SUCH_ATTRIBUTE; + if ( permissive ) { + Modification modReplace = *mod; + + modReplace.sm_op = LDAP_MOD_REPLACE; + + return modify_add_values(e, &modReplace, permissive, text, textbuf, textlen); + } else { + *text = textbuf; + snprintf( textbuf, textlen, + "modify/increment: %s: no such attribute", + mod->sm_desc->ad_cname.bv_val ); + return LDAP_NO_SUCH_ATTRIBUTE; + } } if ( !strcmp( a->a_desc->ad_type->sat_syntax_oid, SLAPD_INTEGER_SYNTAX )) { -- 2.39.5