]> git.sur5r.net Git - openldap/commitdiff
Add SLAP_BFLAG_NOLASTMODCMD backend flag. When set, use of
authorKurt Zeilenga <kurt@openldap.org>
Wed, 16 Jun 2004 04:47:21 +0000 (04:47 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 16 Jun 2004 04:47:21 +0000 (04:47 +0000)
the lastmod command will fail.  To be set by backends
(e.g., back-ldap) which force the value of SLAP_DBFLAG_NOLASTMOD
database flag.

servers/slapd/config.c
servers/slapd/controls.c
servers/slapd/slap.h

index 983bc211dfcd0fd0c09ed9a3b6cadf118189aedd..a144b6cd570bf8f39bae66a85f9c068051c853e4 100644 (file)
@@ -118,7 +118,6 @@ read_config( const char *fname, int depth )
        struct berval vals[2];
        char *replicahost;
        LDAPURLDesc *ludp;
-       static int lastmod = 1;
        static BackendInfo *bi = NULL;
        static BackendDB        *be = NULL;
 
@@ -2311,18 +2310,36 @@ restrict_unknown:;
 
                                return( 1 );
                        }
+
+                       if ( be == NULL ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG( CONFIG, INFO, "%s: line %d: lastmod"
+                                       " line must appear inside a database definition\n",
+                                       fname, lineno , 0 );
+#else
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: lastmod"
+                                       " line must appear inside a database definition\n",
+                                       fname, lineno, 0 );
+#endif
+                               return 1;
+
+                       } else if ( SLAP_NOLASTMODCMD(be) ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG( CONFIG, INFO, "%s: line %d: lastmod"
+                                       " not available for %s database\n",
+                                       fname, lineno , be->bd_info->bi_type );
+#else
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: lastmod"
+                                       " not available for %s databases\n",
+                                       fname, lineno, be->bd_info->bi_type );
+#endif
+                               return 1;
+                       }
+
                        if ( strcasecmp( cargv[1], "on" ) == 0 ) {
-                               if ( be ) {
-                                       SLAP_DBFLAGS(be) &= ~SLAP_DBFLAG_NOLASTMOD;
-                               } else {
-                                       lastmod = 1;
-                               }
+                               SLAP_DBFLAGS(be) &= ~SLAP_DBFLAG_NOLASTMOD;
                        } else {
-                               if ( be ) {
-                                       SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NOLASTMOD;
-                               } else {
-                                       lastmod = 0;
-                               }
+                               SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NOLASTMOD;
                        }
 
 #ifdef SIGHUP
index 43e95ec0eceafff3e5a1f4b5624d9d9e38f8ef3d..c010122a91b9e93ea9501d1cf7b439e61f6a479d 100644 (file)
@@ -608,19 +608,7 @@ int get_ctrls(
 
                                rc = sc->sc_parse( op, rs, c );
                                assert( rc != LDAP_UNAVAILABLE_CRITICAL_EXTENSION );
-                               switch ( rc ) {
-                               /* for some reason, the control should be ignored */
-                               case SLAP_CTRL_IGNORE:
-                                       op->o_tmpfree( c, op->o_tmpmemctx );
-                                       op->o_ctrls[--nctrls] = NULL;
-                                       goto next_ctrl;
-                               
-                               /* the control was successfully parsed */
-                               case LDAP_SUCCESS:
-                                       break;
-
-                               /* something happened... */
-                               default:
+                               if ( rc ) {
                                        rs->sr_err = rc;
                                        goto return_results;
                                }
@@ -902,20 +890,6 @@ static int parsePagedResults (
                return LDAP_PROTOCOL_ERROR;
        }
 
-       /*
-        * NOTE: according to RFC 2696 3.:
-        *
-            If the page size is greater than or equal to the sizeLimit value, the
-            server should ignore the control as the request can be satisfied in a
-            single page.
-        *
-        * NOTE: this assumes that the op->ors_slimit be set before the controls
-        * are parsed.
-        */
-       if ( op->ors_slimit > 0 && size >= op->ors_slimit ) {
-               return SLAP_CTRL_IGNORE;
-       }
-
        if( cookie.bv_len ) {
                PagedResultsCookie reqcookie;
                if( cookie.bv_len != sizeof( reqcookie ) ) {
index 0a51ee120a066c20b8c9413f436caa04dd37de32..7c7f33b463e3bc9a2094da26fbaa3618350aae51 100644 (file)
@@ -1860,6 +1860,7 @@ struct slap_backend_info {
 
        slap_mask_t     bi_flags; /* backend flags */
 #define SLAP_BFLAG_MONITOR                     0x0001U /* a monitor backend */
+#define SLAP_BFLAG_NOLASTMODCMD                0x0010U
 #define SLAP_BFLAG_INCREMENT           0x0100U
 #define SLAP_BFLAG_ALIASES                     0x1000U
 #define SLAP_BFLAG_REFERRALS           0x2000U
@@ -1873,6 +1874,8 @@ struct slap_backend_info {
 #define SLAP_REFERRALS(be)     (SLAP_BFLAGS(be) & SLAP_BFLAG_REFERRALS)
 #define SLAP_SUBENTRIES(be)    (SLAP_BFLAGS(be) & SLAP_BFLAG_SUBENTRIES)
 #define SLAP_DYNAMIC(be)       (SLAP_BFLAGS(be) & SLAP_BFLAG_DYNAMIC)
+#define SLAP_NOLASTMODCMD(be)  (SLAP_BFLAGS(be) & SLAP_BFLAG_NOLASTMODCMD)
+#define SLAP_LASTMODCMD(be)    (!SLAP_NOLASTMODCMD(be))
 
        char **bi_controls;             /* supported controls */
 
@@ -2376,8 +2379,7 @@ enum {
 #endif
 
 #define SLAP_CTRL_FRONTEND                     0x00800000U
-#define SLAP_CTRL_FRONTEND_SEARCH              0x00010000U     /* for NOOP */
-#define SLAP_CTRL_IGNORE                       0x00020000U
+#define SLAP_CTRL_FRONTEND_SEARCH      0x00010000U     /* for NOOP */
 
 #define SLAP_CTRL_OPFLAGS                      0x0000FFFFU
 #define SLAP_CTRL_ABANDON                      0x00000001U