Add SLAP_BFLAG_NOLASTMODCMD backend flag. When set, use of

the lastmod command will fail.  To be set by backends
(e.g., back-ldap) which force the value of SLAP_DBFLAG_NOLASTMOD
database flag.
This commit is contained in:
Kurt Zeilenga 2004-06-16 04:47:21 +00:00
parent 06f3bfb7f9
commit 0ae37bd468
3 changed files with 33 additions and 40 deletions

View 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

View 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 ) ) {

View 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