Commit ef60ec1d authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

ITS#9600 Protect connection while interacting with it

parent 6cc6ec2f
...@@ -536,6 +536,14 @@ lload_monitor_conn_modify( Operation *op, SlapReply *rs, Entry *e, void *priv ) ...@@ -536,6 +536,14 @@ lload_monitor_conn_modify( Operation *op, SlapReply *rs, Entry *e, void *priv )
{ {
Modifications *m; Modifications *m;
LloadConnection *c = priv; LloadConnection *c = priv;
int rc = SLAP_CB_CONTINUE;
epoch_t epoch;
if ( !acquire_ref( &c->c_refcnt ) ) {
/* Shutting down, pretend it's already happened */
return LDAP_NO_SUCH_OBJECT;
}
epoch = epoch_join();
for ( m = op->orm_modlist; m; m = m->sml_next ) { for ( m = op->orm_modlist; m; m = m->sml_next ) {
struct berval closing = BER_BVC("closing"); struct berval closing = BER_BVC("closing");
...@@ -546,14 +554,19 @@ lload_monitor_conn_modify( Operation *op, SlapReply *rs, Entry *e, void *priv ) ...@@ -546,14 +554,19 @@ lload_monitor_conn_modify( Operation *op, SlapReply *rs, Entry *e, void *priv )
if ( m->sml_desc != ad_olmConnectionState || if ( m->sml_desc != ad_olmConnectionState ||
m->sml_op != LDAP_MOD_REPLACE || m->sml_numvals != 1 || m->sml_op != LDAP_MOD_REPLACE || m->sml_numvals != 1 ||
ber_bvcmp( &m->sml_nvalues[0], &closing ) ) { ber_bvcmp( &m->sml_nvalues[0], &closing ) ) {
return LDAP_OTHER; rc = LDAP_CONSTRAINT_VIOLATION;
goto done;
} }
if ( lload_connection_close( c, &gentle ) ) { if ( lload_connection_close( c, &gentle ) ) {
return LDAP_OTHER; rc = LDAP_OTHER;
goto done;
} }
} }
return SLAP_CB_CONTINUE; done:
RELEASE_REF( c, c_refcnt, c->c_destroy );
epoch_leave( epoch );
return rc;
} }
/* /*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment