+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2004-2007 The OpenLDAP Foundation.
+ * Copyright 2004-2011 The OpenLDAP Foundation.
* Portions Copyright 2004 Pierangelo Masarati.
* All rights reserved.
*
char *attr = NULL;
int doclose = 0;
BackendDB *bd;
+ void *thrctx;
slap_tool_init( progname, SLAPACL, argc, argv );
argv = &argv[ optind ];
argc -= optind;
- connection_fake_init( &conn, &opbuf, &conn );
+ thrctx = ldap_pvt_thread_pool_context();
+ connection_fake_init( &conn, &opbuf, thrctx );
op = &opbuf.ob_op;
+ op->o_tmpmemctx = NULL;
conn.c_listener = &listener;
conn.c_listener_url = listener_url;
if ( !be->be_entry_open ||
!be->be_entry_close ||
!be->be_dn2id_get ||
- !be->be_id2entry_get )
+ !be->be_entry_get )
{
fprintf( stderr, "%s: target database "
"doesn't support necessary operations; "
rc = 1;
goto destroy;
}
- if ( be->be_id2entry_get( be, id, &ep ) != 0 ) {
+ ep = be->be_entry_get( be, id );
+ if ( ep == NULL ) {
fprintf( stderr, "%s: unable to fetch entry \"%s\" (%lu)\n",
progname, e.e_nname.bv_val, id );
rc = 1;
ber_memfree( e.e_nname.bv_val );
}
if ( !dryrun && be ) {
- if ( ep != &e ) {
+ if ( ep && ep != &e ) {
be_entry_release_r( op, ep );
}
if ( doclose ) {
}
}
- slap_tool_destroy();
+ if ( slap_tool_destroy())
+ rc = EXIT_FAILURE;
return rc;
}