/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2014 The OpenLDAP Foundation.
+ * Copyright 1998-2017 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#ifdef SLAP_CONTROL_X_WHATFAILED
static SLAP_CTRL_PARSE_FN parseWhatFailed;
#endif
+#ifdef SLAP_CONTROL_X_LAZY_COMMIT
+static SLAP_CTRL_PARSE_FN parseLazyCommit;
+#endif
#undef sc_mask /* avoid conflict with Irix 6.5 <sys/signal.h> */
NULL, NULL,
parseWhatFailed, LDAP_SLIST_ENTRY_INITIALIZER(next) },
#endif
+#ifdef SLAP_CONTROL_X_LAZY_COMMIT
+ { LDAP_CONTROL_X_LAZY_COMMIT,
+ (int)offsetof(struct slap_control_ids, sc_lazyCommit),
+ SLAP_CTRL_GLOBAL|SLAP_CTRL_ACCESS|SLAP_CTRL_HIDE,
+ NULL, NULL,
+ parseLazyCommit, LDAP_SLIST_ENTRY_INITIALIZER(next) },
+#endif
{ NULL, 0, 0, NULL, 0, NULL, LDAP_SLIST_ENTRY_INITIALIZER(next) }
};
if ( sc == NULL ) {
sc = (struct slap_control *)SLAP_MALLOC( sizeof( *sc ) );
if ( sc == NULL ) {
+ ber_bvarray_free( extendedopsbv );
return LDAP_NO_MEMORY;
}
{
int i;
- if( op->o_assertion != NULL ) {
- filter_free_x( op, op->o_assertion, 1 );
- op->o_assertion = NULL;
- }
- if( op->o_vrFilter != NULL) {
- vrFilter_free( op, op->o_vrFilter );
- op->o_vrFilter = NULL;
- }
- if( op->o_preread_attrs != NULL ) {
- op->o_tmpfree( op->o_preread_attrs, op->o_tmpmemctx );
- op->o_preread_attrs = NULL;
- }
- if( op->o_postread_attrs != NULL ) {
- op->o_tmpfree( op->o_postread_attrs, op->o_tmpmemctx );
- op->o_postread_attrs = NULL;
- }
- if( op->o_pagedresults_state != NULL ) {
- op->o_tmpfree( op->o_pagedresults_state, op->o_tmpmemctx );
- op->o_pagedresults_state = NULL;
+ if( ctrls == op->o_ctrls ) {
+ if( op->o_assertion != NULL ) {
+ filter_free_x( op, op->o_assertion, 1 );
+ op->o_assertion = NULL;
+ }
+ if( op->o_vrFilter != NULL) {
+ vrFilter_free( op, op->o_vrFilter );
+ op->o_vrFilter = NULL;
+ }
+ if( op->o_preread_attrs != NULL ) {
+ op->o_tmpfree( op->o_preread_attrs, op->o_tmpmemctx );
+ op->o_preread_attrs = NULL;
+ }
+ if( op->o_postread_attrs != NULL ) {
+ op->o_tmpfree( op->o_postread_attrs, op->o_tmpmemctx );
+ op->o_postread_attrs = NULL;
+ }
+ if( op->o_pagedresults_state != NULL ) {
+ op->o_tmpfree( op->o_pagedresults_state, op->o_tmpmemctx );
+ op->o_pagedresults_state = NULL;
+ }
}
for (i=0; ctrls[i]; i++) {
} else if( c->ldctl_oid == NULL ) {
Debug( LDAP_DEBUG_TRACE,
- "get_ctrls: conn %lu got emtpy OID.\n",
+ "get_ctrls: conn %lu got empty OID.\n",
op->o_connid, 0, 0 );
slap_free_ctrls( op, op->o_ctrls );
}
if( op->o_assertion != NULL ) {
filter_free_x( op, op->o_assertion, 1 );
+ op->o_assertion = NULL;
}
return rs->sr_err;
}
return rc;
}
#endif
+
+#ifdef SLAP_CONTROL_X_LAZY_COMMIT
+static int parseLazyCommit(
+ Operation *op,
+ SlapReply *rs,
+ LDAPControl *ctrl )
+{
+ if ( op->o_lazyCommit != SLAP_CONTROL_NONE ) {
+ rs->sr_text = "\"Lazy Commit?\" control specified multiple times";
+ return LDAP_PROTOCOL_ERROR;
+ }
+
+ if ( !BER_BVISNULL( &ctrl->ldctl_value )) {
+ rs->sr_text = "\"Lazy Commit?\" control value not absent";
+ return LDAP_PROTOCOL_ERROR;
+ }
+
+ op->o_lazyCommit = ctrl->ldctl_iscritical
+ ? SLAP_CONTROL_CRITICAL
+ : SLAP_CONTROL_NONCRITICAL;
+
+ return LDAP_SUCCESS;
+}
+#endif