Commit 3579a48d authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

More sync'ing

parent 4a3dc100
......@@ -6,10 +6,10 @@
#
ol_package=OpenLDAP
ol_major=2
ol_minor=X
ol_minor=1
ol_patch=X
ol_api_inc=000000
ol_api_lib=0:0:0
ol_api_inc=20111
ol_api_lib=2:111:0
ol_release_date="00/00/0000"
if test $ol_patch != X ; then
......
......@@ -18,7 +18,7 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c cr.c \
schema.c schema_check.c schema_init.c schema_prep.c \
schemaparse.c ad.c at.c mr.c syntax.c oc.c saslauthz.c \
oidm.c starttls.c index.c sets.c referral.c \
root_dse.c sasl.c module.c suffixalias.c mra.c mods.c \
root_dse.c sasl.c module.c mra.c mods.c \
limits.c backglue.c operational.c matchedValues.c cancel.c \
$(@PLAT@_SRCS)
......@@ -31,7 +31,7 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o cr.o \
schema.o schema_check.o schema_init.o schema_prep.o \
schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o \
oidm.o starttls.o index.o sets.o referral.o \
root_dse.o sasl.o module.o suffixalias.o mra.o mods.o \
root_dse.o sasl.o module.o mra.o mods.o \
limits.o backglue.o operational.o matchedValues.o cancel.o \
$(@PLAT@_OBJS)
......
......@@ -56,7 +56,7 @@ int bdb_modify_internal(
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: add\n", 0, 0, 0);
#endif
err = modify_add_values( e, mod, get_permitmodify(op),
err = modify_add_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
......@@ -76,7 +76,7 @@ int bdb_modify_internal(
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: delete\n", 0, 0, 0);
#endif
err = modify_delete_values( e, mod, get_permitmodify(op),
err = modify_delete_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
assert( err != LDAP_TYPE_OR_VALUE_EXISTS );
if( err != LDAP_SUCCESS ) {
......@@ -97,7 +97,7 @@ int bdb_modify_internal(
#else
Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: replace\n", 0, 0, 0);
#endif
err = modify_replace_values( e, mod, get_permitmodify(op),
err = modify_replace_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
if( err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
......@@ -122,7 +122,7 @@ int bdb_modify_internal(
*/
mod->sm_op = LDAP_MOD_ADD;
err = modify_add_values( e, mod, get_permitmodify(op),
err = modify_add_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
if ( err == LDAP_TYPE_OR_VALUE_EXISTS ) {
err = LDAP_SUCCESS;
......
......@@ -67,7 +67,7 @@ bdb_cancel(
LDAP_LIST_FOREACH ( ps_list, &bdb->psearch_list, link ) {
if ( ps_list->o_connid == conn->c_connid ) {
if ( ps_list->o_msgid == id ) {
ps_list->o_cancel = LDAP_CANCEL_DONE;
ps_list->o_cancel = SLAP_CANCEL_DONE;
LDAP_LIST_REMOVE( ps_list, link );
#if 0
......
......@@ -500,11 +500,11 @@ loop_begin:
#ifdef LDAP_EXOP_X_CANCEL
if ( op->o_cancel ) {
assert( op->o_cancel == LDAP_CANCEL_REQ );
assert( op->o_cancel == SLAP_CANCEL_REQ );
rc = 0;
send_search_result( conn, op, LDAP_CANCELLED,
NULL, NULL, NULL, NULL, 0 );
op->o_cancel = LDAP_CANCEL_ACK;
op->o_cancel = SLAP_CANCEL_ACK;
goto done;
}
#endif
......@@ -1049,7 +1049,8 @@ static int search_candidates(
* these clauses are redundant.
*/
if (!oc_filter(filter, 1, &depth) && !get_subentries_visibility(op) ) {
if( !get_manageDSAit(op) ) { /* match referrals */
if( !get_manageDSAit(op) && !get_domainScope(op) ) {
/* match referral objects */
struct berval bv_ref = { sizeof("referral")-1, "referral" };
rf.f_choice = LDAP_FILTER_EQUALITY;
rf.f_ava = &aa_ref;
......@@ -1060,7 +1061,8 @@ static int search_candidates(
}
#ifdef BDB_ALIASES
if( deref & LDAP_DEREF_SEARCHING ) { /* match aliases */
if( deref & LDAP_DEREF_SEARCHING ) {
/* match alias objects */
struct berval bv_alias = { sizeof("alias")-1, "alias" };
af.f_choice = LDAP_FILTER_EQUALITY;
af.f_ava = &aa_alias;
......@@ -1261,7 +1263,7 @@ bdb_build_lcup_update_ctrl(
"{bb{sON}N}",
SLAP_LCUP_STATE_UPDATE_FALSE,
isdeleted,
LDAP_LCUP_COOKIE_OID, &entrycsn_bv );
LDAP_CUP_COOKIE_OID, &entrycsn_bv );
else /* Do not send cookie */
ber_printf( ber,
"{bbN}",
......@@ -1311,7 +1313,7 @@ bdb_build_lcup_done_ctrl(
ctrls[num_ctrls] = ch_malloc ( sizeof ( LDAPControl ) );
ber_printf( ber, "{sO", LDAP_LCUP_COOKIE_OID, latest_entrycsn_bv );
ber_printf( ber, "{sO", LDAP_CUP_COOKIE_OID, latest_entrycsn_bv );
ber_printf( ber, "N}" );
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_CLIENT_UPDATE_DONE;
......
......@@ -65,7 +65,8 @@ int ldbm_modify_internal(
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: add\n", 0, 0, 0);
#endif
rc = modify_add_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
rc = modify_add_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, INFO,
......@@ -84,7 +85,8 @@ int ldbm_modify_internal(
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: delete\n", 0, 0, 0);
#endif
rc = modify_delete_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
rc = modify_delete_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
assert( rc != LDAP_TYPE_OR_VALUE_EXISTS );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
......@@ -104,7 +106,8 @@ int ldbm_modify_internal(
Debug(LDAP_DEBUG_ARGS, "ldbm_modify_internal: replace\n", 0, 0, 0);
#endif
rc = modify_replace_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
rc = modify_replace_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, INFO,
......@@ -129,7 +132,8 @@ int ldbm_modify_internal(
*/
mod->sm_op = LDAP_MOD_ADD;
rc = modify_add_values( e, mod, op->o_permitmodify, text, textbuf, textlen );
rc = modify_add_values( e, mod, get_permissiveModify(op),
text, textbuf, textlen );
if ( rc == LDAP_TYPE_OR_VALUE_EXISTS ) {
rc = LDAP_SUCCESS;
}
......
/* search.c - ldbm backend search function */
/* $OpenLDAP$ */
/*
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
......@@ -74,7 +74,7 @@ ldbm_back_search(
ber_dupbv( &realbase, &e->e_nname );
candidates = search_candidates( be, e, filter,
scope, deref, manageDSAit );
scope, deref, manageDSAit || get_domainScope(op) );
goto searchit;
......
......@@ -36,8 +36,15 @@
#include <stdio.h>
#include "slap.h"
#ifdef LDAP_SLAPI
#include "slapi.h"
#endif
#include "back-monitor.h"
#if defined(LDAP_SLAPI)
static int monitor_back_add_plugin( Backend *be, Entry *e );
#endif /* defined(LDAP_SLAPI) */
int
monitor_subsys_database_init(
BackendDB *be
......@@ -179,6 +186,10 @@ monitor_subsys_database_init(
return( -1 );
}
#if defined(LDAP_SLAPI)
monitor_back_add_plugin( be, e );
#endif /* defined(LDAP_SLAPI) */
e_tmp = e;
}
......@@ -190,3 +201,54 @@ monitor_subsys_database_init(
return( 0 );
}
#if defined(LDAP_SLAPI)
static int
monitor_back_add_plugin( Backend *be, Entry *e_database )
{
Slapi_PBlock *pCurrentPB;
int i, rc = LDAP_SUCCESS;
if ( slapi_x_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
/*
* LDAP_OTHER is returned if no plugins are installed
*/
rc = LDAP_OTHER;
goto done;
}
i = 0;
do {
Slapi_PluginDesc *srchdesc;
char buf[1024];
struct berval bv;
rc = slapi_pblock_get( pCurrentPB, SLAPI_PLUGIN_DESCRIPTION,
&srchdesc );
if ( rc != LDAP_SUCCESS ) {
goto done;
}
snprintf( buf, sizeof(buf),
"plugin %d name: %s; "
"vendor: %s; "
"version: %s; "
"description: %s",
i,
srchdesc->spd_id,
srchdesc->spd_vendor,
srchdesc->spd_version,
srchdesc->spd_description );
bv.bv_val = buf;
bv.bv_len = strlen( buf );
attr_merge_one( e_database, monitor_ad_desc, &bv );
i++;
} while ( ( slapi_x_pblock_get_next( &pCurrentPB ) == LDAP_SUCCESS )
&& ( pCurrentPB != NULL ) );
done:
return rc;
}
#endif /* defined(LDAP_SLAPI) */
......@@ -605,9 +605,6 @@ do_bind(
if ( be->be_bind ) {
int ret;
/* deref suffix alias if appropriate */
suffix_alias( be, &ndn );
ret = (*be->be_bind)( be, conn, op,
&pdn, &ndn, method, &cred, &edn );
......
......@@ -107,26 +107,26 @@ int cancel_extop(
#endif
}
if ( op->o_cancel != LDAP_CANCEL_NONE ) {
if ( op->o_cancel != SLAP_CANCEL_NONE ) {
*text = "message ID already being cancelled";
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
return LDAP_PROTOCOL_ERROR;
}
op->o_cancel = LDAP_CANCEL_REQ;
op->o_cancel = SLAP_CANCEL_REQ;
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
while ( op->o_cancel == LDAP_CANCEL_REQ ) {
while ( op->o_cancel == SLAP_CANCEL_REQ ) {
ldap_pvt_thread_yield();
}
if ( op->o_cancel == LDAP_CANCEL_ACK ) {
if ( op->o_cancel == SLAP_CANCEL_ACK ) {
rc = LDAP_SUCCESS;
} else {
rc = op->o_cancel;
}
op->o_cancel = LDAP_CANCEL_DONE;
op->o_cancel = SLAP_CANCEL_DONE;
return rc;
}
......
......@@ -271,9 +271,6 @@ do_compare(
ava.aa_desc->ad_cname.bv_val, 0 );
/* deref suffix alias if appropriate */
suffix_alias( be, &ndn );
#if defined( LDAP_SLAPI )
slapi_x_backend_set_pb( pb, be );
slapi_x_connection_set_pb( pb, conn );
......
......@@ -956,140 +956,6 @@ read_config( const char *fname, int depth )
ber_bvarray_add( &be->be_suffix, &pdn );
ber_bvarray_add( &be->be_nsuffix, &ndn );
/* set database suffixAlias */
} else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) {
Backend *tmp_be;
struct berval alias, palias, nalias;
struct berval aliased, paliased, naliased;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing alias and aliased_dn in "
"\"suffixAlias <alias> <aliased_dn>\" line.\n",
fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing alias and aliased_dn in "
"\"suffixAlias <alias> <aliased_dn>\" line.\n",
fname, lineno, 0 );
#endif
return( 1 );
} else if ( cargc < 3 ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: missing aliased_dn in "
"\"suffixAlias <alias> <aliased_dn>\" line\n",
fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing aliased_dn in "
"\"suffixAlias <alias> <aliased_dn>\" line\n",
fname, lineno, 0 );
#endif
return( 1 );
} else if ( cargc > 3 ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: extra cruft in suffixAlias line (ignored)\n",
fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: extra cruft in suffixAlias line (ignored)\n",
fname, lineno, 0 );
#endif
}
if ( be == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffix line must appear inside a database "
"definition.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias line"
" must appear inside a database definition.\n",
fname, lineno, 0 );
#endif
return 1;
}
if ( load_ucdata( NULL ) < 0 ) return 1;
alias.bv_val = cargv[1];
alias.bv_len = strlen( cargv[1] );
rc = dnPrettyNormal( NULL, &alias, &palias, &nalias );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: alias DN is invalid.\n", fname, lineno, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: alias DN is invalid\n",
fname, lineno, 0 );
#endif
return( 1 );
}
tmp_be = select_backend( &nalias, 0, 0 );
free( nalias.bv_val );
if ( tmp_be && tmp_be != be ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffixAlias served by a preceeding "
"backend \"%s\"\n", fname, lineno,
tmp_be->be_suffix[0].bv_val );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias served by"
" a preceeding backend \"%s\"\n",
fname, lineno, tmp_be->be_suffix[0].bv_val );
#endif
free( palias.bv_val );
return -1;
}
aliased.bv_val = cargv[2];
aliased.bv_len = strlen( cargv[2] );
rc = dnPrettyNormal( NULL, &aliased, &paliased, &naliased );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: aliased DN is invalid.\n", fname, lineno,0 );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: aliased DN is invalid\n",
fname, lineno, 0 );
#endif
free( palias.bv_val );
return( 1 );
}
tmp_be = select_backend( &naliased, 0, 0 );
free( naliased.bv_val );
if ( tmp_be && tmp_be != be ) {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, INFO,
"%s: line %d: suffixAlias derefs to a different backend "
"a preceeding backend \"%s\"\n",
fname, lineno, tmp_be->be_suffix[0].bv_val );
#else
Debug( LDAP_DEBUG_ANY,
"%s: line %d: suffixAlias derefs to differnet backend"
" a preceeding backend \"%s\"\n",
fname, lineno, tmp_be->be_suffix[0].bv_val );
#endif
free( palias.bv_val );
free( paliased.bv_val );
return -1;
}
ber_bvarray_add( &be->be_suffixAlias, &palias );
ber_bvarray_add( &be->be_suffixAlias, &paliased );
/* set max deref depth */
} else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) {
......
......@@ -1028,12 +1028,12 @@ operations_error:
ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
#ifdef LDAP_EXOP_X_CANCEL
if ( arg->co_op->o_cancel == LDAP_CANCEL_REQ ) {
if ( arg->co_op->o_cancel == SLAP_CANCEL_REQ ) {
arg->co_op->o_cancel = LDAP_TOO_LATE;
}
while ( arg->co_op->o_cancel != LDAP_CANCEL_NONE &&
arg->co_op->o_cancel != LDAP_CANCEL_DONE )
while ( arg->co_op->o_cancel != SLAP_CANCEL_NONE &&
arg->co_op->o_cancel != SLAP_CANCEL_DONE )
{
ldap_pvt_thread_yield();
}
......@@ -1048,7 +1048,7 @@ operations_error:
LDAP_STAILQ_NEXT(arg->co_op, o_next) = NULL;
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
if ( arg->co_op->o_cancel == LDAP_CANCEL_ACK )
if ( arg->co_op->o_cancel == SLAP_CANCEL_ACK )
goto co_op_free;
#endif
#ifdef LDAP_CLIENT_UPDATE
......
......@@ -49,8 +49,8 @@ static SLAP_CTRL_PARSE_FN parseManageDSAit;
static SLAP_CTRL_PARSE_FN parseNoOp;
static SLAP_CTRL_PARSE_FN parsePagedResults;
static SLAP_CTRL_PARSE_FN parseValuesReturnFilter;
static SLAP_CTRL_PARSE_FN parsePermitModify;
static SLAP_CTRL_PARSE_FN parseNoReferrals;
static SLAP_CTRL_PARSE_FN parsePermissiveModify;
static SLAP_CTRL_PARSE_FN parseDomainScope;
#ifdef LDAP_CONTROL_SUBENTRIES
static SLAP_CTRL_PARSE_FN parseSubentries;
......@@ -113,35 +113,29 @@ static struct slap_control {
{ LDAP_CONTROL_VALUESRETURNFILTER,
SLAP_CTRL_SEARCH, NULL,
parseValuesReturnFilter },
#ifdef LDAP_CONTROL_SUBENTRIES
{ LDAP_CONTROL_SUBENTRIES,
SLAP_CTRL_SEARCH, NULL,
parseSubentries },
#endif
{ LDAP_CONTROL_NOOP,
SLAP_CTRL_ACCESS, NULL,
parseNoOp },
#ifdef LDAP_CONTROL_PAGEDRESULTS
{ LDAP_CONTROL_PAGEDRESULTS,
SLAP_CTRL_SEARCH, NULL,
parsePagedResults },
#endif
{ LDAP_CONTROL_MANAGEDSAIT,
SLAP_CTRL_ACCESS, NULL,
parseManageDSAit },
{ LDAP_CONTROL_PROXY_AUTHZ,
SLAP_CTRL_FRONTEND|SLAP_CTRL_ACCESS, proxy_authz_extops,
parseProxyAuthz },
#ifdef LDAP_CONTROL_PERMITMODIFY
{ LDAP_CONTROL_PERMITMODIFY,
SLAP_CTRL_UPDATE, NULL,
parsePermitModify },
#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
{ LDAP_CONTROL_X_DOMAIN_SCOPE,
SLAP_CTRL_FRONTEND|SLAP_CTRL_SEARCH, NULL,
parseDomainScope },
#endif
#ifdef LDAP_CONTROL_NOREFERRALS
{ LDAP_CONTROL_NOREFERRALS,
#ifdef LDAP_CONTROL_X_PERMISSIVE_MODIFY
{ LDAP_CONTROL_X_PERMISSIVE_MODIFY,
SLAP_CTRL_MODIFY, NULL,
parsePermissiveModify },
#endif
#ifdef LDAP_CONTROL_SUBENTRIES
{ LDAP_CONTROL_SUBENTRIES,
SLAP_CTRL_SEARCH, NULL,
parseNoReferrals },
parseSubentries },
#endif
{ LDAP_CONTROL_NOOP,
SLAP_CTRL_ACCESS, NULL,
parseNoOp },
#ifdef LDAP_CLIENT_UPDATE
{ LDAP_CONTROL_CLIENT_UPDATE,
SLAP_CTRL_SEARCH, NULL,
......@@ -152,6 +146,12 @@ static struct slap_control {
SLAP_CTRL_SEARCH, NULL,
parseLdupSync },
#endif
{ LDAP_CONTROL_MANAGEDSAIT,
SLAP_CTRL_ACCESS, NULL,
parseManageDSAit },
{ LDAP_CONTROL_PROXY_AUTHZ,
SLAP_CTRL_FRONTEND|SLAP_CTRL_ACCESS, proxy_authz_extops,
parseProxyAuthz },
{ NULL, 0, NULL, 0 }
};
......@@ -813,24 +813,24 @@ static int parseSubentries (
}
#endif
#ifdef LDAP_CONTROL_PERMITMODIFY
static int parsePermitModify (
#ifdef LDAP_CONTROL_X_PERMISSIVE_MODIFY
static int parsePermissiveModify (
Connection *conn,
Operation *op,
LDAPControl *ctrl,
const char **text )
{
if ( op->o_permitmodify != SLAP_NO_CONTROL ) {
*text = "permitmodify control specified multiple times";
if ( op->o_permissive_modify != SLAP_NO_CONTROL ) {
*text = "permissiveModify control specified multiple times";
return LDAP_PROTOCOL_ERROR;
}
if ( ctrl->ldctl_value.bv_len ) {
*text = "permitmodify control value not empty";
*text = "permissiveModify control value not empty";
return LDAP_PROTOCOL_ERROR;
}
op->o_permitmodify = ctrl->ldctl_iscritical
op->o_permissive_modify = ctrl->ldctl_iscritical
? SLAP_CRITICAL_CONTROL
: SLAP_NONCRITICAL_CONTROL;
......@@ -838,24 +838,24 @@ static int parsePermitModify (
}
#endif
#ifdef LDAP_CONTROL_NOREFERRALS
static int parseNoReferrals (
#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
static int parseDomainScope (
Connection *conn,
Operation *op,
LDAPControl *ctrl,
const char **text )
{
if ( op->o_noreferrals != SLAP_NO_CONTROL ) {
*text = "noreferrals control specified multiple times";
if ( op->o_domain_scope != SLAP_NO_CONTROL ) {
*text = "domainScope control specified multiple times";
return LDAP_PROTOCOL_ERROR;
}
if ( ctrl->ldctl_value.bv_len ) {