From af5f617d2a99afbb165fdb023a9938ed0607f85a Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 25 Apr 2003 00:14:54 +0000 Subject: [PATCH] cleanup --- servers/slapd/add.c | 24 +++++++++++++++--------- servers/slapd/modify.c | 14 ++++++++++---- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/servers/slapd/add.c b/servers/slapd/add.c index c1557adf8e..b9ce04c16a 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -133,7 +133,8 @@ do_add( Operation *op, SlapReply *rs ) Debug( LDAP_DEBUG_ANY, "no values for type %s\n", tmp.sml_type.bv_val, 0, 0 ); #endif - send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "no values for attribute type" ); + send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, + "no values for attribute type" ); goto done; } @@ -172,7 +173,8 @@ do_add( Operation *op, SlapReply *rs ) } if ( modlist == NULL ) { - send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "no attributes provided" ); + send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, + "no attributes provided" ); goto done; } @@ -181,11 +183,13 @@ do_add( Operation *op, SlapReply *rs ) if( e->e_nname.bv_len == 0 ) { /* protocolError may be a more appropriate error */ - send_ldap_error( op, rs, LDAP_ALREADY_EXISTS, "root DSE already exists" ); + send_ldap_error( op, rs, LDAP_ALREADY_EXISTS, + "root DSE already exists" ); goto done; } else if ( bvmatch( &e->e_nname, &global_schemandn ) ) { - send_ldap_error( op, rs, LDAP_ALREADY_EXISTS, "subschema subentry already exists" ); + send_ldap_error( op, rs, LDAP_ALREADY_EXISTS, + "subschema subentry already exists" ); goto done; } @@ -205,7 +209,9 @@ do_add( Operation *op, SlapReply *rs ) rs->sr_err = LDAP_REFERRAL; send_ldap_result( op, rs ); - if ( rs->sr_ref != default_referral ) ber_bvarray_free( rs->sr_ref ); + if ( rs->sr_ref != default_referral ) { + ber_bvarray_free( rs->sr_ref ); + } } else { send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, "referral missing" ); @@ -337,9 +343,9 @@ do_add( Operation *op, SlapReply *rs ) #ifdef LDAP_SLAPI rs->sr_err = doPreAddPluginFNs( op ); if ( rs->sr_err != LDAP_SUCCESS ) { - /* plugin will have sent result */ - goto done; - } + /* plugin will have sent result */ + goto done; + } #endif #ifdef NEW_LOGGING LDAP_LOG( OPERATION, INFO, @@ -348,7 +354,7 @@ do_add( Operation *op, SlapReply *rs ) Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 ); #endif send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, - "operation not supported within namingContext" ); + "operation not supported within namingContext" ); } #ifdef LDAP_SLAPI diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index a04d49a61c..df5c60d6e8 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -150,7 +150,8 @@ do_modify( default: { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ERR, - "do_modify: invalid modify operation (%ld)\n", (long)mop, 0, 0 ); + "do_modify: invalid modify operation (%ld)\n", + (long)mop, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "do_modify: invalid modify operation (%ld)\n", @@ -177,7 +178,8 @@ do_modify( goto cleanup; } - rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx ); + rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, + op->o_tmpmemctx ); if( rs->sr_err != LDAP_SUCCESS ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n", @@ -296,7 +298,8 @@ do_modify( * appropriate one, or send a referral to our "referral server" * if we don't hold it. */ - if ( (op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 )) == NULL ) { + op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 ); + if ( op->o_bd == NULL ) { rs->sr_ref = referral_rewrite( default_referral, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); if (!rs->sr_ref) rs->sr_ref = default_referral; @@ -628,7 +631,9 @@ int slap_mods_check( if( nvals && ad->ad_type->sat_equality && ad->ad_type->sat_equality->smr_normalize ) { - ml->sml_nvalues = ber_memalloc_x( (nvals+1)*sizeof(struct berval), ctx ); + ml->sml_nvalues = ber_memalloc_x( + (nvals+1)*sizeof(struct berval), ctx ); + for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) { rc = ad->ad_type->sat_equality->smr_normalize( 0, @@ -652,6 +657,7 @@ int slap_mods_check( return rc; } } + ml->sml_nvalues[nvals].bv_val = NULL; ml->sml_nvalues[nvals].bv_len = 0; } -- 2.39.5