]> git.sur5r.net Git - openldap/commitdiff
Fix: ldapadd with undefined objectclass causes assertion failure (ITS#3097)
authorKurt Zeilenga <kurt@openldap.org>
Mon, 19 Apr 2004 19:27:51 +0000 (19:27 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 19 Apr 2004 19:27:51 +0000 (19:27 +0000)
servers/slapd/add.c
servers/slapd/modify.c
servers/slapd/mods.c
servers/slapd/schema_prep.c

index f7bcc117fd1773e17c031310933b9788cdfe3a37..078bd73075540fe4df27eb98ea5767937cc38c69 100644 (file)
@@ -501,7 +501,7 @@ slap_mods2entry(
                                }
 
                        } else {
-                               int             rc = LDAP_SUCCESS;
+                               int     rc;
                                int match;
 
                                for ( i = 1; mods->sml_values[i].bv_val != NULL; i++ ) {
@@ -519,18 +519,19 @@ slap_mods2entry(
                                                                ? &mods->sml_nvalues[j]
                                                                : &mods->sml_values[j],
                                                        text );
+
                                                if ( rc == LDAP_SUCCESS && match == 0 ) {
                                                        /* value exists already */
                                                        snprintf( textbuf, textlen,
                                                                "%s: value #%d provided more than once",
                                                                mods->sml_desc->ad_cname.bv_val, j );
                                                        return LDAP_TYPE_OR_VALUE_EXISTS;
+
+                                               } else if ( rc != LDAP_SUCCESS ) {
+                                                       return rc;
                                                }
                                        }
                                }
-                               if ( rc != LDAP_SUCCESS ) {
-                                       return rc;
-                               }
                        }
                }
 
index b9e38eb17cbf962c23954affb69b0ac83616a6ca..eed665eda69c70d49a4eae93fefa774fd5c8958a 100644 (file)
@@ -790,7 +790,7 @@ int slap_mods_check(
                                        }
 
                                } else {
-                                       int rc = LDAP_SUCCESS;
+                                       int rc;
                                        int match;
 
                                        for ( i = 1; ml->sml_values[i].bv_val != NULL; i++ ) {
@@ -815,11 +815,12 @@ int slap_mods_check(
                                                                        ml->sml_desc->ad_cname.bv_val, j );
                                                                *text = textbuf;
                                                                return LDAP_TYPE_OR_VALUE_EXISTS;
+
+                                                       } else if ( rc != LDAP_SUCCESS ) {
+                                                               return rc;
                                                        }
                                                }
                                        }
-
-                                       if ( rc != LDAP_SUCCESS ) return rc;
                                }
                        }
 
index 7844d6381e6fc55e86327418a3673f53c7e0c295..8d91c20327e2355c8bafda8f193028c5087e9ff0 100644 (file)
@@ -110,6 +110,9 @@ modify_add_values(
                                                "modify/%s: %s: value #%d already exists",
                                                op, mod->sm_desc->ad_cname.bv_val, i );
                                        return LDAP_TYPE_OR_VALUE_EXISTS;
+
+                               } else if ( rc != LDAP_SUCCESS ) {
+                                       return rc;
                                }
                        }
 
index 4b6a56fac8b5ae7ec0ad30c230394e843bd5b333..e0b082ad07b6410080f5e88eb63a5c38c16d2334 100644 (file)
@@ -70,12 +70,12 @@ objectSubClassMatch(
                }
 
                /* desc form, return undefined */
-               return SLAPD_COMPARE_UNDEFINED;
+               return LDAP_INVALID_SYNTAX;
        }
 
        if ( oc == NULL ) {
                /* unrecognized stored value */
-               return SLAPD_COMPARE_UNDEFINED;
+               return LDAP_INVALID_SYNTAX;
        }
 
        if( SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX( flags ) ) {