Listener listener;
char opbuf[OPERATION_BUFFER_SIZE];
Operation *op;
- Entry e = { 0 };
+ Entry e = { 0 }, *ep = &e;
char *attr = NULL;
slap_tool_init( progname, SLAPACL, argc, argv );
attr = slap_schema.si_ad_entry->ad_cname.bv_val;
}
+ if ( !dryrun ) {
+ ID id;
+
+ if ( !be->be_entry_open ||
+ !be->be_entry_close ||
+ !be->be_dn2id_get ||
+ !be->be_entry_get )
+ {
+ fprintf( stderr, "%s: target database "
+ "doesn't support necessary operations; "
+ "you may try with \"-u\" (dry run).\n",
+ progname );
+ rc = 1;
+ goto destroy;
+ }
+
+ if ( be->be_entry_open( be, 0 ) != 0 ) {
+ fprintf( stderr, "%s: could not open database.\n",
+ progname );
+ rc = 1;
+ goto destroy;
+ }
+
+ id = be->be_dn2id_get( be, &e.e_nname );
+ if ( id == NOID ) {
+ fprintf( stderr, "%s: unable to fetch ID of DN \"%s\"\n",
+ progname, e.e_nname.bv_val );
+ rc = 1;
+ goto destroy;
+ }
+ if ( be->be_id2entry_get( be, id, &ep ) != 0 ) {
+ fprintf( stderr, "%s: unable to fetch entry \"%s\" (%lu)\n",
+ progname, e.e_nname.bv_val, id );
+ rc = 1;
+ goto destroy;
+
+ }
+ }
+
for ( ; argc--; argv++ ) {
slap_mask_t mask;
AttributeDescription *desc = NULL;
break;
}
- rc = access_allowed_mask( op, &e, desc, valp, access,
+ rc = access_allowed_mask( op, ep, desc, valp, access,
NULL, &mask );
if ( accessstr ) {
}
destroy:;
+ ber_memfree( e.e_name.bv_val );
+ ber_memfree( e.e_nname.bv_val );
+ if ( !dryrun ) {
+ if ( ep != &e ) {
+ be_entry_release_r( op, ep );
+ }
+ be->be_entry_close( be );
+ }
+
slap_tool_destroy();
return rc;
switch( tool ) {
case SLAPACL:
options = "\n\t[-U authcID | -D authcDN]"
- " -b DN -o <var>[=<val>]"
+ " -b DN -o <var>[=<val>] [-u]"
"\n\t[attr[/access][:value]] [...]\n";
break;
break;
case SLAPACL:
- options = "b:D:d:f:F:o:U:v";
+ options = "b:D:d:f:F:o:uU:v";
mode |= SLAP_TOOL_READMAIN | SLAP_TOOL_READONLY;
break;
{
if ( !dryrun ) {
slap_shutdown( be );
+ slap_destroy();
}
- slap_destroy();
#ifdef SLAPD_MODULES
if ( slapMode == SLAP_SERVER_MODE ) {
/* always false. just pulls in necessary symbol references. */