X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fslapacl.c;h=f0a0a0580a8e50cbbc738093a5a67d6d2654f3bb;hb=d168b49464df8a034e244c6610721155aa6b42ba;hp=5b516c173730be9557dca23296c05ef85145f6aa;hpb=2430af4e8bbfb5e852321efc09bcdaf816f60286;p=openldap diff --git a/servers/slapd/slapacl.c b/servers/slapd/slapacl.c index 5b516c1737..f0a0a0580a 100644 --- a/servers/slapd/slapacl.c +++ b/servers/slapd/slapacl.c @@ -1,6 +1,6 @@ /* This work is part of OpenLDAP Software . * - * Copyright 2004-2005 The OpenLDAP Foundation. + * Copyright 2004-2006 The OpenLDAP Foundation. * Portions Copyright 2004 Pierangelo Masarati. * All rights reserved. * @@ -65,8 +65,8 @@ slapacl( int argc, char **argv ) 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; @@ -86,13 +86,15 @@ slapacl( int argc, char **argv ) 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; @@ -213,13 +215,29 @@ slapacl( int argc, char **argv ) } 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; "