From: Kurt Zeilenga Date: Sat, 19 Jan 2002 02:20:46 +0000 (+0000) Subject: Fix up duplicate error reporting X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~69 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ccc4e64f0ade00925f61d11823bc0237d9dd0946;p=openldap Fix up duplicate error reporting --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index d8e4deaacd..01e46267c2 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -29,7 +29,8 @@ static int slap_mods2entry( Modifications *mods, Entry **e, int repl_user, - const char **text ); + const char **text, + char *textbuf, size_t textlen ); int do_add( Connection *conn, Operation *op ) @@ -280,7 +281,8 @@ do_add( Connection *conn, Operation *op ) } } - rc = slap_mods2entry( modlist, &e, repl_user, &text ); + rc = slap_mods2entry( modlist, &e, repl_user, &text, + textbuf, textlen ); if( rc != LDAP_SUCCESS ) { send_ldap_result( conn, op, rc, NULL, text, NULL, NULL ); @@ -337,11 +339,14 @@ static int slap_mods2entry( Modifications *mods, Entry **e, int repl_user, - const char **text ) + const char **text, + char *textbuf, size_t textlen ) { Attribute **tail = &(*e)->e_attrs; assert( *tail == NULL ); + *text = textbuf; + for( ; mods != NULL; mods = mods->sml_next ) { Attribute *attr; @@ -356,7 +361,9 @@ static int slap_mods2entry( ber_len_t i,j; if( !repl_user ) { - *text = "attribute provided more than once"; + snprintf( textbuf, textlen, + "attribute '%s' provided more than once", + mods->sml_desc->ad_cname.bv_val ); return LDAP_TYPE_OR_VALUE_EXISTS; } @@ -382,7 +389,9 @@ static int slap_mods2entry( continue; #else - *text = "attribute provided more than once"; + snprintf( textbuf, textlen, + "attribute '%s' provided more than once", + mods->sml_desc->ad_cname.bv_val ); return LDAP_TYPE_OR_VALUE_EXISTS; #endif } @@ -402,6 +411,9 @@ static int slap_mods2entry( if( rc == 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; } } @@ -428,6 +440,9 @@ static int slap_mods2entry( if( rc == LDAP_SUCCESS && match == 0 ) { free( asserted.bv_val ); + snprintf( textbuf, textlen, + "%s: value #%d provided more than once", + mods->sml_desc->ad_cname.bv_val, j ); return LDAP_TYPE_OR_VALUE_EXISTS; } }