enum { Intr_None = 0, Intr_Abandon, Intr_Cancel, Intr_Ignore };
static volatile sig_atomic_t gotintr, abcan;
+int backlog;
+
#ifdef LDAP_CONTROL_X_SESSION_TRACKING
static int
gotintr = abcan;
}
+ } else if ( strcasecmp( control, "backlog" ) == 0 ) {
+ /* special search: accumulate lots of responses
+ * but don't read any, force slapd writer to wait.
+ * Then abandon the search and issue a new one.
+ */
+ backlog = 1;
+
} else if ( tool_is_oid( control ) ) {
LDAPControl *tmpctrls, ctrl;
tv_timelimitp = &tv_timelimit;
}
+again:
rc = ldap_search_ext( ld, base, scope, filter, attrs, attrsonly,
sctrls, cctrls, tv_timelimitp, sizelimit, &msgid );
tvp = &tv;
}
+ if ( backlog == 1 ) {
+ printf( _("\nWaiting for responses to accumulate, press Enter to continue: "));
+ fflush( stdout );
+ getchar();
+ printf( _("Abandoning msgid %d\n"), msgid );
+ ldap_abandon_ext( ld, msgid, NULL, NULL );
+ /* turn off syncrepl control */
+ ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, NULL );
+ backlog = 2;
+ scope = LDAP_SCOPE_BASE;
+ goto again;
+ } else if ( backlog == 2 ) {
+ tv.tv_sec = timelimit;
+ }
+
while ((rc = ldap_result( ld, LDAP_RES_ANY,
sortattr ? LDAP_MSG_ALL : LDAP_MSG_ONE,
tvp, &res )) > 0 )