From cd84c58d4a4ecda7a0bcc5f8e8a0a51720b5ba45 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 19 Apr 2004 19:27:51 +0000 Subject: [PATCH] Fix: ldapadd with undefined objectclass causes assertion failure (ITS#3097) --- servers/slapd/add.c | 9 +++++---- servers/slapd/modify.c | 7 ++++--- servers/slapd/mods.c | 3 +++ servers/slapd/schema_prep.c | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/servers/slapd/add.c b/servers/slapd/add.c index f7bcc117fd..078bd73075 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -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; - } } } diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index b9e38eb17c..eed665eda6 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -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; } } diff --git a/servers/slapd/mods.c b/servers/slapd/mods.c index 7844d6381e..8d91c20327 100644 --- a/servers/slapd/mods.c +++ b/servers/slapd/mods.c @@ -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; } } diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 4b6a56fac8..e0b082ad07 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -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 ) ) { -- 2.39.5