char *data;
int len;
Entry* e = be->be_entry_get( be, id );
+ op.o_bd = be;
+
+ if( sub_ndn.bv_len && !dnIsSuffix( &e->e_nname, &sub_ndn ) ) {
+ be_entry_release_r( &op, e );
+ continue;
+ }
if( verbose ) {
printf( "# id=%08lx\n", (long) id );
}
data = entry2str( e, &len );
- op.o_bd = be;
be_entry_release_r( &op, e );
if ( data == NULL ) {
int continuemode = 0;
int nosubordinates = 0;
int dryrun = 0;
+struct berval sub_ndn = { 0, NULL };
char *ldiffile = NULL;
FILE *ldiffp = NULL;
{
char *options;
struct berval base = { 0, NULL };
+ char *subtree = NULL;
int rc, i, dbnum;
int mode = SLAP_TOOL_MODE;
break;
case SLAPCAT:
- options = "b:cd:f:l:n:v";
+ options = "b:cd:f:l:n:s:v";
break;
default:
dbnum = atoi( optarg ) - 1;
break;
+ case 's': /* dump subtree */
+ subtree = strdup( optarg );
+ break;
+
case 't': /* turn on truncate */
truncatemode++;
mode |= SLAP_TRUNCATE_MODE;
exit( EXIT_FAILURE );
}
+ if( subtree ) {
+ struct berval val;
+ val.bv_val = subtree;
+ val.bv_len = strlen( subtree );
+ rc = dnNormalize( 0, NULL, NULL, &val, &sub_ndn, NULL );
+ if( rc != LDAP_SUCCESS ) {
+ fprintf( stderr, "Invalid subtree DN '%s'\n", optarg );
+ exit( EXIT_FAILURE );
+ }
+
+ if( base.bv_val == NULL && dbnum == -1 )
+ base = val;
+ else
+ free( subtree );
+ }
+
if( base.bv_val != NULL ) {
struct berval nbase;