static void ltdb_callback(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *private_data) { struct ltdb_context *ctx; int ret; ctx = talloc_get_type(private_data, struct ltdb_context); if (ctx->request_terminated) { goto done; } switch (ctx->req->operation) { case LDB_SEARCH: ret = ltdb_search(ctx); break; case LDB_ADD: ret = ltdb_add(ctx); break; case LDB_MODIFY: ret = ltdb_modify(ctx); break; case LDB_DELETE: ret = ltdb_delete(ctx); break; case LDB_RENAME: ret = ltdb_rename(ctx); break; case LDB_EXTENDED: ltdb_handle_extended(ctx); goto done; default: /* no other op supported */ ret = LDB_ERR_PROTOCOL_ERROR; } if (!ctx->request_terminated) { /* request is done now */ ltdb_request_done(ctx, ret); } done: if (ctx->spy) { /* neutralize the spy */ ctx->spy->ctx = NULL; ctx->spy = NULL; } talloc_free(ctx); }
static void ltdb_timeout(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *private_data) { struct ltdb_context *ctx; ctx = talloc_get_type(private_data, struct ltdb_context); if (!ctx->request_terminated) { /* request is done now */ ltdb_request_done(ctx, LDB_ERR_TIME_LIMIT_EXCEEDED); } if (!ctx->request_terminated) { /* neutralize the spy */ ctx->spy->ctx = NULL; } talloc_free(ctx); }