From dd6870515be327e946538fb33222640c08dbe305 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 27 Feb 2003 00:41:46 +0000 Subject: [PATCH] quick fix to allow -DSLAP_NVALUES with -DLDAP_SLAPI --- servers/slapd/slapi/slapi_ops.c | 27 +++++++++++++++++++++++++++ servers/slapd/slapi/slapi_utils.c | 13 ++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/servers/slapd/slapi/slapi_ops.c b/servers/slapd/slapi/slapi_ops.c index 304f32d20e..41da38de83 100644 --- a/servers/slapd/slapi/slapi_ops.c +++ b/servers/slapd/slapi/slapi_ops.c @@ -292,6 +292,9 @@ freeMods( Modifications *ml ) next = ml->sml_next; slapi_ch_free( (void **)&ml->sml_bvalues ); +#ifdef SLAP_NVALUES + slapi_ch_free( (void **)&ml->sml_nvalues ); +#endif slapi_ch_free( (void **)&ml ); } } @@ -356,6 +359,9 @@ LDAPModToEntry( tmp.sml_type.bv_val = pMod->mod_type; tmp.sml_type.bv_len = strlen( pMod->mod_type ); tmp.sml_bvalues = bv; +#ifdef SLAP_NVALUES + tmp.sml_nvalues = NULL; +#endif mod = (Modifications *) ch_malloc( sizeof(Modifications) ); @@ -364,6 +370,9 @@ LDAPModToEntry( mod->sml_desc = NULL; mod->sml_type = tmp.sml_type; mod->sml_bvalues = tmp.sml_bvalues; +#ifdef SLAP_NVALUES + mod->sml_nvalues = tmp.sml_nvalues; +#endif *modtail = mod; modtail = &mod->sml_next; @@ -379,6 +388,9 @@ LDAPModToEntry( tmp.sml_type.bv_val = pMod->mod_type; tmp.sml_type.bv_len = strlen( pMod->mod_type ); tmp.sml_bvalues = bv; +#ifdef SLAP_NVALUES + tmp.sml_nvalues = NULL; +#endif mod = (Modifications *) ch_malloc( sizeof(Modifications) ); @@ -387,6 +399,9 @@ LDAPModToEntry( mod->sml_desc = NULL; mod->sml_type = tmp.sml_type; mod->sml_bvalues = tmp.sml_bvalues; +#ifdef SLAP_NVALUES + mod->sml_nvalues = tmp.sml_nvalues; +#endif *modtail = mod; modtail = &mod->sml_next; @@ -932,6 +947,9 @@ slapi_modify_internal( tmp.sml_type.bv_val = pMod->mod_type; tmp.sml_type.bv_len = strlen( pMod->mod_type ); tmp.sml_bvalues = bv; +#ifdef SLAP_NVALUES + tmp.sml_nvalues = NULL; +#endif mod = (Modifications *)ch_malloc( sizeof(Modifications) ); @@ -940,12 +958,18 @@ slapi_modify_internal( mod->sml_desc = NULL; mod->sml_type = tmp.sml_type; mod->sml_bvalues = tmp.sml_bvalues; +#ifdef SLAP_NVALUES + mod->sml_nvalues = tmp.sml_nvalues; +#endif } else { rc = values2obj( pMod->mod_values, &bv ); if ( rc != LDAP_SUCCESS ) goto cleanup; tmp.sml_type.bv_val = pMod->mod_type; tmp.sml_type.bv_len = strlen( pMod->mod_type ); tmp.sml_bvalues = bv; +#ifdef SLAP_NVALUES + tmp.sml_nvalues = NULL; +#endif mod = (Modifications *) ch_malloc( sizeof(Modifications) ); @@ -954,6 +978,9 @@ slapi_modify_internal( mod->sml_desc = NULL; mod->sml_type = tmp.sml_type; mod->sml_bvalues = tmp.sml_bvalues; +#ifdef SLAP_NVALUES + mod->sml_nvalues = tmp.sml_nvalues; +#endif } *modtail = mod; modtail = &mod->sml_next; diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 77052eb3f8..d17c893b4c 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -556,15 +556,20 @@ slapi_entry_add_values( Slapi_Entry *e, const char *type, struct berval **vals ) } if ( vals == NULL ) { - /* Apparently vals can be NULL */ + /* Apparently vals can be NULL + * FIXME: sm_bvalues = NULL ? */ mod.sm_bvalues = (BerVarray)ch_malloc( sizeof(struct berval) ); mod.sm_bvalues->bv_val = NULL; + } else { rc = bvptr2obj( vals, &mod.sm_bvalues ); if ( rc != LDAP_SUCCESS ) { return LDAP_CONSTRAINT_VIOLATION; } } +#ifdef SLAP_NVALUES + mod.sm_nvalues = NULL; +#endif rc = modify_add_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) ); @@ -638,6 +643,9 @@ slapi_entry_delete_values( Slapi_Entry *e, const char *type, struct berval **val if ( rc != LDAP_SUCCESS ) { return LDAP_CONSTRAINT_VIOLATION; } +#if SLAP_NVALUES + mod.sm_nvalues = NULL; +#endif rc = modify_delete_values( e, &mod, 0, &text, textbuf, sizeof(textbuf) ); @@ -3144,6 +3152,9 @@ Modifications *slapi_x_ldapmods2modifications (LDAPMod **mods) } mod->sml_bvalues[i].bv_val = NULL; } +#ifdef SLAP_NVALUES + mod->sml_nvalues = NULL; +#endif *modtail = mod; modtail = &mod->sml_next;