- Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
-
- /* collect modifications & save for later */
- for ( tag = ber_first_element( op->o_ber, &len, &last );
- tag != LBER_DEFAULT;
- tag = ber_next_element( op->o_ber, &len, last ) )
- {
- ber_int_t mop;
- Modifications tmp, *mod;
-
- tmp.sml_nvalues = NULL;
-
- if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
- &tmp.sml_type, &tmp.sml_values ) == LBER_ERROR )
- {
- send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR,
- "decoding modlist error" );
- rs->sr_err = SLAPD_DISCONNECT;
- goto cleanup;
- }
-
- mod = (Modifications *) ch_malloc( sizeof(Modifications) );
- mod->sml_op = mop;
- mod->sml_flags = 0;
- mod->sml_type = tmp.sml_type;
- mod->sml_values = tmp.sml_values;
- mod->sml_nvalues = NULL;
- mod->sml_desc = NULL;
- mod->sml_next = NULL;
- *modtail = mod;
-
- switch( mop ) {
- case LDAP_MOD_ADD:
- if ( mod->sml_values == NULL ) {
- Debug( LDAP_DEBUG_ANY,
- "do_modify: modify/add operation (%ld) requires values\n",
- (long) mop, 0, 0 );
-
- send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
- "modify/add operation requires values" );
- goto cleanup;
- }
-
- /* fall through */
-
- case LDAP_MOD_DELETE:
- case LDAP_MOD_REPLACE:
- break;
-
- case LDAP_MOD_INCREMENT:
- if( op->o_protocol >= LDAP_VERSION3 ) {
- increment++;
- if ( mod->sml_values == NULL ) {
- Debug( LDAP_DEBUG_ANY, "do_modify: "
- "modify/increment operation (%ld) requires value\n",
- (long) mop, 0, 0 );
-
- send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
- "modify/increment operation requires value" );
- goto cleanup;
- }
-
- if( mod->sml_values[1].bv_val ) {
- Debug( LDAP_DEBUG_ANY, "do_modify: modify/increment "
- "operation (%ld) requires single value\n",
- (long) mop, 0, 0 );
-
- send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
- "modify/increment operation requires single value" );
- goto cleanup;
- }
-
- break;
- }
- /* fall thru */
-
- default: {
- Debug( LDAP_DEBUG_ANY,
- "do_modify: unrecognized modify operation (%ld)\n",
- (long) mop, 0, 0 );