]> git.sur5r.net Git - openldap/blobdiff - tests/progs/slapd-modify.c
Merge remote branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / tests / progs / slapd-modify.c
index 887d9462db30743275751ac6c28811fbf998c809..0c7c5e429917daa143df8eb68e677fa23d875d72 100644 (file)
@@ -1,7 +1,7 @@
 /* $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"
 
@@ -49,6 +49,7 @@ usage( char *name )
                "-D <manager> "
                "-w <passwd> "
                "-e <entry> "
+               "[-i <ignore>] "
                "[-l <loops>] "
                "[-L <outerloops>] "
                "[-r <maxretries>] "
@@ -78,9 +79,10 @@ main( int argc, char **argv )
        int             friendly = 0;
        int             chaserefs = 0;
 
-       tester_init( "slapd-modify" );
+       tester_init( "slapd-modify", TESTER_MODIFY );
 
-       while ( (i = getopt( argc, argv, "CFH:h:p:D:w:e:a:l:L:r:t:" )) != EOF ) {
+       while ( ( i = getopt( argc, argv, "a:CD:e:FH:h:i:L:l:p:r:t:w:" ) ) != EOF )
+       {
                switch ( i ) {
                case 'C':
                        chaserefs++;
@@ -98,6 +100,10 @@ main( int argc, char **argv )
                        host = strdup( optarg );
                        break;
 
+               case 'i':
+                       /* ignored (!) by now */
+                       break;
+
                case 'p':               /* the servers port */
                        if ( lutil_atoi( &port, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -111,6 +117,7 @@ main( int argc, char **argv )
                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 modify */
@@ -194,7 +201,6 @@ do_modify( char *uri, char *manager,
 {
        LDAP    *ld = NULL;
        int     i = 0, do_retry = maxretries;
-       pid_t   pid;
        int     rc = LDAP_SUCCESS;
 
        struct ldapmod mod;
@@ -202,8 +208,6 @@ do_modify( char *uri, char *manager,
        char *values[2];
        int version = LDAP_VERSION3;
 
-       pid = getpid();
-       
        values[0] = value;
        values[1] = NULL;
        mod.mod_op = LDAP_MOD_ADD;
@@ -306,7 +310,7 @@ retry:;
        }
 
 done:;
-       fprintf( stderr, " PID=%ld - Modify done (%d).\n", (long) pid, rc );
+       fprintf( stderr, "  PID=%ld - Modify done (%d).\n", (long) pid, rc );
 
        ldap_unbind_ext( ld, NULL, NULL );
 }