]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/modify.c
silence warning
[openldap] / servers / slapd / modify.c
index a129cea82ab49055870ade6c1dac2db77c911ee9..14b6b37305ac2f5488f52ea352eeb33b4d50d678 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -89,7 +89,7 @@ do_modify(
        if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY, "%s do_modify: get_ctrls failed\n",
                        op->o_log_prefix, 0, 0 );
-               send_ldap_result( op, rs );
+               /* get_ctrls has sent results.  Now clean up. */
                goto cleanup;
        }
 
@@ -684,7 +684,7 @@ slap_sort_vals(
        AttributeDescription *ad;
        MatchingRule *mr;
        int istack[sizeof(int)*16];
-       int i, j, k, l, ir, jstack, match, *ix, itmp, nvals, rc;
+       int i, j, k, l, ir, jstack, match, *ix, itmp, nvals, rc = LDAP_SUCCESS;
        int is_norm;
        struct berval a, *cv;
 
@@ -705,6 +705,8 @@ slap_sort_vals(
 
        ad = ml->sml_desc;
        nvals = ml->sml_numvals;
+       if ( nvals <= 1 )
+               goto ret;
 
        /* For Modifications, sml_nvalues is NULL if normalization wasn't needed.
         * For Attributes, sml_nvalues == sml_values when normalization isn't needed.
@@ -834,15 +836,14 @@ slap_sort_vals(
 
        slap_sl_free( ix, ctx );
 
-       if ( rc != LDAP_SUCCESS ) {
-               return rc;
-       } else if ( match == 0 ) {
+       if ( rc == LDAP_SUCCESS && match == 0 ) {
                /* value exists already */
                assert( i >= 0 );
                assert( i < nvals );
-               return LDAP_TYPE_OR_VALUE_EXISTS;
+               rc = LDAP_TYPE_OR_VALUE_EXISTS;
        }
-       return LDAP_SUCCESS;
+ ret:
+       return rc;
 }
 
 /* Enter with bv->bv_len = sizeof buffer, returns with
@@ -878,6 +879,7 @@ void slap_mods_opattrs(
                for ( modtail = modsp; *modtail; modtail = &(*modtail)->sml_next ) {
                        if ( (*modtail)->sml_op != LDAP_MOD_ADD &&
                                (*modtail)->sml_op != SLAP_MOD_SOFTADD &&
+                               (*modtail)->sml_op != SLAP_MOD_ADD_IF_NOT_PRESENT &&
                                (*modtail)->sml_op != LDAP_MOD_REPLACE )
                        {
                                continue;