-/*
- * 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"
struct berval p_dn, p_ndn,
*new_pdn = NULL, *new_npdn = NULL,
new_dn, new_ndn;
- LDAPRDN *new_rdn = NULL;
- LDAPRDN *old_rdn = NULL;
+ LDAPRDN new_rdn = NULL;
+ LDAPRDN old_rdn = NULL;
Entry e;
Modifications *mod;
struct berval *newSuperior = op->oq_modrdn.rs_newSup;
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;
}
LDAP_LOG ( OPERATION, RESULTS,
"backsql_modrdn: new_rdn_type=\"%s\", "
"new_rdn_val=\"%s\"\n",
- new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
- new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+ new_rdn[ 0 ]->la_attr.bv_val,
+ new_rdn[ 0 ]->la_value.bv_val, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"backsql_modrdn: new_rdn_type=\"%s\", "
"new_rdn_val=\"%s\"\n",
- new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
- new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+ new_rdn[ 0 ]->la_attr.bv_val,
+ new_rdn[ 0 ]->la_value.bv_val, 0 );
#endif
if ( op->oq_modrdn.rs_deleteoldrdn ) {
}
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 );
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;
}