X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libraries%2Flibldap%2Fmodrdn.c;h=5e4c45f9971825cf9b55ba9b61f72dc464989234;hb=b898f1271db5021e1873e38e1498a99d9450b646;hp=a0383892775bfd91ac76b9e5417738061223f809;hpb=6939c531700652491f4be4688c6a1f35a1ab8a18;p=openldap
diff --git a/libraries/libldap/modrdn.c b/libraries/libldap/modrdn.c
index a038389277..5e4c45f997 100644
--- a/libraries/libldap/modrdn.c
+++ b/libraries/libldap/modrdn.c
@@ -1,18 +1,21 @@
/* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-/* Portions
- * Copyright (c) 1990 Regents of the University of Michigan.
- * All rights reserved.
+/* This work is part of OpenLDAP Software .
*
- * modrdn.c
- */
-/*
- * Support for MODIFYDN REQUEST V3 (newSuperior) by:
+ * Copyright 1998-2010 The OpenLDAP Foundation.
+ * All rights reserved.
*
- * Copyright 1999, Juan C. Gomez, All rights reserved.
+ * 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
+ * .
+ */
+/* Portions Copyright (c) 1990 Regents of the University of Michigan.
+ * All rights reserved.
+ */
+/* Copyright 1999, Juan C. Gomez, All rights reserved.
* This software is not subject to any license of Silicon Graphics
* Inc. or Purdue University.
*
@@ -21,14 +24,8 @@
* is preserved.
*/
-/*
- * A modify rdn request looks like this:
- * ModifyRDNRequest ::= SEQUENCE {
- * entry DistinguishedName,
- * newrdn RelativeDistinguishedName,
- * deleteoldrdn BOOLEAN
- * newSuperior [0] DistinguishedName [v3 only]
- * }
+/* ACKNOWLEDGEMENTS:
+ * Juan C. Gomez
*/
#include "portable.h"
@@ -41,6 +38,17 @@
#include "ldap-int.h"
+/*
+ * A modify rdn request looks like this:
+ * ModifyRDNRequest ::= SEQUENCE {
+ * entry DistinguishedName,
+ * newrdn RelativeDistinguishedName,
+ * deleteoldrdn BOOLEAN
+ * newSuperior [0] DistinguishedName [v3 only]
+ * }
+ */
+
+
/*
* ldap_rename - initiate an ldap extended modifyDN operation.
*
@@ -67,12 +75,9 @@ ldap_rename(
{
BerElement *ber;
int rc;
+ ber_int_t id;
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ENTRY, "ldap_rename\n", 0, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE, "ldap_rename\n", 0, 0, 0 );
-#endif
/* check client controls */
rc = ldap_int_client_controls( ld, cctrls );
@@ -83,6 +88,7 @@ ldap_rename(
return( LDAP_NO_MEMORY );
}
+ LDAP_NEXT_MSGID( ld, id );
if( newSuperior != NULL ) {
/* must be version 3 (or greater) */
if ( ld->ld_version < LDAP_VERSION3 ) {
@@ -90,15 +96,14 @@ ldap_rename(
ber_free( ber, 1 );
return( ld->ld_errno );
}
-
rc = ber_printf( ber, "{it{ssbtsN}", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_MODDN,
+ id, LDAP_REQ_MODDN,
dn, newrdn, (ber_int_t) deleteoldrdn,
LDAP_TAG_NEWSUPERIOR, newSuperior );
} else {
rc = ber_printf( ber, "{it{ssbN}", /* '}' */
- ++ld->ld_msgid, LDAP_REQ_MODDN,
+ id, LDAP_REQ_MODDN,
dn, newrdn, (ber_int_t) deleteoldrdn );
}
@@ -122,7 +127,7 @@ ldap_rename(
}
/* send the message */
- *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber );
+ *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber, id );
if( *msgidp < 0 ) {
return( ld->ld_errno );
@@ -155,11 +160,7 @@ ldap_rename2(
int msgid;
int rc;
-#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ENTRY, "ldap_rename2\n", 0, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 );
-#endif
rc = ldap_rename( ld, dn, newrdn, newSuperior,
deleteoldrdn, NULL, NULL, &msgid );
@@ -216,9 +217,9 @@ ldap_rename_s(
return rc;
}
- rc = ldap_result( ld, msgid, 1, NULL, &res );
+ rc = ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &res );
- if( rc == -1 ) {
+ if( rc == -1 || !res ) {
return ld->ld_errno;
}