From 83e70bb5554e3c57a27807efb683d40303d3e6e6 Mon Sep 17 00:00:00 2001 From: "Thierry bordaz (tbordaz)" Date: Mon, 26 Jan 2015 11:48:57 +0100 Subject: [PATCH] Ticket 47988: follow up --- ldap/servers/slapd/schema.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c index af52081..bade27c 100644 --- a/ldap/servers/slapd/schema.c +++ b/ldap/servers/slapd/schema.c @@ -2478,16 +2478,12 @@ schema_delete_objectclasses( Slapi_Entry *entryBefore, LDAPMod *mod, struct objclass *poc, *poc2, *delete_oc = NULL; if ( NULL == mod->mod_bvalues ) { - if (is_internal_operation) { - slapi_log_error(SLAPI_LOG_REPL, "schema", "schema_delete_objectclasses: Remove all objectclass in Internal op\n"); - } else { - schema_create_errormsg(errorbuf, errorbufsize, schema_errprefix_oc, - NULL, "Cannot remove all schema object classes"); - return LDAP_UNWILLING_TO_PERFORM; - } + schema_create_errormsg(errorbuf, errorbufsize, schema_errprefix_oc, + NULL, "Cannot remove all schema object classes"); + return LDAP_UNWILLING_TO_PERFORM; } - for (i = 0; mod->mod_bvalues && mod->mod_bvalues[i]; i++) { + for (i = 0; mod->mod_bvalues[i]; i++) { if ( LDAP_SUCCESS != ( rc = parse_oc_str ( (const char *)mod->mod_bvalues[i]->bv_val, &delete_oc, errorbuf, errorbufsize, 0, 0, schema_ds4x_compat, NULL))) { @@ -2590,17 +2586,13 @@ schema_delete_attributes ( Slapi_Entry *entryBefore, LDAPMod *mod, struct sizedbuffer *psbAttrSyntax= sizedbuffer_construct(BUFSIZ); if (NULL == mod->mod_bvalues) { - if (is_internal_operation) { - slapi_log_error(SLAPI_LOG_REPL, "schema", "schema_delete_attributes: Remove all attributetypes in Internal op\n"); - } else { - schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, - NULL, "Cannot remove all schema attribute types" ); - return schema_return(LDAP_UNWILLING_TO_PERFORM,psbAttrOid,psbAttrName, - psbAttrSyntax,NULL); - } + schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, + NULL, "Cannot remove all schema attribute types" ); + return schema_return(LDAP_UNWILLING_TO_PERFORM,psbAttrOid,psbAttrName, + psbAttrSyntax,NULL); } - for (i = 0; mod->mod_bvalues && mod->mod_bvalues[i]; i++) { + for (i = 0; mod->mod_bvalues[i]; i++) { attr_ldif =(char *) mod->mod_bvalues[i]->bv_val; /* normalize the attr ldif */ @@ -6343,6 +6335,7 @@ schema_oc_to_string(struct objclass *oc) char *oc_str; int i; int size = 0; + char *x_origin = {" X-ORIGIN 'blahblahblah'"}; /* Compute the size of the string that can contain * the oc definition and allocates it @@ -6364,7 +6357,14 @@ schema_oc_to_string(struct objclass *oc) } size += strlen(schema_oc_kind_strings_with_spaces[oc->oc_kind]); - size += 128; /* for all keywords: NAME, DESC, SUP... */ + /* all keywords: NAME, DESC, SUP... */ + size = size + strlen("NAME") + 6; + size = size + strlen("DESC") + 4; + size = size + strlen("SUP") + 4; + size = size + strlen("MUST") + 7; + size = size + strlen("MAY") + 7; + size += strlen(x_origin); + size += 128; /* Just to be sure */ if ((oc_str = (char *) slapi_ch_calloc(1, size)) == NULL) { return NULL; } @@ -6415,7 +6415,7 @@ schema_oc_to_string(struct objclass *oc) /* flags */ if (oc->oc_flags & OC_FLAG_USER_OC) { - strcat(oc_str, " X-ORIGIN 'blahblahblah'"); + strcat(oc_str, x_origin); } strcat(oc_str, " )"); -- 1.7.11.7