]> git.sur5r.net Git - openldap/commitdiff
clarify no limits in (internal) searches
authorPierangelo Masarati <ando@openldap.org>
Sat, 12 Jun 2004 11:33:21 +0000 (11:33 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 12 Jun 2004 11:33:21 +0000 (11:33 +0000)
14 files changed:
servers/slapd/back-bdb/search.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-passwd/search.c
servers/slapd/back-sql/search.c
servers/slapd/backglue.c
servers/slapd/limits.c
servers/slapd/overlays/pcache.c
servers/slapd/overlays/refint.c
servers/slapd/overlays/unique.c
servers/slapd/sasl.c
servers/slapd/saslauthz.c
servers/slapd/slap.h
servers/slapd/slapi/slapi_ops.c

index 7a91c99c0b9a9aa4e1cfd903b0675633fa611914..92db06242dabf82a52a3c471c7b7dbbb090dbc22 100644 (file)
@@ -881,7 +881,9 @@ loop_begin:
                }
 
                /* check time limit */
-               if ( sop->ors_tlimit != -1 && slap_get_time() > stoptime ) {
+               if ( sop->ors_tlimit != SLAP_NO_LIMIT
+                               && slap_get_time() > stoptime )
+               {
                        rs->sr_err = LDAP_TIMELIMIT_EXCEEDED;
                        rs->sr_ref = rs->sr_v2ref;
                        send_ldap_result( sop, rs );
index 6da4f608d98f103df1185cd3a86cd51d0450854f..7fc6cefc816bb9a96f52dc7935c5359362d21274 100644 (file)
@@ -77,7 +77,7 @@ ldap_back_search(
        /* should we check return values? */
        if (op->ors_deref != -1)
                ldap_set_option( lc->ld, LDAP_OPT_DEREF, (void *)&op->ors_deref);
-       if (op->ors_tlimit != -1) {
+       if (op->ors_tlimit != SLAP_NO_LIMIT) {
                tv.tv_sec = op->ors_tlimit;
                tv.tv_usec = 0;
        } else {
index 960209ba12dd7d9060334f016dad953522abe8dd..c21ecdd0b516e3dc480db3257dcabd1cca9a709e 100644 (file)
@@ -231,7 +231,9 @@ searchit:
                }
 
                /* check time limit */
-               if ( op->ors_tlimit != -1 && slap_get_time() > stoptime ) {
+               if ( op->ors_tlimit != SLAP_NO_LIMIT
+                               && slap_get_time() > stoptime )
+               {
                        rs->sr_err = LDAP_TIMELIMIT_EXCEEDED;
                        send_ldap_result( op, rs );
                        rc = LDAP_SUCCESS;
index 4f7796871959ab3ec77efebabd342bc85e88ca9b..1317459fd5b2fb227bff4bfd897969ff6c14cc16 100644 (file)
@@ -69,11 +69,9 @@ passwd_back_search(
 
        AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
 
-       op->ors_tlimit = (op->ors_tlimit > op->o_bd->be_timelimit || op->ors_tlimit < 1) ? op->o_bd->be_timelimit
-           : op->ors_tlimit;
-       stoptime = op->o_time + op->ors_tlimit;
-       op->ors_slimit = (op->ors_slimit > op->o_bd->be_sizelimit || op->ors_slimit < 1) ? op->o_bd->be_sizelimit
-           : op->ors_slimit;
+       if (op->ors_tlimit != SLAP_NO_LIMIT ) {
+               stoptime = op->o_time + op->ors_tlimit;
+       }
 
        /* Handle a query for the base of this backend */
        if ( be_issuffix( op->o_bd, &op->o_req_ndn ) ) {
@@ -150,7 +148,9 @@ passwd_back_search(
                                }
 
                                /* check time limit */
-                               if ( slap_get_time() > stoptime ) {
+                               if ( op->ors_tlimit != SLAP_NO_LIMIT
+                                               && slap_get_time() > stoptime )
+                               {
                                        send_ldap_error( op, rs, LDAP_TIMELIMIT_EXCEEDED, NULL );
                                        endpwent();
                                        ldap_pvt_thread_mutex_unlock( &passwd_mutex );
index f1ceffa61ec47c818358dd7b969327b26d5ff136..cf35e0fc14a30f19dcbb3e56ada28bd95b80e2a2 100644 (file)
@@ -1459,7 +1459,9 @@ backsql_search( Operation *op, SlapReply *rs )
                }
 
                /* check time limit */
-               if ( op->ors_tlimit != -1 && slap_get_time() > stoptime ) {
+               if ( op->ors_tlimit != SLAP_NO_LIMIT
+                               && slap_get_time() > stoptime )
+               {
                        rs->sr_err = LDAP_TIMELIMIT_EXCEEDED;
                        rs->sr_ctrls = NULL;
                        rs->sr_ref = rs->sr_v2ref;
@@ -1601,8 +1603,9 @@ backsql_search( Operation *op, SlapReply *rs )
                }
                entry_free( entry );
 
-               if ( op->ors_slimit != -1 
-                               && rs->sr_nentries >= op->ors_slimit ) {
+               if ( op->ors_slimit != SLAP_NO_LIMIT
+                               && rs->sr_nentries >= op->ors_slimit )
+               {
                        rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
                        send_ldap_result( op, rs );
                        goto end_of_search;
index 59ea867f524135cd39a5460cec4e8a6e7536b8ec..c7e9543e33f6f39702ea5253cfd0c10c27754a35 100644 (file)
@@ -194,7 +194,9 @@ glue_back_response ( Operation *op, SlapReply *rs )
 
        switch(rs->sr_type) {
        case REP_SEARCH:
-               if ( gs->slimit != -1 && rs->sr_nentries >= gs->slimit ) {
+               if ( gs->slimit != SLAP_NO_LIMIT
+                               && rs->sr_nentries >= gs->slimit )
+               {
                        rs->sr_err = gs->err = LDAP_SIZELIMIT_EXCEEDED;
                        return -1;
                }
@@ -313,14 +315,14 @@ glue_back_search ( Operation *op, SlapReply *rs )
                                continue;
                        if (!dnIsSuffix(&gi->n[i].be->be_nsuffix[0], &b1->be_nsuffix[0]))
                                continue;
-                       if (tlimit0 != -1) {
+                       if (tlimit0 != SLAP_NO_LIMIT) {
                                op->ors_tlimit = stoptime - slap_get_time ();
                                if (op->ors_tlimit <= 0) {
                                        rs->sr_err = gs.err = LDAP_TIMELIMIT_EXCEEDED;
                                        break;
                                }
                        }
-                       if (slimit0 != -1) {
+                       if (slimit0 != SLAP_NO_LIMIT) {
                                op->ors_slimit = slimit0 - rs->sr_nentries;
                                if (op->ors_slimit < 0) {
                                        rs->sr_err = gs.err = LDAP_SIZELIMIT_EXCEEDED;
index 55fce61705ba50b7e2edeff4a980a3c487eaa723..836b4624b5c337f7b227ac42adfe23e2340c4b6c 100644 (file)
@@ -1001,11 +1001,11 @@ limits_check( Operation *op, SlapReply *rs )
                op->ors_limit = NULL;
 
                if ( op->ors_tlimit == 0 ) {
-                       op->ors_tlimit = -1;
+                       op->ors_tlimit = SLAP_NO_LIMIT;
                }
 
                if ( op->ors_slimit == 0 ) {
-                       op->ors_slimit = -1;
+                       op->ors_slimit = SLAP_NO_LIMIT;
                }
 
        /* if not root, get appropriate limits */
@@ -1084,7 +1084,7 @@ limits_check( Operation *op, SlapReply *rs )
                        if ( pr_total == -1 ) {
                                slimit = -1;
 
-                       } else if ( pr_total > 0 && ( op->ors_slimit == -1 || op->ors_slimit > pr_total ) ) {
+                       } else if ( pr_total > 0 && ( op->ors_slimit == SLAP_NO_LIMIT || op->ors_slimit > pr_total ) ) {
                                rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
                                send_ldap_result( op, rs );
                                rs->sr_err = LDAP_SUCCESS;
index 5a88e95b2f3fcfe96eec1f8aad42aca954e7e233..4567c933692110669c19b1ba091555c8077257b3 100644 (file)
@@ -869,8 +869,8 @@ remove_query_data (
        op->o_req_ndn = op->o_bd->be_nsuffix[0];
        op->ors_scope = LDAP_SCOPE_SUBTREE;
        op->ors_deref = LDAP_DEREF_NEVER;
-       op->ors_slimit = -1;
-       op->ors_tlimit = -1;
+       op->ors_slimit = SLAP_NO_LIMIT;
+       op->ors_tlimit = SLAP_NO_LIMIT;
        op->ors_filter = &filter;
        op->ors_filterstr.bv_val = filter_str;
        op->ors_filterstr.bv_len = strlen(filter_str);
index c802a965b94764d4551fc56ee6698e580fac4743..48aab57044e61c1f69051b2cfa845c67187e836e 100644 (file)
@@ -551,8 +551,8 @@ refint_response(
        nop.o_tag       = LDAP_REQ_SEARCH;
        nop.ors_scope   = LDAP_SCOPE_SUBTREE;
        nop.ors_deref   = LDAP_DEREF_NEVER;
-       nop.ors_slimit  = -1;
-       nop.ors_tlimit  = -1;
+       nop.ors_slimit  = SLAP_NO_LIMIT;
+       nop.ors_tlimit  = SLAP_NO_LIMIT;
        nop.o_req_ndn = id->dn;
        nop.o_req_dn = id->dn;
 
index 4fe528d8dfe9dbe2272619282c636dcfcdb4f808..866e5e30cbca55a9d8e9d922803e632c50aba33a 100644 (file)
@@ -349,8 +349,8 @@ static int unique_add(
        nop.o_tag       = LDAP_REQ_SEARCH;
        nop.ors_scope   = LDAP_SCOPE_SUBTREE;
        nop.ors_deref   = LDAP_DEREF_NEVER;
-       nop.ors_slimit  = -1;
-       nop.ors_tlimit  = -1;
+       nop.ors_slimit  = SLAP_NO_LIMIT;
+       nop.ors_tlimit  = SLAP_NO_LIMIT;
        nop.o_req_ndn   = ud->dn;
        nop.o_ndn = op->o_bd->be_rootndn;
 
@@ -482,8 +482,8 @@ static int unique_modify(
        nop.o_tag       = LDAP_REQ_SEARCH;
        nop.ors_scope   = LDAP_SCOPE_SUBTREE;
        nop.ors_deref   = LDAP_DEREF_NEVER;
-       nop.ors_slimit  = -1;
-       nop.ors_tlimit  = -1;
+       nop.ors_slimit  = SLAP_NO_LIMIT;
+       nop.ors_tlimit  = SLAP_NO_LIMIT;
        nop.o_req_ndn   = ud->dn;
        nop.o_ndn = op->o_bd->be_rootndn;
 
@@ -612,8 +612,8 @@ static int unique_modrdn(
        nop.o_tag       = LDAP_REQ_SEARCH;
        nop.ors_scope   = LDAP_SCOPE_SUBTREE;
        nop.ors_deref   = LDAP_DEREF_NEVER;
-       nop.ors_slimit  = -1;
-       nop.ors_tlimit  = -1;
+       nop.ors_slimit  = SLAP_NO_LIMIT;
+       nop.ors_tlimit  = SLAP_NO_LIMIT;
        nop.o_req_ndn   = ud->dn;
        nop.o_ndn = op->o_bd->be_rootndn;
 
index 43f32f2c2874213530b3b2dc75214c3d98fe7335..02409f11169af4f272d296493d347d32ba2f6e5d 100644 (file)
@@ -482,6 +482,7 @@ slap_auxprop_lookup(
                        op.o_req_dn = op.o_req_ndn;
                        op.ors_scope = LDAP_SCOPE_BASE;
                        op.ors_deref = LDAP_DEREF_NEVER;
+                       op.ors_tlimit = SLAP_NO_LIMIT;
                        op.ors_slimit = 1;
                        op.ors_filter = &generic_filter;
                        op.ors_filterstr = generic_filterstr;
index 379e85e38e14ac85aea6b8aa03c94a101cb2c862..52e5bbadc419016ac206a6db49376eccd506fa6d 100644 (file)
@@ -1049,7 +1049,7 @@ exact_match:
        if( !BER_BVISNULL( &op.o_req_dn ) ) ch_free( op.o_req_dn.bv_val );
        ber_dupbv_x( &op.o_req_dn, &op.o_req_ndn, op.o_tmpmemctx );
        op.oq_search.rs_slimit = 1;
-       op.oq_search.rs_tlimit = -1;
+       op.oq_search.rs_tlimit = SLAP_NO_LIMIT;
        op.o_sync_slog_size = -1;
 
        op.o_bd->be_search( &op, &rs );
@@ -1234,7 +1234,7 @@ void slap_sasl2dn( Operation *opx,
 #endif
        op.oq_search.rs_deref = LDAP_DEREF_NEVER;
        op.oq_search.rs_slimit = 1;
-       op.oq_search.rs_tlimit = -1;
+       op.oq_search.rs_tlimit = SLAP_NO_LIMIT;
        op.oq_search.rs_attrsonly = 1;
        /* use req_ndn as req_dn instead of non-pretty base of uri */
        if( !BER_BVISNULL( &op.o_req_dn ) ) ch_free( op.o_req_dn.bv_val );
index c7e76756ac1085f0516825007a7877071ff6375e..0a36d8da30a2ec14b0aea6c28f8263bececde35a 100644 (file)
@@ -1312,6 +1312,9 @@ struct slap_limits_set {
        int     lms_s_pr_total;
 };
 
+/* Note: this is different from LDAP_NO_LIMIT (0); slapd internal use only */
+#define SLAP_NO_LIMIT                  -1
+
 struct slap_limits {
        unsigned                lm_flags;       /* type of pattern */
 #define SLAP_LIMITS_UNDEFINED          0x0000U
@@ -1509,6 +1512,8 @@ struct slap_backend_db {
 #define SLAP_RESTRICT_OP_SEARCH                0x0080U
 #define SLAP_RESTRICT_OP_MASK          0x00FFU
 
+#define        SLAP_RESTRICT_READONLY          0x80000000U
+
 #define SLAP_RESTRICT_EXOP_START_TLS           0x0100U
 #define        SLAP_RESTRICT_EXOP_MODIFY_PASSWD        0x0200U
 #define SLAP_RESTRICT_EXOP_WHOAMI              0x0400U
index fff7d970675b2afcdf3b8111c4731993f5951ff6..588eb4c042c688166d9df0632935925c2a871bec 100644 (file)
@@ -1218,8 +1218,8 @@ slapi_search_internal(
 
        op->oq_search.rs_scope = scope;
        op->oq_search.rs_deref = 0;
-       op->oq_search.rs_slimit = LDAP_NO_LIMIT;
-       op->oq_search.rs_tlimit = LDAP_NO_LIMIT;
+       op->oq_search.rs_slimit = SLAP_NO_LIMIT;
+       op->oq_search.rs_tlimit = SLAP_NO_LIMIT;
        op->oq_search.rs_attrsonly = attrsonly;
        op->oq_search.rs_attrs = an;
        op->oq_search.rs_filter = filter;