]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapcat.c
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / servers / slapd / slapcat.c
index af1cae4993e4f17c6d4703ffc382c0659ceaea56..713b908287d9d3dddafc8e7c9ee9ad6f557f759f 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2010 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
  * Portions Copyright 1998-2003 Kurt D. Zeilenga.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
@@ -109,8 +109,22 @@ slapcat( int argc, char **argv )
                if ( e == NULL ) {
                        printf("# no data for entry id=%08lx\n\n", (long) id );
                        rc = EXIT_FAILURE;
-                       if( continuemode ) continue;
-                       break;
+                       if ( continuemode == 0 ) {
+                               break;
+
+                       } else if ( continuemode == 1 ) {
+                               continue;
+                       }
+
+                       /* this is a last resort: linearly scan all ids
+                        * trying to recover as much as possible (ITS#6482) */
+                       while ( ++id != NOID ) {
+                               e = be->be_entry_get( be, id );
+                               if ( e != NULL ) break;
+                               printf("# no data for entry id=%08lx\n\n", (long) id );
+                       }
+
+                       if ( e == NULL ) break;
                }
 
                if ( doBSF ) {
@@ -134,7 +148,7 @@ slapcat( int argc, char **argv )
                        printf( "# id=%08lx\n", (long) id );
                }
 
-               data = entry2str( e, &len );
+               data = entry2str_wrap( e, &len, ldif_wrap );
                be_entry_release_r( &op, e );
 
                if ( data == NULL ) {