]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapacl.c
reject registrations when back-monitor is not configured
[openldap] / servers / slapd / slapacl.c
index 5b516c173730be9557dca23296c05ef85145f6aa..13dfccc8825b317d9cb86178438d6395f526ab6a 100644 (file)
@@ -66,7 +66,7 @@ slapacl( int argc, char **argv )
        Connection              conn = { 0 };
        Listener                listener;
        char                    opbuf[OPERATION_BUFFER_SIZE];
-       Operation               *op;
+       Operation               *op = NULL;
        Entry                   e = { 0 }, *ep = &e;
        char                    *attr = NULL;
        int                     doclose = 0;
@@ -86,6 +86,8 @@ slapacl( int argc, char **argv )
                                rc = 1;
                                goto destroy;
                        }
+
+                       i++;
                }
        }
 
@@ -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; "