{
int update = be->be_update_ndn != NULL;
const char *text;
- rc = slap_modlist2mods( modlist, update, &mods, &text );
+ char textbuf[SLAP_TEXT_BUFLEN];
+ size_t textlen = sizeof textbuf;
+
+ rc = slap_modlist2mods( modlist, update, &mods, &text,
+ textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
LDAPModList *ml,
int update,
Modifications **mods,
- const char **text )
+ const char **text,
+ char *textbuf, size_t textlen )
{
int rc;
Modifications **modtail = mods;
rc = slap_str2ad( ml->ml_type, &mod->sml_desc, text );
if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "modlist2mods: Attribute %s is undefined (%s)\n", ml->ml_type, text ));
-#endif
slap_mods_free( mod );
+ snprintf( textbuf, textlen, "%s: %s", ml->ml_type, text );
+ *text = textbuf;
return rc;
}
{
/* attribute requires binary transfer */
slap_mods_free( mod );
- *text = "attribute requires ;binary transfer";
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "modlist2mods: Attribute %s %s\n", ml->ml_type, text ));
-#endif
+
+ snprintf( textbuf, textlen,
+ "%s: requires ;binary transfer",
+ ml->ml_type );
+ *text = textbuf;
return LDAP_UNDEFINED_TYPE;
}
{
/* attribute requires binary transfer */
slap_mods_free( mod );
- *text = "attribute disallows ;binary transfer";
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "modlist2mods: Attribute %s %s\n", ml->ml_type, text ));
-#endif
+ snprintf( textbuf, textlen,
+ "%s: disallows ;binary transfer",
+ ml->ml_type );
+ *text = textbuf;
return LDAP_UNDEFINED_TYPE;
}
if (!update && is_at_no_user_mod( ad->ad_type )) {
/* user modification disallowed */
slap_mods_free( mod );
- *text = "no user modification allowed";
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "modlist2mods: Attribute %s %s\n", ml->ml_type, text ));
-#endif
+ snprintf( textbuf, textlen,
+ "%s: no user modification allowed",
+ ml->ml_type );
+ *text = textbuf;
return LDAP_CONSTRAINT_VIOLATION;
}
slap_mods_free( mod );
*text = "no validator for syntax";
+ snprintf( textbuf, textlen,
+ "%s: no validator for syntax %s",
+ ml->ml_type,
+ ad->ad_type->sat_syntax->ssyn_oid );
+ *text = textbuf;
return LDAP_INVALID_SYNTAX;
}
if( rc != 0 ) {
slap_mods_free( mod );
- *text = "value contains invalid data";
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "modlist2mods: value for attribute %s contains invalid data\n",
- ml->ml_type ));
-#endif
+ snprintf( textbuf, textlen,
+ "%s: value #%ld contains invalid data",
+ ml->ml_type, (long) nvals );
+ *text = textbuf;
return LDAP_INVALID_SYNTAX;
}
}
&& nvals > 1 && is_at_single_value( ad->ad_type ))
{
slap_mods_free( mod );
- *text = "multiple values provided";
+ snprintf( textbuf, textlen,
+ "%s: multiple value provided",
+ ml->ml_type );
+ *text = textbuf;
return LDAP_INVALID_SYNTAX;
}
}