/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2003 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
* Portions Copyright 1998-2003 Kurt D. Zeilenga.
* Portions Copyright 1998-2001 Net Boolean Incorporated.
* Portions Copyright 2001-2003 IBM Corporation.
* from this software without specific prior written permission. This
* software is provided ``as is'' without express or implied warranty.
*/
-/* This work was originally developed by the University of Michigan
+/* ACKNOWLEDGEMENTS:
+ * This work was originally developed by the University of Michigan
* (as part of U-MICH LDAP). Additional significant contributors
* include:
* Kurt D. Zeilenga
#include <ac/ctype.h>
#include <ac/string.h>
#include <ac/unistd.h>
+#include <ac/time.h>
#include <ldap.h>
#include "lutil.h"
const char options[] = "rs:"
- "cCd:D:e:f:h:H:IkKMnO:p:P:QR:U:vVw:WxX:y:Y:Z";
+ "cd:D:e:f:h:H:IkKMnO:p:P:QR:U:vVw:WxX:y:Y:Z";
int
handle_private_option( int i )
#if 0
int crit;
char *control, *cvalue;
- case 'E': /* modrdn controls */
+ case 'E': /* modrdn extensions */
if( protocol == LDAP_VERSION2 ) {
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, version );
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
- fprintf( stderr, _("Invalid modrdn control name: %s\n"), control );
+ fprintf( stderr, _("Invalid modrdn extension name: %s\n"), control );
usage();
#endif
}
}
- ldap_unbind( ld );
-
+ tool_unbind( ld );
+ tool_destroy();
return( retval );
}
return rc;
}
- rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, NULL, &res );
- if ( rc < 0 ) {
- ldap_perror( ld, "ldapmodrdn: ldap_result" );
- return rc;
+ for ( ; ; ) {
+ struct timeval tv = { 0 };
+
+ if ( tool_check_abandon( ld, id ) ) {
+ return LDAP_CANCELLED;
+ }
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+
+ rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
+ if ( rc < 0 ) {
+ ldap_perror( ld, "ldapmodrdn: ldap_result" );
+ return rc;
+ }
+
+ if ( rc != 0 ) {
+ break;
+ }
}
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );