]> git.sur5r.net Git - openldap/commitdiff
quick fix to allow -DSLAP_NVALUES with -DLDAP_SLAPI
authorPierangelo Masarati <ando@openldap.org>
Thu, 27 Feb 2003 00:41:46 +0000 (00:41 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 27 Feb 2003 00:41:46 +0000 (00:41 +0000)
servers/slapd/slapi/slapi_ops.c
servers/slapd/slapi/slapi_utils.c

index 304f32d20ee0e0898d3e9d6bd2508b9da251d67a..41da38de835024e03a19baf763591b527b068cc3 100644 (file)
@@ -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;
index 77052eb3f8abe5779f5e4c41a875e9574ce037e0..d17c893b4ce5057dccb8e456a671424b316d573b 100644 (file)
@@ -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;