]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/modify.c
ITS#2884 silence warning. We don't dereference this pointer, we just use
[openldap] / servers / slapd / back-sql / modify.c
index 8b1a376673d9abce2a59132a8c2bb97971626655..15c2685805473c73f45e4fc7dca5ab82cea3db9d 100644 (file)
@@ -1,10 +1,21 @@
-/*
- *      Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1999-2003 The OpenLDAP Foundation.
+ * Portions Copyright 1999 Dmitry Kovalev.
+ * All rights reserved.
  *
- *      Redistribution and use in source and binary forms are permitted only
- *      as authorized by the OpenLDAP Public License.  A copy of this
- *      license is available at http://www.OpenLDAP.org/license.html or
- *      in file LICENSE in the top-level directory of the distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Dmitry Kovalev for inclusion
+ * by OpenLDAP Software.
  */
 
 #include "portable.h"
@@ -679,13 +690,14 @@ backsql_modrdn( Operation *op, SlapReply *rs )
                goto modrdn_return;
        }
 
-       build_new_dn( &new_dn, new_pdn, &op->oq_modrdn.rs_newrdn ); 
-       if ( dnNormalize2( NULL, &new_dn, &new_ndn ) != LDAP_SUCCESS ) {
+       build_new_dn( &new_dn, new_pdn, &op->oq_modrdn.rs_newrdn, NULL );
+       rs->sr_err = dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn,
+               op->o_tmpmemctx );
+       if ( rs->sr_err != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_TRACE, "backsql_modrdn(): "
                        "new dn is invalid ('%s') - aborting\n",
                        new_dn.bv_val, 0, 0 );
-               rs->sr_err = LDAP_INVALID_DN_SYNTAX;
-               rs->sr_text = "new DN is invalid";
+               rs->sr_text = "unable to build new DN";
                send_ldap_result( op, rs );
                goto modrdn_return;
        }
@@ -955,7 +967,7 @@ backsql_add( Operation *op, SlapReply *rs )
        }
 
        rs->sr_err = backsql_get_db_conn( op, &dbh );
-       if ( prc != LDAP_SUCCESS ) {
+       if ( rs->sr_err != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_TRACE, "backsql_add(): "
                        "could not get connection handle - exiting\n", 
                        0, 0, 0 );
@@ -1531,8 +1543,10 @@ backsql_delete( Operation *op, SlapReply *rs )
        SQLTransact( SQL_NULL_HENV, dbh, 
                        op->o_noop ? SQL_ROLLBACK : SQL_COMMIT );
 
+       rs->sr_err = LDAP_SUCCESS;
        send_ldap_result( op, rs );
        Debug( LDAP_DEBUG_TRACE, "<==backsql_delete()\n", 0, 0, 0 );
+
        return op->o_noop;
 }