/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2006 The OpenLDAP Foundation.
+ * Copyright 1999-2012 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <stdio.h>
-#include <ac/stdlib.h>
+#include "ac/stdlib.h"
-#include <ac/ctype.h>
-#include <ac/param.h>
-#include <ac/socket.h>
-#include <ac/string.h>
-#include <ac/unistd.h>
-#include <ac/wait.h>
+#include "ac/ctype.h"
+#include "ac/param.h"
+#include "ac/socket.h"
+#include "ac/string.h"
+#include "ac/unistd.h"
+#include "ac/wait.h"
-#include <ldap.h>
-#include <lutil.h>
+#include "ldap.h"
+#include "lutil.h"
#include "slapd-common.h"
tester_init( "slapd-modrdn", TESTER_MODRDN );
- while ( (i = getopt( argc, argv, "CFH:h:i:p:D:w:e:l:L:r:t:" )) != EOF ) {
- switch( i ) {
+ while ( ( i = getopt( argc, argv, "CD:e:FH:h:i:L:l:p:r:t:w:" ) ) != EOF )
+ {
+ switch ( i ) {
case 'C':
chaserefs++;
break;
case 'w': /* the server managers password */
passwd.bv_val = strdup( optarg );
passwd.bv_len = strlen( optarg );
+ memset( optarg, '*', passwd.bv_len );
break;
case 'e': /* entry to rename */
int delay, int friendly, int chaserefs )
{
LDAP *ld = NULL;
- int i = 0, do_retry = maxretries;
- pid_t pid;
+ int i, do_retry = maxretries;
char *DNs[2];
char *rdns[2];
int rc = LDAP_SUCCESS;
char *p1, *p2;
int version = LDAP_VERSION3;
- pid = getpid();
DNs[0] = entry;
DNs[1] = strdup( entry );
rdns[0] = strdup( DNs[1] );
DNs[1][i] = ',';
+ i = 0;
+
retry:;
ldap_initialize( &ld, uri );
if ( ld == NULL ) {
}
done:;
- fprintf( stderr, " PID=%ld - Modrdn done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Modrdn done (%d).\n", (long) pid, rc );
ldap_unbind_ext( ld, NULL, NULL );
-}
-
+ free( DNs[1] );
+ free( rdns[0] );
+ free( rdns[1] );
+}