/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2004-2005 The OpenLDAP Foundation.
+ * Copyright 2004-2006 The OpenLDAP Foundation.
* Portions Copyright 2004 Pierangelo Masarati.
* All rights reserved.
*
const char *progname = "slapacl";
Connection conn = { 0 };
Listener listener;
- char opbuf[OPERATION_BUFFER_SIZE];
- Operation *op;
+ OperationBuffer opbuf;
+ Operation *op = NULL;
Entry e = { 0 }, *ep = &e;
char *attr = NULL;
int doclose = 0;
rc = 1;
goto destroy;
}
+
+ i++;
}
}
argv = &argv[ optind ];
argc -= optind;
- op = (Operation *)opbuf;
+ op = (Operation *) &opbuf;
connection_fake_init( &conn, op, &conn );
conn.c_listener = &listener;
}
op->o_bd = be;
- if ( !dryrun && be ) {
+ if ( op->o_bd == NULL ) {
+ /* NOTE: if no database could be found (e.g. because
+ * accessing the rootDSE or so), use the frontendDB
+ * rules; might need work */
+ op->o_bd = frontendDB;
+ }
+
+ if ( !dryrun ) {
ID id;
+ if ( be == NULL ) {
+ fprintf( stderr, "%s: no target database "
+ "has been found for baseDN=\"%s\"; "
+ "you may try with \"-u\" (dry run).\n",
+ baseDN.bv_val, progname );
+ rc = 1;
+ goto destroy;
+ }
+
if ( !be->be_entry_open ||
!be->be_entry_close ||
!be->be_dn2id_get ||
- !be->be_entry_get )
+ !be->be_id2entry_get )
{
fprintf( stderr, "%s: target database "
"doesn't support necessary operations; "