X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fcontrols.c;h=5599bd7b9d23092d2976390edb9a9297176a302a;hb=59e9ff6243465640956b58ad1756a3ede53eca7c;hp=9b51f9503464d038fcf8109f736b80c033d8e1f0;hpb=eb8c94919e13a4120c33908ffb46a8763824634d;p=openldap
diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c
index 9b51f95034..5599bd7b9d 100644
--- a/servers/slapd/controls.c
+++ b/servers/slapd/controls.c
@@ -1,7 +1,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 1998-2014 The OpenLDAP Foundation.
+ * Copyright 1998-2018 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,9 @@ static SLAP_CTRL_PARSE_FN parseSessionTracking;
#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 */
@@ -226,6 +229,13 @@ static struct slap_control control_defs[] = {
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) }
};
@@ -304,6 +314,7 @@ register_supported_control2(const char *controloid,
if ( sc == NULL ) {
sc = (struct slap_control *)SLAP_MALLOC( sizeof( *sc ) );
if ( sc == NULL ) {
+ ber_bvarray_free( extendedopsbv );
return LDAP_NO_MEMORY;
}
@@ -832,7 +843,7 @@ get_ctrls2(
} 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 );
@@ -1402,6 +1413,7 @@ static int parseAssert (
}
if( op->o_assertion != NULL ) {
filter_free_x( op, op->o_assertion, 1 );
+ op->o_assertion = NULL;
}
return rs->sr_err;
}
@@ -2154,3 +2166,27 @@ done:;
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