]> git.sur5r.net Git - openldap/commitdiff
#unifdef paged results, remove lint
authorKurt Zeilenga <kurt@openldap.org>
Thu, 28 Nov 2002 04:38:41 +0000 (04:38 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 28 Nov 2002 04:38:41 +0000 (04:38 +0000)
clients/tools/ldapsearch.c
clients/tools/ldapwhoami.c
servers/slapd/back-bdb/init.c
servers/slapd/back-bdb/search.c
servers/slapd/config.c
servers/slapd/controls.c
servers/slapd/init.c
servers/slapd/limits.c
servers/slapd/slap.h

index 0c0c06b4eb951c083ba17115279738598410a9f9..5ad8b5610e8761f4c738aaa5f0a1fc5964500efe 100644 (file)
@@ -56,9 +56,7 @@ usage( const char *s )
 "  -b basedn  base dn for search\n"
 "  -E [!]<ctrl>[=<ctrlparam>] search controls (! indicates criticality)\n"
 "             [!]mv=<filter>              (matched values filter)\n"
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 "             [!]pr=<size>                (paged results)\n"
-#endif
 #ifdef LDAP_CONTROL_SUBENTRIES
 "             [!]subentries[=true|false]  (subentries)\n"
 #endif
@@ -175,7 +173,6 @@ static int  use_tls = 0;
 static char    *sortattr = NULL;
 static int     verbose, not, includeufn, vals2tmp, ldif;
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 static int pagedResults = 0;
 static ber_int_t pageSize = 0;
 static ber_int_t entriesLeft = 0;
@@ -191,7 +188,6 @@ static int parse_page_control(
        LDAP *ld,
        LDAPMessage *result,
        struct berval *cookie );
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
 static void
 urlize(char *url)
@@ -215,28 +211,22 @@ main( int argc, char **argv )
        int                     referrals, timelimit, sizelimit, debug;
        int             authmethod, version, want_bindpw;
        LDAP            *ld = NULL;
-       int             subentries, valuesReturnFilter;
        BerElement      *ber = NULL;
+       char    *control = NULL, *cvalue;
+       int             subentries, valuesReturnFilter;
        struct berval   *sebvalp = NULL, *vrbvalp = NULL;
        char    *vrFilter  = NULL;
-       char    *control = NULL, *cvalue;
        char    *pw_file = NULL;
        char    *authzid = NULL;
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        struct berval   *prbvalp = NULL;
-       int             num = 0;
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
-
 
        infile = NULL;
        debug = verbose = not = vals2tmp = referrals =
                subentries = valuesReturnFilter =
                attrsonly = manageDSAit = noop = ldif = want_bindpw = 0;
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        npagedresponses = npagedentries = npagedreferences =
                npagedextended = npagedpartial = 0;
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
        prog = lutil_progname( "ldapsearch", argc, argv );
 
@@ -335,9 +325,8 @@ main( int argc, char **argv )
                        version = LDAP_VERSION3;
                        break;
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                } else if ( strcasecmp( control, "pr" ) == 0 ) {
-                       int tmp;
+                       int num, tmp;
                        /* PagedResults control */
                        if ( pagedResults != 0 ) {
                                fprintf( stderr, "PagedResultsControl previously specified" );
@@ -353,7 +342,6 @@ main( int argc, char **argv )
                        pageSize = (ber_int_t) tmp;
                        pagedResults = 1 + crit;
                        break;
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
 #ifdef LDAP_CONTROL_SUBENTRIES
                } else if ( strcasecmp( control, "subentries" ) == 0 ) {
@@ -1024,12 +1012,9 @@ main( int argc, char **argv )
                }
        }
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 getNextPage:
-       if ( manageDSAit || noop || subentries || valuesReturnFilter || pageSize )
-#else
-       if ( manageDSAit || noop || subentries || valuesReturnFilter )
-#endif
+       if ( manageDSAit || noop || subentries
+               || valuesReturnFilter || pageSize )
        {
                int err;
                int i=0;
@@ -1123,7 +1108,6 @@ getNextPage:
                        ctrls[++i] = NULL;
                }
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                if ( pagedResults ) {
                        if (( ber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
                                return EXIT_FAILURE;
@@ -1144,7 +1128,6 @@ getNextPage:
                        ctrls[i] = &c[i];
                        ctrls[++i] = NULL;
                }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
 
@@ -1158,9 +1141,7 @@ getNextPage:
 
                ber_bvfree( sebvalp );
                ber_bvfree( vrbvalp );
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                ber_bvfree( prbvalp );
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
        }
        
        if ( verbose ) {
@@ -1252,7 +1233,6 @@ getNextPage:
                }
        }
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        if ( ( pageSize != 0 ) && ( morePagedResults != 0 ) ) { 
                char    buf[6];
                int     i, moreEntries, tmpSize;
@@ -1277,7 +1257,7 @@ getNextPage:
                buf[i] = '\0';
 
                if ( i > 0 && isdigit( buf[0] ) ) {
-                       num = sscanf( buf, "%d", &tmpSize );
+                       int num = sscanf( buf, "%d", &tmpSize );
                        if ( num != 1 ) {
                                fprintf( stderr, "Invalid value for PagedResultsControl, %s.\n", buf);
                                return EXIT_FAILURE;
@@ -1288,7 +1268,6 @@ getNextPage:
 
                goto getNextPage;       
        }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
        ldap_unbind( ld );
        return( rc );
@@ -1403,11 +1382,9 @@ static int dosearch(
 
                        case LDAP_RES_SEARCH_RESULT:
                                rc = print_result( ld, msg, 1 );
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                                if ( pageSize != 0 ) { 
                                        rc = parse_page_control( ld, msg, &cookie );
                                }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
                                goto done;
                        }
                }
@@ -1421,7 +1398,6 @@ static int dosearch(
        }
 
 done:
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        if ( pageSize != 0 ) { 
                npagedresponses = npagedresponses + nresponses;
                npagedentries = npagedentries + nentries;
@@ -1435,9 +1411,7 @@ done:
                        if( npartial ) printf( "# numPartial: %d\n", npagedpartial );
                        if( nreferences ) printf( "# numReferences: %d\n", npagedreferences );
                }
-       } else
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
-       if ( ldif < 2 ) {
+       } else if ( ldif < 2 ) {
                printf( "\n# numResponses: %d\n", nresponses );
                if( nentries ) printf( "# numEntries: %d\n", nentries );
                if( nextended ) printf( "# numExtended: %d\n", nextended );
@@ -1939,7 +1913,6 @@ write_ldif( int type, char *name, char *value, ber_len_t vallen )
 }
 
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 static int 
 parse_page_control(
        LDAP *ld,
@@ -2003,4 +1976,3 @@ parse_page_control(
 
        return err;
 }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
index 8d16eee744a0f5aeea41bc95cf049c382df81e13..37289e6235cbf98e70633e1f88a2e12473ca9dc8 100644 (file)
@@ -100,8 +100,6 @@ main( int argc, char *argv[] )
        char    *control, *cvalue;
        int             crit;
 
-       int id;
-       LDAPMessage *res;
        char *matcheddn = NULL, *text = NULL, **refs = NULL;
        char    *retoid = NULL;
        struct berval *retdata = NULL;
index d4a183302c81ee49ac6ad2521abb109c4393ed4b..245d1652502e5219aeaf0adf585d0d23360c9017 100644 (file)
@@ -495,21 +495,15 @@ bdb_initialize(
 {
        static char *controls[] = {
                LDAP_CONTROL_MANAGEDSAIT,
-#ifdef LDAP_CONTROL_SUBENTRIES
-               LDAP_CONTROL_SUBENTRIES,
-#endif
-#ifdef LDAP_CONTROL_NOOP
                LDAP_CONTROL_NOOP,
-#endif
-#ifdef LDAP_CONTROL_VALUESRETURNFILTER
+               LDAP_CONTROL_PAGEDRESULTS,
                LDAP_CONTROL_VALUESRETURNFILTER,
+#ifdef LDAP_CONTROL_SUBENTRIES
+               LDAP_CONTROL_SUBENTRIES,
 #endif
 #ifdef LDAP_CLIENT_UPDATE
                LDAP_CONTROL_CLIENT_UPDATE,
 #endif
-#ifdef LDAP_CONTROL_PAGEDRESULTS
-               LDAP_CONTROL_PAGEDRESULTS,
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
                NULL
        };
 
index 7964b98ee4f4863613e5b5ce836d55c934a9ced7..0a653a9f51d46a6c62bf6044a85efab1f189db3d 100644 (file)
@@ -26,14 +26,12 @@ static int search_candidates(
        int scope,
        int deref,
        ID      *ids );
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 static void send_pagerequest_response( 
        Connection      *conn,
        Operation *op,
        ID  lastid,
        int nentries,
        int tentries );                 
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
 int
 bdb_search(
@@ -63,11 +61,9 @@ bdb_search(
        struct berval   realbase = { 0, NULL };
        int             nentries = 0;
        int             manageDSAit;
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        int             pagedresults;
        int             tentries = 0;
        ID              lastid = NOID;
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
 #ifdef LDAP_CLIENT_UPDATE
        Filter lcupf, csnfnot, csnfeq, csnfand, csnfge;
@@ -100,10 +96,7 @@ bdb_search(
 
 
        manageDSAit = get_manageDSAit( op );
-
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        pagedresults = get_pagedresults( op );
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
        rc = LOCK_ID (bdb->bi_dbenv, &locker );
        switch(rc) {
@@ -283,15 +276,11 @@ dn2entry_retry:
                
                /* if no limit is required, use soft limit */
                if ( slimit <= 0 ) {
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                        if ( pagedresults && limit->lms_s_pr != 0 ) {
                                slimit = limit->lms_s_pr;
                        } else {
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
                                slimit = limit->lms_s_soft;
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                        }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
                /* if requested limit higher than hard limit, abort */
                } else if ( slimit > limit->lms_s_hard ) {
@@ -367,13 +356,10 @@ dn2entry_retry:
                }
        }
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        if ( isroot || !limit->lms_s_pr_hide ) {
                tentries = BDB_IDL_N(candidates);
        }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        if ( pagedresults ) {
                if ( op->o_pagedresults_state.ps_cookie == 0 ) {
                        id = 0;
@@ -405,7 +391,6 @@ dn2entry_retry:
                }
                goto loop_begin;
        }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
 #ifdef LDAP_CLIENT_UPDATE
        if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
@@ -441,10 +426,7 @@ dn2entry_retry:
 
                int             scopeok = 0;
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 loop_begin:
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
-
                /* check for abandon */
                if ( op->o_abandon ) {
                        rc = 0;
@@ -647,7 +629,7 @@ id2entry_retry:
                                                v2refs, NULL, nentries );
                                        goto done;
                                }
-#ifdef LDAP_CONTROL_PAGEDRESULTS
+
                                if ( pagedresults ) {
                                        if ( nentries >= op->o_pagedresults_size ) {
                                                send_pagerequest_response( conn, op, lastid, nentries, tentries );
@@ -655,7 +637,6 @@ id2entry_retry:
                                        }
                                        lastid = id;
                                }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
                                if (e) {
                                        int result;
@@ -1106,7 +1087,6 @@ static int search_candidates(
        return rc;
 }
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 static void
 send_pagerequest_response( 
        Connection      *conn,
@@ -1167,5 +1147,4 @@ done:
                ch_free( ctrls[0]->ldctl_value.bv_val );
        }
 }                      
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
index bd777a81c40496fac43366da4849fbacb7807708..f6225eeff22d47a2f308f4940b24baa40e441653 100644 (file)
@@ -30,12 +30,9 @@ struct slap_limits_set deflimit = {
 
        SLAPD_DEFAULT_SIZELIMIT,        /* backward compatible limits */
        0,
-       -1                              /* no limit on unchecked size */
-#ifdef LDAP_CONTROL_PAGEDRESULTS
-       ,
+       -1,                             /* no limit on unchecked size */
        0,                              /* page limit */
        0                               /* hide number of entries left */
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 };
 
 AccessControl  *global_acl = NULL;
index 81ec83508958b9e2405c30495b03f4bb3c07f86e..1021d267d92a126499e7412d74faa26773ba91fa 100644 (file)
@@ -71,21 +71,15 @@ static struct slap_control {
                SLAP_CTRL_SEARCH, NULL,
                parseSubentries },
 #endif
-#ifdef LDAP_CONTROL_NOOP
        { LDAP_CONTROL_NOOP,
                SLAP_CTRL_ACCESS, NULL,
                parseNoOp },
-#endif
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        { LDAP_CONTROL_PAGEDRESULTS,
                SLAP_CTRL_SEARCH, NULL,
                parsePagedResults },
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
-#ifdef LDAP_CONTROL_VALUESRETURNFILTER
        { LDAP_CONTROL_VALUESRETURNFILTER,
                SLAP_CTRL_SEARCH, NULL,
                parseValuesReturnFilter },
-#endif
 #ifdef LDAP_CLIENT_UPDATE
        { LDAP_CONTROL_CLIENT_UPDATE,
                SLAP_CTRL_SEARCH, NULL,
@@ -445,7 +439,6 @@ static int parseSubentries (
 }
 #endif
 
-#ifdef LDAP_CONTROL_NOOP
 static int parseNoOp (
        Connection *conn,
        Operation *op,
@@ -468,9 +461,7 @@ static int parseNoOp (
 
        return LDAP_SUCCESS;
 }
-#endif
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
 static int parsePagedResults (
        Connection *conn,
        Operation *op,
@@ -551,9 +542,7 @@ static int parsePagedResults (
 
        return LDAP_SUCCESS;
 }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
-#ifdef LDAP_CONTROL_VALUESRETURNFILTER
 int parseValuesReturnFilter (
        Connection *conn,
        Operation *op,
@@ -609,7 +598,6 @@ int parseValuesReturnFilter (
 
        return LDAP_SUCCESS;
 }
-#endif
 
 #ifdef LDAP_CLIENT_UPDATE
 static int parseClientUpdate (
index 90f66152ea85758efc344eaf96c4d0394d7d3259..94530f94377feb158b18d646db077e82928b9c68 100644 (file)
@@ -79,17 +79,13 @@ char *slap_known_controls[] = {
        LDAP_CONTROL_REFERRALS,
 #endif /* LDAP_CONTROL_REFERRALS */
 
-#ifdef LDAP_CONTROL_MANAGEDSAIT
        LDAP_CONTROL_MANAGEDSAIT,
-#endif /* LDAP_CONTROL_MANAGEDSAIT */
 
 #ifdef LDAP_CONTROL_SUBENTRIES
        LDAP_CONTROL_SUBENTRIES,
 #endif /* LDAP_CONTROL_SUBENTRIES */
 
-#ifdef LDAP_CONTROL_NOOP
        LDAP_CONTROL_NOOP,
-#endif /* LDAP_CONTROL_NOOP */
 
 #ifdef LDAP_CONTROL_DUPENT_REQUEST
        LDAP_CONTROL_DUPENT_REQUEST,
@@ -103,9 +99,7 @@ char *slap_known_controls[] = {
        LDAP_CONTROL_DUPENT_ENTRY,
 #endif /* LDAP_CONTROL_DUPENT_ENTRY */
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        LDAP_CONTROL_PAGEDRESULTS,
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 
 #ifdef LDAP_CONTROL_SORTREQUEST
        LDAP_CONTROL_SORTREQUEST,
@@ -123,10 +117,7 @@ char *slap_known_controls[] = {
        LDAP_CONTROL_VLVRESPONSE,
 #endif /* LDAP_CONTROL_VLVRESPONSE */
 
-#ifdef LDAP_CONTROL_VALUESRETURNFILTER
        LDAP_CONTROL_VALUESRETURNFILTER,
-#endif /* LDAP_CONTROL_VALUESRETURNFILTER */
-
        NULL
 };
 
index 6c74b449b752847282fc28326fbb7adb53bd8265..51f5673046b29cad84aaf558fbc5bf8ef4004243 100644 (file)
@@ -563,7 +563,6 @@ parse_limit(
                                        }
                                }
 
-#ifdef LDAP_CONTROL_PAGEDRESULTS
                        } else if ( strncasecmp( arg, "pr", sizeof( "pr" ) - 1 ) == 0 ) {
                                arg += sizeof( "pr" ) - 1;
                                if ( arg[0] != '=' ) {
@@ -581,7 +580,6 @@ parse_limit(
                                                return( 1 );
                                        }
                                }
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
                                
                        } else {
                                return( 1 );
index e81a0289fd28963d9bf599ea91b172637a26d538..7e33a378ada68f3dfcce88d539c7604669cdbf77 100644 (file)
@@ -1154,10 +1154,8 @@ struct slap_limits_set {
        int     lms_s_soft;
        int     lms_s_hard;
        int     lms_s_unchecked;
-#ifdef LDAP_CONTROL_PAGEDRESULTS
        int     lms_s_pr;
        int     lms_s_pr_hide;
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
 };
 
 struct slap_limits {
@@ -1685,9 +1683,7 @@ typedef struct slap_op {
 #define get_manageDSAit(op)                            ((int)(op)->o_managedsait)
 #define get_subentries(op)                             ((int)(op)->o_subentries)
 #define get_subentries_visibility(op)  ((int)(op)->o_subentries_visibility)
-#ifdef LDAP_CONTROL_PAGEDRESULTS
-#define get_pagedresults(op)                           ((int)(op)->o_pagedresults)
-#endif /* LDAP_CONTROL_PAGEDRESULTS */
+#define get_pagedresults(op)                   ((int)(op)->o_pagedresults)
 
 
 /*