]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapacl.c
alternate fix to ITS#3916
[openldap] / servers / slapd / slapacl.c
index 5b516c173730be9557dca23296c05ef85145f6aa..925127d0570a05b99c53f33b62b4e455459785a7 100644 (file)
@@ -86,6 +86,8 @@ slapacl( int argc, char **argv )
                                rc = 1;
                                goto destroy;
                        }
+
+                       i++;
                }
        }
 
@@ -213,9 +215,25 @@ 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 ||