mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
LCUP primitive routines removed
This commit is contained in:
parent
c20dbfb4f6
commit
262f8bf11f
@ -75,13 +75,6 @@ usage( void )
|
||||
#ifdef LDAP_CONTROL_SUBENTRIES
|
||||
fprintf( stderr, _(" [!]subentries[=true|false] (subentries)\n"));
|
||||
#endif
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
fprintf( stderr, _(" [!]lcup=p/<cint>/<cookie>/<slimit> (LDAP client update)\n"));
|
||||
/*
|
||||
* " s/<cint>/<cookie> (LDAP client update)\n"
|
||||
* " sp/<cint>/<cookie>/<slimit>\n"
|
||||
* */
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
fprintf( stderr, _(" [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly)\n"));
|
||||
fprintf( stderr, _(" rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist)\n"));
|
||||
@ -160,18 +153,8 @@ static char *vrFilter = NULL;
|
||||
static int domainScope = 0;
|
||||
#endif
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
static int lcup = 0;
|
||||
static int ldapsync = 0;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
static int lcup_cint = 0;
|
||||
static struct berval lcup_cookie = { 0, NULL };
|
||||
static int lcup_slimit = -1;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
static int ldapsync = 0;
|
||||
static struct berval sync_cookie = { 0, NULL };
|
||||
static int sync_slimit = -1;
|
||||
#endif
|
||||
@ -330,66 +313,6 @@ handle_private_option( int i )
|
||||
if( crit ) subentries *= -1;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
} else if ( strcasecmp( control, "lcup" ) == 0 ) {
|
||||
char *cookiep;
|
||||
char *slimitp;
|
||||
if ( lcup ) {
|
||||
fprintf( stderr, _("client update control previously specified\n"));
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
if ( ldapsync != -1 ) {
|
||||
fprintf( stderr, _("ldap sync control previously specified\n"));
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
if ( cvalue == NULL ) {
|
||||
fprintf( stderr,
|
||||
_("missing specification of client update control\n"));
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
if ( strncasecmp( cvalue, "p", 1 ) == 0 ) {
|
||||
lcup = LDAP_CUP_PERSIST_ONLY;
|
||||
cvalue = strchr( cvalue, '/' );
|
||||
cvalue++;
|
||||
cookiep = strchr( cvalue, '/' );
|
||||
*cookiep++ = '\0';
|
||||
lcup_cint = atoi( cvalue );
|
||||
cvalue = cookiep;
|
||||
slimitp = strchr( cvalue, '/' );
|
||||
*slimitp++ = '\0';
|
||||
while ( isspace( (unsigned char) *cookiep ) )
|
||||
cookiep++;
|
||||
ber_str2bv( cookiep, 0, 0, &lcup_cookie );
|
||||
lcup_slimit = atoi( slimitp );
|
||||
/*
|
||||
} else if ( strncasecmp( cvalue, "s", 1 ) == 0 ) {
|
||||
lcup = LDAP_CUP_SYNC_ONLY;
|
||||
cvalue += 2;
|
||||
cookiep = strchr( cvalue, '/' );
|
||||
*cookiep++ = '\0';
|
||||
lcup_cint = atoi( cvalue );
|
||||
ber_str2bv( cookiep, 0, 0, &lcup_cookie );
|
||||
} else if ( strncasecmp( cvalue, "sp", 2 ) == 0 ) {
|
||||
lcup = LDAP_CUP_SYNC_AND_PERSIST;
|
||||
cvalue += 3;
|
||||
cookiep = strchr( cvalue, '/' );
|
||||
*cookiep++ = '\0';
|
||||
lcup_cint = atoi( cvalue );
|
||||
cvalue = cookiep;
|
||||
slimitp = strchr( cvalue, '/' );
|
||||
*slimitp++ = '\0';
|
||||
ber_str2bv( cookiep, 0, 0, &lcup_cookie );
|
||||
lcup_slimit = atoi( slimitp );
|
||||
*/
|
||||
} else {
|
||||
fprintf( stderr,
|
||||
_("client update control value \"%s\" invalid\n"),
|
||||
cvalue );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
if ( crit ) lcup *= -1;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
} else if ( strcasecmp( control, "sync" ) == 0 ) {
|
||||
char *cookiep;
|
||||
@ -398,10 +321,6 @@ handle_private_option( int i )
|
||||
fprintf( stderr, _("ldap sync control previously specified\n") );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
if ( lcup ) {
|
||||
fprintf( stderr, _("client update control previously specified\n") );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
if ( cvalue == NULL ) {
|
||||
fprintf( stderr,
|
||||
_("missing specification of ldap sync control\n"));
|
||||
@ -527,10 +446,6 @@ main( int argc, char **argv )
|
||||
int rc, i, first;
|
||||
LDAP *ld = NULL;
|
||||
BerElement *seber = NULL, *vrber = NULL, *prber = NULL;
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
BerElement *cuber = NULL;
|
||||
struct berval *cubvalp = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
BerElement *syncber = NULL;
|
||||
@ -640,9 +555,6 @@ getNextPage:
|
||||
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
||||
|| pageSize
|
||||
#endif
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
|| lcup
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
|| ldapsync
|
||||
#endif
|
||||
@ -684,36 +596,6 @@ getNextPage:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( lcup ) {
|
||||
if (( cuber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if ( lcup_cookie.bv_len == 0 ) {
|
||||
err = ber_printf( cuber, "{ei}", abs(lcup), lcup_cint );
|
||||
} else {
|
||||
err = ber_printf( cuber, "{ei{sO}}", abs(lcup), lcup_cint,
|
||||
LDAP_CUP_COOKIE_OID, &lcup_cookie );
|
||||
}
|
||||
|
||||
if ( err == LBER_ERROR ) {
|
||||
ber_free( cuber, 1 );
|
||||
fprintf( stderr, _("client update control encoding error!\n") );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if ( ber_flatten( cuber, &cubvalp ) == LBER_ERROR ) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
c[i].ldctl_oid = LDAP_CONTROL_CLIENT_UPDATE;
|
||||
c[i].ldctl_value = (*cubvalp);
|
||||
c[i].ldctl_iscritical = lcup < 0;
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ldapsync ) {
|
||||
if (( syncber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
|
||||
@ -1054,15 +936,6 @@ static int dosearch(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( lcup == LDAP_CUP_PERSIST_ONLY ||
|
||||
lcup == LDAP_CUP_SYNC_AND_PERSIST ) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined(LDAP_CLIENT_UPDATE) && defined(LDAP_SYNC)
|
||||
else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ldapsync == LDAP_SYNC_REFRESH_AND_PERSIST ) {
|
||||
break;
|
||||
@ -1095,12 +968,6 @@ static int dosearch(
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( lcup && lcup_slimit != -1 && nresponses >= lcup_slimit ) {
|
||||
ldap_abandon (ld, ldap_msgid(msg));
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ldapsync && sync_slimit != -1 &&
|
||||
nresponses_psearch >= sync_slimit ) {
|
||||
|
@ -199,13 +199,6 @@ typedef struct ldapcontrol {
|
||||
|
||||
#define LDAP_CONTROL_PAGEDRESULTS "1.2.840.113556.1.4.319"
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#define LDAP_CONTROL_CLIENT_UPDATE "1.3.6.1.4.1.4203.666.5.3"
|
||||
#define LDAP_CONTROL_ENTRY_UPDATE "1.3.6.1.4.1.4203.666.5.4"
|
||||
#define LDAP_CONTROL_CLIENT_UPDATE_DONE "1.3.6.1.4.1.4203.666.5.5"
|
||||
#define LDAP_CUP_COOKIE_OID "1.3.6.1.4.1.4203.666.10.1"
|
||||
#endif
|
||||
|
||||
#define LDAP_SYNC 2
|
||||
#ifdef LDAP_SYNC
|
||||
#define LDAP_SYNCREPL 1
|
||||
@ -295,11 +288,6 @@ typedef struct ldapcontrol {
|
||||
|
||||
#define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U) /* context specific + primitive */
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#define LDAP_CUP_TAG_INTERVAL ((ber_tag_t) 0x02U) /* integer */
|
||||
#define LDAP_CUP_TAG_COOKIE ((ber_tag_t) 0x30U) /* sequence */
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
#define LDAP_SYNC_TAG_COOKIE ((ber_tag_t) 0x04U) /* octet string */
|
||||
#endif
|
||||
@ -479,14 +467,13 @@ typedef struct ldapcontrol {
|
||||
#define LDAP_CLIENT_LOOP 0x60 /* draft-ietf-ldap-c-api-xx */
|
||||
#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* draft-ietf-ldap-c-api-xx */
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
/* resultCode for LCUP */
|
||||
#define LDAP_CUP_RESOURCES_EXHAUSTED 0x100
|
||||
#define LDAP_CUP_SECURITY_VIOLATION 0x101
|
||||
#define LDAP_CUP_INVALID_COOKIE 0x102
|
||||
#define LDAP_CUP_UNSUPPORTED_SCHEME 0x103
|
||||
#define LDAP_CUP_CLIENT_DISCONNECT 0x104
|
||||
#define LDAP_CUP_RELOAD_REQUIRED 0x105
|
||||
#ifdef LDAP_SYNC
|
||||
#define LDAP_SYNC_RESOURCES_EXHAUSTED 0x100
|
||||
#define LDAP_SYNC_SECURITY_VIOLATION 0x101
|
||||
#define LDAP_SYNC_INVALID_COOKIE 0x102
|
||||
#define LDAP_SYNC_UNSUPPORTED_SCHEME 0x103
|
||||
#define LDAP_SYNC_CLIENT_DISCONNECT 0x104
|
||||
#define LDAP_SYNC_RELOAD_REQUIRED 0x105
|
||||
#endif
|
||||
|
||||
#define LDAP_ASSERTION_FAILED 0x10f
|
||||
@ -499,17 +486,6 @@ typedef struct ldapcontrol {
|
||||
#define LDAP_CANNOT_CANCEL 0x113
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
/* LCUP update type */
|
||||
#define LDAP_CUP_NONE 0x00
|
||||
#define LDAP_CUP_SYNC_ONLY 0x01
|
||||
#define LDAP_CUP_PERSIST_ONLY 0x02
|
||||
#define LDAP_CUP_SYNC_AND_PERSIST 0x03
|
||||
|
||||
/* LCUP default cookie interval */
|
||||
#define LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL 0x01
|
||||
#endif /* LDAP_CLIENT_UPDATE */
|
||||
|
||||
/* LDAP SYNC request type */
|
||||
#ifdef LDAP_SYNC
|
||||
#define LDAP_SYNC_NONE 0x00
|
||||
|
@ -95,13 +95,13 @@ static struct ldaperror ldap_builtin_errlist[] = {
|
||||
|
||||
{LDAP_ASSERTION_FAILED, N_("Assertion Failed")},
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
{LDAP_CUP_RESOURCES_EXHAUSTED, N_("Client Update Resource Exhausted")},
|
||||
{LDAP_CUP_SECURITY_VIOLATION, N_("Client Update Security Violation")},
|
||||
{LDAP_CUP_INVALID_COOKIE, N_("Client Update Invalid Cookie")},
|
||||
{LDAP_CUP_UNSUPPORTED_SCHEME, N_("Client Update Unsupported Scheme")},
|
||||
{LDAP_CUP_CLIENT_DISCONNECT, N_("Client Update Client Disconnect")},
|
||||
{LDAP_CUP_RELOAD_REQUIRED, N_("Client Update Reload Required")},
|
||||
#ifdef LDAP_SYNC
|
||||
{LDAP_SYNC_RESOURCES_EXHAUSTED, N_("Content Sync Resource Exhausted")},
|
||||
{LDAP_SYNC_SECURITY_VIOLATION, N_("Content Sync Security Violation")},
|
||||
{LDAP_SYNC_INVALID_COOKIE, N_("Content Sync Invalid Cookie")},
|
||||
{LDAP_SYNC_UNSUPPORTED_SCHEME, N_("Content Sync Unsupported Scheme")},
|
||||
{LDAP_SYNC_CLIENT_DISCONNECT, N_("Content Sync Client Disconnect")},
|
||||
{LDAP_SYNC_RELOAD_REQUIRED, N_("Content Sync Reload Required")},
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_EXOP_X_CANCEL
|
||||
|
@ -33,7 +33,7 @@ bdb_add(Operation *op, SlapReply *rs )
|
||||
DB_LOCK lock;
|
||||
int noop = 0;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
Operation* ps_list;
|
||||
#endif
|
||||
|
||||
@ -526,13 +526,13 @@ retry: /* transaction retry */
|
||||
return_results:
|
||||
send_ldap_result( op, rs );
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( rs->sr_err == LDAP_SUCCESS && !noop ) {
|
||||
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
|
||||
bdb_psearch( op, rs, ps_list, op->oq_add.rs_e, LDAP_PSEARCH_BY_ADD );
|
||||
}
|
||||
}
|
||||
#endif /* LDAP_CLIENT_UPDATE */
|
||||
#endif
|
||||
|
||||
if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
|
||||
ldap_pvt_thread_yield();
|
||||
|
@ -158,7 +158,7 @@ struct bdb_info {
|
||||
|
||||
ID bi_lastid;
|
||||
ldap_pvt_thread_mutex_t bi_lastid_mutex;
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
LDAP_LIST_HEAD(pl, slap_op) bi_psearch_list;
|
||||
#endif
|
||||
#ifdef SLAP_IDL_CACHE
|
||||
|
@ -33,7 +33,7 @@ bdb_delete( Operation *op, SlapReply *rs )
|
||||
|
||||
int noop = 0;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
Operation* ps_list;
|
||||
#endif
|
||||
|
||||
@ -492,7 +492,7 @@ retry: /* transaction retry */
|
||||
return_results:
|
||||
send_ldap_result( op, rs );
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( rs->sr_err == LDAP_SUCCESS && !noop ) {
|
||||
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
|
||||
bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE );
|
||||
|
@ -90,7 +90,7 @@ bdb_db_init( BackendDB *be )
|
||||
bdb->bi_search_stack_depth = DEFAULT_SEARCH_STACK_DEPTH;
|
||||
bdb->bi_search_stack = NULL;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
LDAP_LIST_INIT (&bdb->bi_psearch_list);
|
||||
#endif
|
||||
|
||||
@ -573,9 +573,6 @@ bdb_initialize(
|
||||
{
|
||||
static char *controls[] = {
|
||||
LDAP_CONTROL_ASSERT,
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
LDAP_CONTROL_CLIENT_UPDATE,
|
||||
#endif
|
||||
LDAP_CONTROL_MANAGEDSAIT,
|
||||
LDAP_CONTROL_NOOP,
|
||||
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
||||
@ -676,7 +673,7 @@ bdb_initialize(
|
||||
|
||||
bi->bi_op_unbind = 0;
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#ifdef LDAP_SYNC
|
||||
bi->bi_op_abandon = bdb_abandon;
|
||||
bi->bi_op_cancel = bdb_cancel;
|
||||
#else
|
||||
|
@ -304,7 +304,7 @@ bdb_modify( Operation *op, SlapReply *rs )
|
||||
|
||||
int noop = 0;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
Operation* ps_list;
|
||||
struct psid_entry *pm_list, *pm_prev;
|
||||
#endif
|
||||
@ -328,7 +328,7 @@ retry: /* transaction retry */
|
||||
"bdb_modify: retrying...\n", 0, 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
|
||||
while ( pm_list != NULL ) {
|
||||
LDAP_LIST_REMOVE ( pm_list, ps_link );
|
||||
@ -462,7 +462,7 @@ retry: /* transaction retry */
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
|
||||
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
|
||||
bdb_psearch(op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
|
||||
@ -583,7 +583,7 @@ retry: /* transaction retry */
|
||||
return_results:
|
||||
send_ldap_result( op, rs );
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
|
||||
/* Loop through in-scope entries for each psearch spec */
|
||||
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
|
||||
@ -609,7 +609,7 @@ return_results:
|
||||
|
||||
done:
|
||||
if( ltid != NULL ) {
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
|
||||
while ( pm_list != NULL ) {
|
||||
LDAP_LIST_REMOVE ( pm_list, ps_link );
|
||||
|
@ -51,7 +51,7 @@ bdb_modrdn( Operation *op, SlapReply *rs )
|
||||
|
||||
int noop = 0;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
Operation *ps_list;
|
||||
struct psid_entry *pm_list, *pm_prev;
|
||||
#endif
|
||||
@ -86,7 +86,7 @@ retry: /* transaction retry */
|
||||
Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn: retrying...\n", 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
|
||||
while ( pm_list != NULL ) {
|
||||
LDAP_LIST_REMOVE ( pm_list, ps_link );
|
||||
@ -838,7 +838,7 @@ retry: /* transaction retry */
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
|
||||
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
|
||||
bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
|
||||
@ -953,7 +953,7 @@ retry: /* transaction retry */
|
||||
return_results:
|
||||
send_ldap_result( op, rs );
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( rs->sr_err == LDAP_SUCCESS && !op->o_noop ) {
|
||||
/* Loop through in-scope entries for each psearch spec */
|
||||
LDAP_LIST_FOREACH ( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
|
||||
@ -1014,7 +1014,7 @@ done:
|
||||
}
|
||||
|
||||
if( ltid != NULL ) {
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
pm_list = LDAP_LIST_FIRST(&op->o_pm_list);
|
||||
while ( pm_list != NULL ) {
|
||||
LDAP_LIST_REMOVE ( pm_list, ps_link );
|
||||
|
@ -487,7 +487,7 @@ int bdb_locker_id( Operation *op, DB_ENV *env, int *locker );
|
||||
* search.c
|
||||
*/
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
|
||||
#define bdb_abandon BDB_SYMBOL(abandon)
|
||||
#define bdb_cancel BDB_SYMBOL(cancel)
|
||||
@ -507,30 +507,6 @@ int bdb_do_search(
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#define bdb_build_lcup_update_ctrl BDB_SYMBOL(build_lcup_update_ctrl)
|
||||
#define bdb_build_lcup_done_ctrl BDB_SYMBOL(build_lcup_done_ctrl)
|
||||
|
||||
int
|
||||
bdb_build_lcup_update_ctrl(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
Entry *e,
|
||||
int entry_count,
|
||||
LDAPControl **ctrls,
|
||||
int num_ctrls,
|
||||
struct berval *latest_entrycsn_bv,
|
||||
int isdeleted );
|
||||
|
||||
int
|
||||
bdb_build_lcup_done_ctrl(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
LDAPControl **ctrls,
|
||||
int num_ctrls,
|
||||
struct berval *latest_entrycsn_bv );
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
#define bdb_build_sync_state_ctrl BDB_SYMBOL(build_sync_state_ctrl)
|
||||
#define bdb_build_sync_done_ctrl BDB_SYMBOL(build_sync_done_ctrl)
|
||||
|
@ -280,14 +280,10 @@ nextido:
|
||||
static
|
||||
int is_sync_protocol( Operation *op )
|
||||
{
|
||||
#if !defined(LDAP_CLIENT_UPDATE) && !defined(LDAP_SYNC)
|
||||
#if !defined(LDAP_SYNC)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( op->o_clientupdate_type & SLAP_LCUP_SYNC_AND_PERSIST )
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( op->o_sync_mode & SLAP_SYNC_REFRESH_AND_PERSIST )
|
||||
return 1;
|
||||
@ -295,7 +291,7 @@ int is_sync_protocol( Operation *op )
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#if defined(LDAP_SYNC)
|
||||
#define IS_BDB_REPLACE(type) (( type == LDAP_PSEARCH_BY_DELETE ) || \
|
||||
( type == LDAP_PSEARCH_BY_SCOPEOUT ))
|
||||
#define IS_PSEARCH (op != sop)
|
||||
@ -383,7 +379,7 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
ID lastid = NOID;
|
||||
AttributeName *attrs;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
Filter cookief, csnfnot, csnfeq, csnfand, csnfge;
|
||||
AttributeAssertion aa_ge, aa_eq;
|
||||
int entry_count = 0;
|
||||
@ -394,11 +390,9 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
LDAPControl *ctrls[SLAP_SEARCH_MAX_CTRLS];
|
||||
int num_ctrls = 0;
|
||||
AttributeName uuid_attr[2];
|
||||
#ifdef LDAP_SYNC
|
||||
int rc_sync = 0;
|
||||
int entry_sync_state = -1;
|
||||
AttributeName null_attr;
|
||||
#endif
|
||||
#endif
|
||||
struct slap_limits_set *limit = NULL;
|
||||
int isroot = 0;
|
||||
@ -414,14 +408,6 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
#endif
|
||||
attrs = sop->oq_search.rs_attrs;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( !IS_PSEARCH && sop->o_clientupdate_type & SLAP_LCUP_PERSIST ) {
|
||||
sop->o_ps_protocol = LDAP_CLIENT_UPDATE;
|
||||
LDAP_LIST_INSERT_HEAD( &bdb->bi_psearch_list, sop, o_ps_link );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
/* psearch needs to be registered before refresh begins */
|
||||
/* psearch and refresh transmission is serialized in send_ldap_ber() */
|
||||
@ -433,7 +419,6 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
null_attr.an_oc = NULL;
|
||||
null_attr.an_name.bv_len = 0;
|
||||
null_attr.an_name.bv_val = NULL;
|
||||
#endif
|
||||
|
||||
for ( num_ctrls = 0; num_ctrls < SLAP_SEARCH_MAX_CTRLS; num_ctrls++ ) {
|
||||
ctrls[num_ctrls] = NULL;
|
||||
@ -441,19 +426,6 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
num_ctrls = 0;
|
||||
|
||||
if ( IS_PSEARCH && IS_BDB_REPLACE(ps_type)) {
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( sop->o_ps_protocol == LDAP_CLIENT_UPDATE ) {
|
||||
attrs = uuid_attr;
|
||||
attrs[0].an_desc = slap_schema.si_ad_entryUUID;
|
||||
attrs[0].an_oc = NULL;
|
||||
attrs[0].an_name = attrs[0].an_desc->ad_cname;
|
||||
attrs[1].an_desc = NULL;
|
||||
attrs[1].an_oc = NULL;
|
||||
attrs[1].an_name.bv_len = 0;
|
||||
attrs[1].an_name.bv_val = NULL;
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if (sop->o_ps_protocol == LDAP_SYNC ) {
|
||||
attrs = uuid_attr;
|
||||
attrs[0].an_desc = NULL;
|
||||
@ -461,7 +433,6 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
attrs[0].an_name.bv_len = 0;
|
||||
attrs[0].an_name.bv_val = NULL;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rs->sr_err = 1;
|
||||
goto done;
|
||||
@ -471,14 +442,8 @@ int bdb_search( Operation *op, SlapReply *rs )
|
||||
|
||||
manageDSAit = get_manageDSAit( sop );
|
||||
|
||||
/* Sync / LCUP controls override manageDSAit */
|
||||
/* Sync control overrides manageDSAit */
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( !IS_PSEARCH && sop->o_clientupdate_type & SLAP_LCUP_SYNC ) {
|
||||
if ( manageDSAit == SLAP_NO_CONTROL )
|
||||
manageDSAit = SLAP_CRITICAL_CONTROL;
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( !IS_PSEARCH && sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
|
||||
if ( manageDSAit == SLAP_NO_CONTROL )
|
||||
@ -727,7 +692,7 @@ dn2entry_retry:
|
||||
/* start cursor at beginning of candidates.
|
||||
*/
|
||||
cursor = 0;
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if (IS_PSEARCH) {
|
||||
if ( !BDB_IDL_IS_RANGE( candidates ) ) {
|
||||
cursor = bdb_idl_search( candidates, ps_e->e_id );
|
||||
@ -810,37 +775,6 @@ dn2entry_retry:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( (sop->o_clientupdate_type & SLAP_LCUP_SYNC) ||
|
||||
(IS_PSEARCH && sop->o_ps_protocol == LDAP_CLIENT_UPDATE ))
|
||||
{
|
||||
cookief.f_choice = LDAP_FILTER_AND;
|
||||
cookief.f_and = &csnfnot;
|
||||
cookief.f_next = NULL;
|
||||
|
||||
csnfnot.f_choice = LDAP_FILTER_NOT;
|
||||
csnfnot.f_not = &csnfeq;
|
||||
csnfnot.f_next = &csnfand;
|
||||
|
||||
csnfeq.f_choice = LDAP_FILTER_EQUALITY;
|
||||
csnfeq.f_ava = &aa_eq;
|
||||
csnfeq.f_av_desc = slap_schema.si_ad_entryCSN;
|
||||
csnfeq.f_av_value = sop->o_clientupdate_state;
|
||||
|
||||
csnfand.f_choice = LDAP_FILTER_AND;
|
||||
csnfand.f_and = &csnfge;
|
||||
csnfand.f_next = NULL;
|
||||
|
||||
csnfge.f_choice = LDAP_FILTER_GE;
|
||||
csnfge.f_ava = &aa_ge;
|
||||
csnfge.f_av_desc = slap_schema.si_ad_entryCSN;
|
||||
csnfge.f_av_value = sop->o_clientupdate_state;
|
||||
csnfge.f_next = sop->oq_search.rs_filter;
|
||||
}
|
||||
#endif
|
||||
#if defined(LDAP_CLIENT_UPDATE) && defined(LDAP_SYNC)
|
||||
else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( (sop->o_sync_mode & SLAP_SYNC_REFRESH) ||
|
||||
( IS_PSEARCH && sop->o_ps_protocol == LDAP_SYNC ))
|
||||
@ -903,7 +837,7 @@ loop_begin:
|
||||
}
|
||||
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if (!IS_PSEARCH) {
|
||||
#endif
|
||||
id2entry_retry:
|
||||
@ -945,7 +879,7 @@ id2entry_retry:
|
||||
|
||||
goto loop_continue;
|
||||
}
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
} else {
|
||||
e = ps_e;
|
||||
}
|
||||
@ -1090,7 +1024,7 @@ id2entry_retry:
|
||||
#endif
|
||||
|
||||
/* if it matches the filter and scope, send it */
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if (IS_PSEARCH) {
|
||||
if (ps_type != LDAP_PSEARCH_BY_SCOPEOUT) {
|
||||
rs->sr_err = test_filter( sop, rs->sr_entry, &cookief );
|
||||
@ -1098,12 +1032,6 @@ id2entry_retry:
|
||||
rs->sr_err = LDAP_COMPARE_TRUE;
|
||||
}
|
||||
} else {
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( sop->o_clientupdate_type & SLAP_LCUP_SYNC ) {
|
||||
rs->sr_err = test_filter( sop, rs->sr_entry, &cookief );
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
|
||||
rc_sync = test_filter( sop, rs->sr_entry, &cookief );
|
||||
rs->sr_err = test_filter( sop,
|
||||
@ -1116,20 +1044,19 @@ id2entry_retry:
|
||||
}
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
rs->sr_err = test_filter( sop,
|
||||
rs->sr_entry, sop->oq_search.rs_filter );
|
||||
}
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( rs->sr_err == LDAP_COMPARE_TRUE ) {
|
||||
/* check size limit */
|
||||
if ( --sop->oq_search.rs_slimit == -1 ) {
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if (!IS_PSEARCH)
|
||||
#endif
|
||||
bdb_cache_return_entry_r( bdb->bi_dbenv,
|
||||
@ -1162,12 +1089,10 @@ id2entry_retry:
|
||||
result = 0;
|
||||
} else
|
||||
#endif
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
if (IS_PSEARCH) {
|
||||
#ifdef LDAP_SYNC
|
||||
if (IS_PSEARCH) {
|
||||
int premodify_found = 0;
|
||||
int entry_sync_state;
|
||||
#endif
|
||||
|
||||
if ( ps_type == LDAP_PSEARCH_BY_ADD ||
|
||||
ps_type == LDAP_PSEARCH_BY_DELETE ||
|
||||
@ -1180,16 +1105,13 @@ id2entry_retry:
|
||||
&op->o_pm_list, ps_link)
|
||||
{
|
||||
if( psid_e->ps_op == sop ) {
|
||||
#ifdef LDAP_SYNC
|
||||
premodify_found = 1;
|
||||
#endif
|
||||
LDAP_LIST_REMOVE(psid_e, ps_link);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (psid_e != NULL) free (psid_e);
|
||||
}
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ps_type == LDAP_PSEARCH_BY_ADD ) {
|
||||
entry_sync_state = LDAP_SYNC_ADD;
|
||||
} else if ( ps_type == LDAP_PSEARCH_BY_DELETE ) {
|
||||
@ -1206,33 +1128,6 @@ id2entry_retry:
|
||||
rs->sr_err = 1;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( sop->o_ps_protocol == LDAP_CLIENT_UPDATE ) {
|
||||
int entry_count = ++sop->o_ps_entries;
|
||||
if ( IS_BDB_REPLACE(ps_type) ) {
|
||||
rs->sr_err = bdb_build_lcup_update_ctrl( sop,
|
||||
rs, e, entry_count, ctrls,
|
||||
num_ctrls++, &latest_entrycsn_bv,
|
||||
SLAP_LCUP_ENTRY_DELETED_TRUE );
|
||||
} else {
|
||||
rs->sr_err = bdb_build_lcup_update_ctrl( sop,
|
||||
rs, e, entry_count, ctrls,
|
||||
num_ctrls++, &latest_entrycsn_bv,
|
||||
SLAP_LCUP_ENTRY_DELETED_FALSE );
|
||||
}
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) goto done;
|
||||
rs->sr_attrs = attrs;
|
||||
rs->sr_ctrls = ctrls;
|
||||
result = send_search_entry( sop, rs );
|
||||
ch_free( ctrls[num_ctrls-1]->ldctl_value.bv_val );
|
||||
ch_free( ctrls[--num_ctrls] );
|
||||
ctrls[num_ctrls] = NULL;
|
||||
rs->sr_ctrls = NULL;
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( sop->o_ps_protocol == LDAP_SYNC ) {
|
||||
rs->sr_err = bdb_build_sync_state_ctrl( sop,
|
||||
rs, e, entry_sync_state, ctrls,
|
||||
@ -1246,7 +1141,6 @@ id2entry_retry:
|
||||
ctrls[num_ctrls] = NULL;
|
||||
rs->sr_ctrls = NULL;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rs->sr_err = 1;
|
||||
goto done;
|
||||
@ -1264,23 +1158,6 @@ id2entry_retry:
|
||||
printf("Error !\n");
|
||||
}
|
||||
} else {
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( sop->o_clientupdate_type & SLAP_LCUP_SYNC ) {
|
||||
rs->sr_err = bdb_build_lcup_update_ctrl( sop,
|
||||
rs, e, ++entry_count, ctrls,
|
||||
num_ctrls++, &latest_entrycsn_bv,
|
||||
SLAP_LCUP_ENTRY_DELETED_FALSE );
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) goto done;
|
||||
rs->sr_ctrls = ctrls;
|
||||
rs->sr_attrs = sop->oq_search.rs_attrs;
|
||||
result = send_search_entry( sop, rs );
|
||||
ch_free( ctrls[num_ctrls-1]->ldctl_value.bv_val );
|
||||
ch_free( ctrls[--num_ctrls] );
|
||||
ctrls[num_ctrls] = NULL;
|
||||
rs->sr_ctrls = NULL;
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
|
||||
rs->sr_err = bdb_build_sync_state_ctrl( sop,
|
||||
rs, e, entry_sync_state, ctrls,
|
||||
@ -1299,7 +1176,6 @@ id2entry_retry:
|
||||
ctrls[num_ctrls] = NULL;
|
||||
rs->sr_ctrls = NULL;
|
||||
} else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
rs->sr_attrs = sop->oq_search.rs_attrs;
|
||||
@ -1349,26 +1225,6 @@ loop_continue:
|
||||
}
|
||||
|
||||
if (!IS_PSEARCH) {
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( sop->o_clientupdate_type & SLAP_LCUP_SYNC ) {
|
||||
bdb_build_lcup_done_ctrl( sop, rs, ctrls,
|
||||
num_ctrls++, &latest_entrycsn_bv );
|
||||
|
||||
rs->sr_ctrls = ctrls;
|
||||
rs->sr_ref = rs->sr_v2ref;
|
||||
rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
|
||||
send_ldap_result( sop, rs );
|
||||
|
||||
ch_free( latest_entrycsn_bv.bv_val );
|
||||
latest_entrycsn_bv.bv_val = NULL;
|
||||
|
||||
if ( ctrls[num_ctrls-1]->ldctl_value.bv_val != NULL ) {
|
||||
ch_free( ctrls[num_ctrls-1]->ldctl_value.bv_val );
|
||||
}
|
||||
ch_free( ctrls[--num_ctrls] );
|
||||
ctrls[num_ctrls] = NULL;
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
|
||||
if ( sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
|
||||
@ -1700,144 +1556,6 @@ done:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
int
|
||||
bdb_build_lcup_update_ctrl(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
Entry *e,
|
||||
int entry_count,
|
||||
LDAPControl **ctrls,
|
||||
int num_ctrls,
|
||||
struct berval *latest_entrycsn_bv,
|
||||
int isdeleted )
|
||||
{
|
||||
Attribute* a;
|
||||
int ret;
|
||||
int res;
|
||||
const char *text = NULL;
|
||||
|
||||
char berbuf[LBER_ELEMENT_SIZEOF];
|
||||
BerElement *ber = (BerElement *)berbuf;
|
||||
|
||||
struct berval entrycsn_bv = { 0, NULL };
|
||||
|
||||
ber_init2( ber, 0, LBER_USE_DER );
|
||||
|
||||
ctrls[num_ctrls] = ch_malloc ( sizeof ( LDAPControl ) );
|
||||
|
||||
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
|
||||
AttributeDescription *desc = a->a_desc;
|
||||
if ( desc == slap_schema.si_ad_entryCSN ) {
|
||||
ber_dupbv( &entrycsn_bv, &a->a_vals[0] );
|
||||
if ( latest_entrycsn_bv->bv_val == NULL ) {
|
||||
ber_dupbv( latest_entrycsn_bv, &entrycsn_bv );
|
||||
} else {
|
||||
res = value_match( &ret, desc,
|
||||
desc->ad_type->sat_ordering, 0,
|
||||
&entrycsn_bv, latest_entrycsn_bv, &text );
|
||||
if ( res != LDAP_SUCCESS ) {
|
||||
ret = 0;
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, RESULTS,
|
||||
"bdb_search: value_match failed\n",
|
||||
0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_search: value_match failed\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( ret > 0 ) {
|
||||
ch_free( latest_entrycsn_bv->bv_val );
|
||||
latest_entrycsn_bv->bv_val = NULL;
|
||||
ber_dupbv( latest_entrycsn_bv, &entrycsn_bv );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( entry_count % op->o_clientupdate_interval == 0 ) {
|
||||
ber_printf( ber,
|
||||
"{bb{sON}N}",
|
||||
SLAP_LCUP_STATE_UPDATE_FALSE,
|
||||
isdeleted,
|
||||
LDAP_CUP_COOKIE_OID, &entrycsn_bv );
|
||||
} else { /* Do not send cookie */
|
||||
ber_printf( ber,
|
||||
"{bbN}",
|
||||
SLAP_LCUP_STATE_UPDATE_FALSE,
|
||||
isdeleted );
|
||||
}
|
||||
|
||||
ch_free( entrycsn_bv.bv_val );
|
||||
entrycsn_bv.bv_val = NULL;
|
||||
|
||||
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_ENTRY_UPDATE;
|
||||
ctrls[num_ctrls]->ldctl_iscritical = op->o_clientupdate;
|
||||
ret = ber_flatten2( ber, &ctrls[num_ctrls]->ldctl_value, 1 );
|
||||
|
||||
ber_free_buf( ber );
|
||||
|
||||
if ( ret < 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, RESULTS,
|
||||
"bdb_build_lcup_ctrl: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_build_lcup_ctrl: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
bdb_build_lcup_done_ctrl(
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
LDAPControl **ctrls,
|
||||
int num_ctrls,
|
||||
struct berval *latest_entrycsn_bv )
|
||||
{
|
||||
int ret;
|
||||
char berbuf[LBER_ELEMENT_SIZEOF];
|
||||
BerElement *ber = (BerElement *)berbuf;
|
||||
|
||||
ber_init2( ber, NULL, LBER_USE_DER );
|
||||
|
||||
ctrls[num_ctrls] = ch_malloc ( sizeof ( LDAPControl ) );
|
||||
|
||||
ber_printf( ber, "{sON}", LDAP_CUP_COOKIE_OID, latest_entrycsn_bv );
|
||||
|
||||
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_CLIENT_UPDATE_DONE;
|
||||
ctrls[num_ctrls]->ldctl_iscritical = op->o_clientupdate;
|
||||
ret = ber_flatten2( ber, &ctrls[num_ctrls]->ldctl_value, 1 );
|
||||
|
||||
ber_free_buf( ber );
|
||||
|
||||
if ( ret < 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, RESULTS,
|
||||
"bdb_build_lcup_done_ctrl: ber_flatten2 failed\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_build_lcup_done_ctrl: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
int
|
||||
bdb_build_sync_state_ctrl(
|
||||
@ -1966,11 +1684,11 @@ bdb_build_sync_done_ctrl(
|
||||
if ( ret < 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, RESULTS,
|
||||
"bdb_build_lcup_done_ctrl: ber_flatten2 failed\n",
|
||||
"bdb_build_sync_done_ctrl: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_build_lcup_done_ctrl: ber_flatten2 failed\n",
|
||||
"bdb_build_sync_done_ctrl: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
|
||||
@ -2006,11 +1724,11 @@ bdb_send_ldap_intermediate(
|
||||
if ( ret < 0 ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, RESULTS,
|
||||
"bdb_build_lcup_done_ctrl: ber_flatten2 failed\n",
|
||||
"bdb_send_ldap_intermediate: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"bdb_build_lcup_done_ctrl: ber_flatten2 failed\n",
|
||||
"bdb_send_ldap_intermediate: ber_flatten2 failed\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
|
||||
|
@ -1069,17 +1069,9 @@ operations_error:
|
||||
LDAP_STAILQ_REMOVE( &conn->c_ops, op, slap_op, o_next);
|
||||
LDAP_STAILQ_NEXT(op, o_next) = NULL;
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
if ( op->o_cancel == SLAP_CANCEL_ACK )
|
||||
goto co_op_free;
|
||||
#endif
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( ( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) ) {
|
||||
sl_mem_detach( ctx, memctx );
|
||||
goto no_co_op_free;
|
||||
}
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) ) {
|
||||
sl_mem_detach( ctx, memctx );
|
||||
goto no_co_op_free;
|
||||
|
@ -31,9 +31,6 @@ static SLAP_CTRL_PARSE_FN parseDomainScope;
|
||||
#ifdef LDAP_CONTROL_SUBENTRIES
|
||||
static SLAP_CTRL_PARSE_FN parseSubentries;
|
||||
#endif
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
static SLAP_CTRL_PARSE_FN parseClientUpdate;
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
static SLAP_CTRL_PARSE_FN parseLdupSync;
|
||||
#endif
|
||||
@ -100,11 +97,6 @@ static struct slap_control control_defs[] = {
|
||||
{ LDAP_CONTROL_NOOP,
|
||||
SLAP_CTRL_ACCESS, NULL,
|
||||
parseNoOp, LDAP_SLIST_ENTRY_INITIALIZER(next) },
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
{ LDAP_CONTROL_CLIENT_UPDATE,
|
||||
SLAP_CTRL_HIDE|SLAP_CTRL_SEARCH, NULL,
|
||||
parseClientUpdate, LDAP_SLIST_ENTRY_INITIALIZER(next) },
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
{ LDAP_CONTROL_SYNC,
|
||||
SLAP_CTRL_HIDE|SLAP_CTRL_SEARCH, NULL,
|
||||
@ -1071,137 +1063,6 @@ static int parseDomainScope (
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
static int parseClientUpdate (
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
LDAPControl *ctrl )
|
||||
{
|
||||
ber_tag_t tag;
|
||||
BerElement *ber;
|
||||
ber_int_t type;
|
||||
ber_int_t interval;
|
||||
ber_len_t len;
|
||||
struct berval scheme = { 0, NULL };
|
||||
struct berval cookie = { 0, NULL };
|
||||
|
||||
if ( op->o_clientupdate != SLAP_NO_CONTROL ) {
|
||||
rs->sr_text = "LCUP client update control specified multiple times";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
if ( op->o_sync != SLAP_NO_CONTROL ) {
|
||||
rs->sr_text = "LDAP Client Update and Sync controls used together";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( ctrl->ldctl_value.bv_len == 0 ) {
|
||||
rs->sr_text = "LCUP client update control value is empty (or absent)";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
/* Parse the control value
|
||||
* ClientUpdateControlValue ::= SEQUENCE {
|
||||
* updateType ENUMERATED {
|
||||
* synchronizeOnly {0},
|
||||
* synchronizeAndPersist {1},
|
||||
* persistOnly {2} },
|
||||
* sendCookieInterval INTEGER OPTIONAL,
|
||||
* cookie LCUPCookie OPTIONAL
|
||||
* }
|
||||
*/
|
||||
|
||||
ber = ber_init( &ctrl->ldctl_value );
|
||||
if( ber == NULL ) {
|
||||
rs->sr_text = "internal error";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
if ( (tag = ber_scanf( ber, "{i" /*}*/, &type )) == LBER_ERROR ) {
|
||||
rs->sr_text = "LCUP client update control : decoding error";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
switch( type ) {
|
||||
case LDAP_CUP_SYNC_ONLY:
|
||||
type = SLAP_LCUP_SYNC;
|
||||
break;
|
||||
case LDAP_CUP_SYNC_AND_PERSIST:
|
||||
type = SLAP_LCUP_SYNC_AND_PERSIST;
|
||||
break;
|
||||
case LDAP_CUP_PERSIST_ONLY:
|
||||
type = SLAP_LCUP_PERSIST;
|
||||
break;
|
||||
default:
|
||||
rs->sr_text = "LCUP client update control : unknown update type";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
if ( (tag = ber_peek_tag( ber, &len )) == LBER_DEFAULT ) {
|
||||
rs->sr_text = "LCUP client update control : decoding error";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
if ( tag == LDAP_CUP_TAG_INTERVAL ) {
|
||||
if ( (tag = ber_scanf( ber, "i", &interval )) == LBER_ERROR ) {
|
||||
rs->sr_text = "LCUP client update control : decoding error";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
if ( interval <= 0 ) {
|
||||
/* server chooses interval */
|
||||
interval = LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* server chooses interval */
|
||||
interval = LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL;
|
||||
}
|
||||
|
||||
if ( (tag = ber_peek_tag( ber, &len )) == LBER_DEFAULT ) {
|
||||
rs->sr_text = "LCUP client update control : decoding error";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
if ( tag == LDAP_CUP_TAG_COOKIE ) {
|
||||
if ( (tag = ber_scanf( ber, /*{*/ "{mm}}",
|
||||
&scheme, &cookie )) == LBER_ERROR )
|
||||
{
|
||||
rs->sr_text = "LCUP client update control : decoding error";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO : Cookie Scheme Validation */
|
||||
#if 0
|
||||
if ( lcup_cookie_scheme_validate(scheme) != LDAP_SUCCESS ) {
|
||||
rs->sr_text = "Unsupported LCUP cookie scheme";
|
||||
return LCUP_UNSUPPORTED_SCHEME;
|
||||
}
|
||||
|
||||
if ( lcup_cookie_validate(scheme, cookie) != LDAP_SUCCESS ) {
|
||||
rs->sr_text = "Invalid LCUP cookie";
|
||||
return LCUP_INVALID_COOKIE;
|
||||
}
|
||||
#endif
|
||||
|
||||
ber_dupbv( &op->o_clientupdate_state, &cookie );
|
||||
|
||||
(void) ber_free( ber, 1 );
|
||||
|
||||
op->o_clientupdate_type = (char) type;
|
||||
op->o_clientupdate_interval = interval;
|
||||
|
||||
op->o_clientupdate = ctrl->ldctl_iscritical
|
||||
? SLAP_CRITICAL_CONTROL
|
||||
: SLAP_NONCRITICAL_CONTROL;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
static int parseLdupSync (
|
||||
Operation *op,
|
||||
@ -1219,13 +1080,6 @@ static int parseLdupSync (
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( op->o_clientupdate != SLAP_NO_CONTROL ) {
|
||||
rs->sr_text = "LDAP Sync and LDAP Client Update controls used together";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( ctrl->ldctl_value.bv_len == 0 ) {
|
||||
rs->sr_text = "LDAP Sync control value is empty (or absent)";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
@ -1283,19 +1137,6 @@ static int parseLdupSync (
|
||||
cookie.bv_val = NULL;
|
||||
}
|
||||
|
||||
/* TODO : Cookie Scheme Validation */
|
||||
#if 0
|
||||
if ( lcup_cookie_scheme_validate(scheme) != LDAP_SUCCESS ) {
|
||||
rs->sr_text = "Unsupported LCUP cookie scheme";
|
||||
return LCUP_UNSUPPORTED_SCHEME;
|
||||
}
|
||||
|
||||
if ( lcup_cookie_validate(scheme, cookie) != LDAP_SUCCESS ) {
|
||||
rs->sr_text = "Invalid LCUP cookie";
|
||||
return LCUP_INVALID_COOKIE;
|
||||
}
|
||||
#endif
|
||||
|
||||
ber_dupbv( &op->o_sync_state, &cookie );
|
||||
|
||||
(void) ber_free( ber, 1 );
|
||||
|
@ -65,11 +65,6 @@ slap_op_free( Operation *op )
|
||||
ber_free( op->o_res_ber, 1 );
|
||||
}
|
||||
#endif
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( op->o_clientupdate_state.bv_val != NULL ) {
|
||||
free( op->o_clientupdate_state.bv_val );
|
||||
}
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( op->o_sync_state.bv_val != NULL ) {
|
||||
free( op->o_sync_state.bv_val );
|
||||
|
@ -334,14 +334,9 @@ do_search(
|
||||
* if we don't hold it.
|
||||
*/
|
||||
|
||||
/* Sync / LCUP controls override manageDSAit */
|
||||
/* Sync control overrides manageDSAit */
|
||||
|
||||
if ( manageDSAit != SLAP_NO_CONTROL ) {
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
|
||||
be_manageDSAit = SLAP_NO_CONTROL;
|
||||
} else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
|
||||
be_manageDSAit = SLAP_NO_CONTROL;
|
||||
@ -404,13 +399,6 @@ do_search(
|
||||
|
||||
return_results:;
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
if ( ( op->o_clientupdate_type & SLAP_LCUP_PERSIST ) )
|
||||
return rs->sr_err;
|
||||
#endif
|
||||
#if defined(LDAP_CLIENT_UPDATE) && defined(LDAP_SYNC)
|
||||
else
|
||||
#endif
|
||||
#ifdef LDAP_SYNC
|
||||
if ( ( op->o_sync_mode & SLAP_SYNC_PERSIST ) )
|
||||
return rs->sr_err;
|
||||
|
@ -229,10 +229,6 @@ typedef struct slap_ssf_set {
|
||||
#define SLAP_SYNTAX_MATCHINGRULEUSES_OID "1.3.6.1.4.1.1466.115.121.1.31"
|
||||
#define SLAP_SYNTAX_CONTENTRULE_OID "1.3.6.1.4.1.1466.115.121.1.16"
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#define LCUP_COOKIE_OID "1.3.6.1.4.1.4203.666.10.1"
|
||||
#endif /* LDAP_CLIENT_UPDATE */
|
||||
|
||||
/*
|
||||
* represents schema information for a database
|
||||
*/
|
||||
@ -1795,7 +1791,7 @@ typedef struct slap_paged_state {
|
||||
} PagedResultsState;
|
||||
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
#define LDAP_PSEARCH_BY_ADD 0x01
|
||||
#define LDAP_PSEARCH_BY_DELETE 0x02
|
||||
#define LDAP_PSEARCH_BY_PREMODIFY 0x03
|
||||
@ -1932,17 +1928,6 @@ typedef struct slap_op {
|
||||
#define get_pagedresults(op) (0)
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
char o_clientupdate;
|
||||
char o_clientupdate_type;
|
||||
#define SLAP_LCUP_NONE (0x0)
|
||||
#define SLAP_LCUP_SYNC (0x1)
|
||||
#define SLAP_LCUP_PERSIST (0x2)
|
||||
#define SLAP_LCUP_SYNC_AND_PERSIST (0x3)
|
||||
ber_int_t o_clientupdate_interval;
|
||||
struct berval o_clientupdate_state;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_SYNC
|
||||
char o_sync;
|
||||
char o_sync_mode;
|
||||
@ -1951,9 +1936,7 @@ typedef struct slap_op {
|
||||
#define SLAP_SYNC_PERSIST (0x2)
|
||||
#define SLAP_SYNC_REFRESH_AND_PERSIST (0x3)
|
||||
struct berval o_sync_state;
|
||||
#endif
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
int o_ps_protocol;
|
||||
int o_ps_entries;
|
||||
LDAP_LIST_ENTRY(slap_op) o_ps_link;
|
||||
@ -2190,17 +2173,7 @@ enum {
|
||||
#define SLAP_LDAPDN_PRETTY 0x1
|
||||
#define SLAP_LDAPDN_MAXLEN 8192
|
||||
|
||||
/*
|
||||
* Macros for LCUP
|
||||
*/
|
||||
#ifdef LDAP_CLIENT_UPDATE
|
||||
#define SLAP_LCUP_STATE_UPDATE_TRUE 1
|
||||
#define SLAP_LCUP_STATE_UPDATE_FALSE 0
|
||||
#define SLAP_LCUP_ENTRY_DELETED_TRUE 1
|
||||
#define SLAP_LCUP_ENTRY_DELETED_FALSE 0
|
||||
#endif /* LDAP_CLIENT_UPDATE */
|
||||
|
||||
#if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
|
||||
#ifdef LDAP_SYNC
|
||||
#define SLAP_SEARCH_MAX_CTRLS 10
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user