80
80
handle = handles[mapi_req->handle_idx];
81
81
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
82
OPENCHANGE_RETVAL_IF(retval, retval, NULL);
83
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
84
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
84
88
retval = mapi_handles_get_private_data(parent, &data);
90
mapi_repl->error_code = retval;
91
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
85
95
object = (struct emsmdbp_object *) data;
88
98
table = object->object.table;
89
99
OPENCHANGE_RETVAL_IF(!table, MAPI_E_INVALID_PARAMETER, NULL);
101
if (table->ulType == MAPISTORE_RULE_TABLE) {
102
DEBUG(5, (" query on rules table are all faked right now\n"));
91
106
request = mapi_req->u.mapi_SetColumns;
92
108
if (request.prop_count) {
93
109
table->prop_count = request.prop_count;
94
table->properties = (uint32_t *) talloc_memdup(table, request.properties,
95
request.prop_count * sizeof (uint32_t));
110
table->properties = talloc_memdup(table, request.properties,
111
request.prop_count * sizeof (uint32_t));
112
if (emsmdbp_is_mapistore(object)) {
113
DEBUG(5, ("[%s] object: %p, backend_object: %p\n", __FUNCTION__, object, object->backend_object));
114
mapistore_table_set_columns(emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object),
115
object->backend_object, request.prop_count, request.properties);
117
/* openchangedb case */
118
DEBUG(5, ("[%s] object: Setting Columns on openchangedb table\n", __FUNCTION__));
99
DEBUG(0, ("RopSetColumns: returns MAPI_E_SUCCESS\n"));
100
124
return MAPI_E_SUCCESS;
136
169
mapi_repl->error_code = MAPI_E_SUCCESS;
137
170
mapi_repl->u.mapi_SortTable.TableStatus = TBLSTAT_COMPLETE;
172
if ((mapi_req->u.mapi_SortTable.SortTableFlags & TBL_ASYNC)) {
173
DEBUG(5, (" requested async operation -> failure\n"));
174
mapi_repl->error_code = MAPI_E_UNKNOWN_FLAGS;
178
handle = handles[mapi_req->handle_idx];
179
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
181
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
182
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
186
retval = mapi_handles_get_private_data(parent, &data);
188
mapi_repl->error_code = retval;
189
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
192
object = (struct emsmdbp_object *) data;
194
/* Ensure referring object exists and is a table */
195
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) {
196
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
197
DEBUG(5, (" missing object or not table\n"));
201
table = object->object.table;
202
OPENCHANGE_RETVAL_IF(!table, MAPI_E_INVALID_PARAMETER, NULL);
204
if (table->ulType != MAPISTORE_MESSAGE_TABLE
205
&& table->ulType != MAPISTORE_FAI_TABLE) {
206
mapi_repl->error_code = MAPI_E_NO_SUPPORT;
207
DEBUG(5, (" query performed on non contents table\n"));
211
OPENCHANGE_RETVAL_IF(!mapi_req, MAPI_E_INVALID_PARAMETER, NULL);
213
/* we reset the cursor to the beginning of the table */
214
table->numerator = 0;
216
/* TODO: we should invalidate current bookmarks on the table */
218
/* If parent folder has a mapistore context */
219
request = &mapi_req->u.mapi_SortTable;
220
if (emsmdbp_is_mapistore(object)) {
221
status = TBLSTAT_COMPLETE;
222
retval = mapistore_table_set_sort_order(emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object), object->backend_object, &request->lpSortCriteria, &status);
224
mapi_repl->error_code = retval;
227
mapi_repl->u.mapi_SortTable.TableStatus = status;
229
/* Parent folder doesn't have any mapistore context associated */
230
status = TBLSTAT_COMPLETE;
231
mapi_repl->u.mapi_SortTable.TableStatus = status;
232
retval = openchangedb_table_set_sort_order(object->backend_object, &request->lpSortCriteria);
234
mapi_repl->error_code = retval;
139
240
*size += libmapiserver_RopSortTable_size(mapi_repl);
141
242
return MAPI_E_SUCCESS;
171
281
OPENCHANGE_RETVAL_IF(!handles, MAPI_E_INVALID_PARAMETER, NULL);
172
282
OPENCHANGE_RETVAL_IF(!size, MAPI_E_INVALID_PARAMETER, NULL);
284
request = mapi_req->u.mapi_Restrict;
174
286
mapi_repl->opnum = mapi_req->opnum;
175
287
mapi_repl->handle_idx = mapi_req->handle_idx;
176
288
mapi_repl->error_code = MAPI_E_SUCCESS;
177
289
mapi_repl->u.mapi_Restrict.TableStatus = TBLSTAT_COMPLETE;
291
handle = handles[mapi_req->handle_idx];
292
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
294
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
295
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
299
retval = mapi_handles_get_private_data(parent, &data);
301
mapi_repl->error_code = retval;
302
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
305
object = (struct emsmdbp_object *) data;
307
/* Ensure referring object exists and is a table */
308
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) {
309
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
310
DEBUG(5, (" missing object or not table\n"));
314
table = object->object.table;
315
OPENCHANGE_RETVAL_IF(!table, MAPI_E_INVALID_PARAMETER, NULL);
317
table->restricted = true;
318
if (table->ulType == MAPISTORE_RULE_TABLE) {
319
DEBUG(5, (" query on rules table are all faked right now\n"));
323
/* If parent folder has a mapistore context */
324
if (emsmdbp_is_mapistore(object)) {
325
status = TBLSTAT_COMPLETE;
326
contextID = emsmdbp_get_contextID(object);
327
retval = mapistore_table_set_restrictions(emsmdbp_ctx->mstore_ctx, contextID, object->backend_object, &request.restrictions, &status);
329
mapi_repl->error_code = retval;
333
mapistore_table_get_row_count(emsmdbp_ctx->mstore_ctx, contextID, object->backend_object, MAPISTORE_PREFILTERED_QUERY, &object->object.table->denominator);
335
mapi_repl->u.mapi_Restrict.TableStatus = status;
337
/* Parent folder doesn't have any mapistore context associated */
339
DEBUG(0, ("not mapistore Restrict: Not implemented yet\n"));
179
344
*size += libmapiserver_RopRestrict_size(mapi_repl);
181
346
return MAPI_E_SUCCESS;
224
387
OPENCHANGE_RETVAL_IF(!handles, MAPI_E_INVALID_PARAMETER, NULL);
225
388
OPENCHANGE_RETVAL_IF(!size, MAPI_E_INVALID_PARAMETER, NULL);
227
request = mapi_req->u.mapi_QueryRows;
228
response = mapi_repl->u.mapi_QueryRows;
390
request = &mapi_req->u.mapi_QueryRows;
391
response = &mapi_repl->u.mapi_QueryRows;
230
393
mapi_repl->opnum = mapi_req->opnum;
231
394
mapi_repl->handle_idx = mapi_req->handle_idx;
232
395
mapi_repl->error_code = MAPI_E_NOT_FOUND;
234
response.RowData.length = 0;
397
response->RowData.length = 0;
236
399
handle = handles[mapi_req->handle_idx];
237
ret = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
240
ret = mapi_handles_get_private_data(parent, &data);
400
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
402
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
403
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
407
retval = mapi_handles_get_private_data(parent, &data);
409
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
241
413
object = (struct emsmdbp_object *) data;
243
415
/* Ensure referring object exists and is a table */
244
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) {
417
DEBUG(5, (" missing object\n"));
420
if (object->type != EMSMDBP_OBJECT_TABLE) {
421
DEBUG(5, (" unhandled object type: %d\n", object->type));
248
425
table = object->object.table;
249
if (!table->folderID) {
253
if ((request.RowCount + table->numerator) > table->denominator) {
254
request.RowCount = table->denominator - table->numerator;
257
/* If parent folder has a mapistore context */
258
if (table->mapistore == true) {
259
/* Lookup the properties and check if we need to flag the PropertyRow blob */
260
for (i = 0, count = 0; i < request.RowCount; i++, count++) {
263
/* Lookup for flagged property row */
264
for (j = 0; j < table->prop_count; j++) {
265
retval = mapistore_get_table_property(emsmdbp_ctx->mstore_ctx, table->contextID,
266
table->ulType, table->folderID,
267
(enum MAPITAGS) table->properties[j],
268
table->numerator, &data);
269
if (retval == MAPISTORE_ERR_INVALID_OBJECT || retval == MAPISTORE_ERROR) {
273
if (retval == MAPISTORE_ERR_NOT_FOUND) {
275
libmapiserver_push_property(mem_ctx,
276
0x0000000b, (const void *)&flagged,
277
&response.RowData, 0, 0);
282
/* StandardPropertyRow hack */
284
libmapiserver_push_property(mem_ctx,
285
0x00000000, (const void *)&flagged,
286
&response.RowData, 0, 1);
289
/* Push the properties */
290
for (j = 0; j < table->prop_count; j++) {
291
property = table->properties[j];
292
retval = mapistore_get_table_property(emsmdbp_ctx->mstore_ctx, table->contextID,
293
table->ulType, table->folderID,
294
(enum MAPITAGS) table->properties[j],
295
table->numerator, &data);
296
if (retval == MAPISTORE_ERR_INVALID_OBJECT || retval == MAPISTORE_ERROR) {
299
if (retval == MAPISTORE_ERR_NOT_FOUND) {
300
property = (property & 0xFFFF0000) + PT_ERROR;
301
data = (void *)&retval;
304
libmapiserver_push_property(mem_ctx,
305
property, (const void *)data, &response.RowData,
306
flagged?PT_ERROR:0, flagged);
428
if (table->ulType == MAPISTORE_RULE_TABLE) {
429
DEBUG(5, (" query on rules table are all faked right now\n"));
433
/* Ensure we are in a case which we can handle, until the featureset is complete. */
434
if (!request->ForwardRead) {
435
DEBUG(0, (" !ForwardRead is not supported yet\n"));
439
/* Lookup the properties */
440
max = table->numerator + request->RowCount;
441
if (max > table->denominator) {
442
max = table->denominator;
444
for (i = table->numerator; i < max; i++) {
445
data_pointers = emsmdbp_object_table_get_row_props(mem_ctx, emsmdbp_ctx, object, i, MAPISTORE_PREFILTERED_QUERY, &retvals);
447
emsmdbp_fill_table_row_blob(mem_ctx, emsmdbp_ctx,
448
&response->RowData, table->prop_count,
449
table->properties, data_pointers, retvals);
450
talloc_free(retvals);
451
talloc_free(data_pointers);
312
/* parent folder doesn't have any mapistore context associated */
314
table_filter = talloc_asprintf(mem_ctx, "(&(PidTagParentFolderId=0x%.16"PRIx64")(PidTagFolderId=*))", table->folderID);
315
/* Lookup the properties and check if we need to flag the PropertyRow blob */
316
for (i = 0, count = 0; i < request.RowCount; i++, count++) {
319
/* Lookup for flagged property row */
320
for (j = 0; j < table->prop_count; j++) {
321
ret = openchangedb_get_table_property(mem_ctx, emsmdbp_ctx->oc_ctx,
322
emsmdbp_ctx->szDisplayName,
323
table_filter, table->properties[j],
324
table->numerator, &data);
325
if (ret == MAPI_E_INVALID_OBJECT) {
328
if (ret == MAPI_E_NOT_FOUND) {
330
libmapiserver_push_property(mem_ctx,
331
0x0000000b, (const void *)&flagged,
332
&response.RowData, 0, 0);
337
/* SandardPropertyRow hack */
339
libmapiserver_push_property(mem_ctx,
340
0x00000000, (const void *)&flagged,
341
&response.RowData, 0, 1);
344
/* Push the property */
345
for (j = 0; j < table->prop_count; j++) {
346
property = table->properties[j];
347
ret = openchangedb_get_table_property(mem_ctx, emsmdbp_ctx->oc_ctx,
348
emsmdbp_ctx->szDisplayName,
349
table_filter, table->properties[j],
350
table->numerator, &data);
351
if (ret == MAPI_E_INVALID_OBJECT) {
355
if (ret == MAPI_E_NOT_FOUND) {
356
property = (property & 0xFFFF0000) + PT_ERROR;
357
data = (void *)&retval;
360
libmapiserver_push_property(mem_ctx,
361
property, (const void *)data,
362
&response.RowData, flagged?PT_ERROR:0, flagged);
371
talloc_free(table_filter);
461
if ((request->QueryRowsFlags & TBL_NOADVANCE) != TBL_NOADVANCE) {
462
table->numerator = i;
373
465
/* QueryRows reply parameters */
466
mapi_repl->error_code = MAPI_E_SUCCESS;
467
response->RowCount = count;
375
if (count < request.RowCount) {
376
mapi_repl->u.mapi_QueryRows.Origin = 0;
469
if ((count < request->RowCount) || (table->numerator > (table->denominator - 2))) {
470
response->Origin = BOOKMARK_END;
378
mapi_repl->u.mapi_QueryRows.Origin = 2;
472
response->Origin = BOOKMARK_CURRENT;
380
mapi_repl->error_code = MAPI_E_SUCCESS;
381
mapi_repl->u.mapi_QueryRows.RowCount = count;
382
mapi_repl->u.mapi_QueryRows.RowData.length = response.RowData.length;
383
mapi_repl->u.mapi_QueryRows.RowData.data = response.RowData.data;
384
dump_data(0, response.RowData.data, response.RowData.length);
474
/* dump_data(0, response.RowData.data, response.RowData.length); */
386
476
/* useless code for the moment */
387
mapi_repl->error_code = MAPI_E_SUCCESS;
388
mapi_repl->u.mapi_QueryRows.Origin = 2;
389
mapi_repl->u.mapi_QueryRows.RowCount = 0;
390
mapi_repl->u.mapi_QueryRows.RowData.length = 0;
391
mapi_repl->u.mapi_QueryRows.RowData.data = NULL;
477
if (table->restricted) {
478
response->Origin = BOOKMARK_BEGINNING;
481
response->Origin = BOOKMARK_END;
483
response->RowData.length = 0;
484
response->RowData.data = NULL;
485
DEBUG(5, ("%s: returning empty data set\n", __location__));
496
607
mapi_repl->u.mapi_SeekRow.HasSoughtLess = 0;
497
608
mapi_repl->u.mapi_SeekRow.RowsSought = 0;
610
handle = handles[mapi_req->handle_idx];
611
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
613
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
614
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
618
retval = mapi_handles_get_private_data(parent, &data);
620
mapi_repl->error_code = retval;
621
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
624
object = (struct emsmdbp_object *) data;
626
/* Ensure object exists and is table type */
627
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) {
628
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
629
DEBUG(5, (" no object or object is not a table\n"));
633
/* We don't handle backward/forward yet , just go through the
634
* entire table, nor do we handle bookmarks */
636
table = object->object.table;
637
if (mapi_req->u.mapi_SeekRow.origin == BOOKMARK_BEGINNING) {
638
next_position = mapi_req->u.mapi_SeekRow.offset;
640
else if (mapi_req->u.mapi_SeekRow.origin == BOOKMARK_CURRENT) {
641
next_position = table->numerator + mapi_req->u.mapi_SeekRow.offset;
643
else if (mapi_req->u.mapi_SeekRow.origin == BOOKMARK_END) {
644
next_position = table->denominator - 1 + mapi_req->u.mapi_SeekRow.offset;
648
mapi_repl->error_code = MAPI_E_NOT_FOUND;
649
DEBUG(5, (" unhandled 'origin' type: %d\n", mapi_req->u.mapi_SeekRow.origin));
652
if (mapi_repl->error_code == MAPI_E_SUCCESS) {
653
if (next_position < 0) {
655
mapi_repl->u.mapi_SeekRow.HasSoughtLess = 1;
657
else if (next_position >= table->denominator) {
658
next_position = table->denominator - 1;
659
mapi_repl->u.mapi_SeekRow.HasSoughtLess = 1;
661
if (mapi_req->u.mapi_SeekRow.WantRowMovedCount) {
662
mapi_repl->u.mapi_SeekRow.RowsSought = (next_position - table->numerator);
665
mapi_repl->u.mapi_SeekRow.RowsSought = 0;
667
table->numerator = next_position;
499
671
*size += libmapiserver_RopSeekRow_size(mapi_repl);
501
673
return MAPI_E_SUCCESS;
543
726
mapi_repl->u.mapi_FindRow.RowNoLongerVisible = 0;
544
727
mapi_repl->u.mapi_FindRow.HasRowData = 0;
545
728
mapi_repl->u.mapi_FindRow.row.length = 0;
546
mapi_repl->u.mapi_FindRow.row.data = 0;
729
mapi_repl->u.mapi_FindRow.row.data = NULL;
548
731
handle = handles[mapi_req->handle_idx];
549
732
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
550
if (retval) goto end;
734
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
735
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
552
739
retval = mapi_handles_get_private_data(parent, &data);
553
if (retval) goto end;
741
mapi_repl->error_code = retval;
742
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
554
745
object = (struct emsmdbp_object *) data;
556
747
/* Ensure object exists and is table type */
557
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) goto end;
748
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) {
749
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
750
DEBUG(5, (" no object or object is not a table\n"));
559
754
/* We don't handle backward/forward yet , just go through the
560
755
* entire table, nor do we handle bookmarks */
562
/* Handle PropertyRestriction */
563
if (mapi_req->u.mapi_FindRow.res.rt != 0x4) goto end;
564
/* Ensure the property we search exists in the array */
566
757
table = object->object.table;
567
if (!table->folderID) goto end;
569
switch (table->mapistore) {
758
if (table->ulType == MAPISTORE_RULE_TABLE) {
759
DEBUG(5, (" query on rules table are all faked right now\n"));
763
if (mapi_req->u.mapi_FindRow.origin == BOOKMARK_BEGINNING) {
764
table->numerator = 0;
766
if (mapi_req->u.mapi_FindRow.ulFlags == DIR_BACKWARD) {
767
DEBUG(5, (" only DIR_FORWARD is supported right now, using work-around\n"));
768
table->numerator = 0;
771
memset (&row, 0, sizeof(DATA_BLOB));
773
switch (emsmdbp_is_mapistore(object)) {
775
/* Restrict rows to be fetched */
776
retval = mapistore_table_set_restrictions(emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object), object->backend_object, &request.res, &status);
777
/* Then fetch rows */
778
/* Lookup the properties and check if we need to flag the PropertyRow blob */
780
while (!found && table->numerator < table->denominator) {
783
data_pointers = emsmdbp_object_table_get_row_props(NULL, emsmdbp_ctx, object, table->numerator, MAPISTORE_LIVEFILTERED_QUERY, &retvals);
786
for (i = 0; i < table->prop_count; i++) {
787
if (retvals[i] != MAPI_E_SUCCESS) {
793
libmapiserver_push_property(mem_ctx,
794
0x0000000b, (const void *)&flagged,
798
libmapiserver_push_property(mem_ctx,
799
0x00000000, (const void *)&flagged,
803
/* Push the properties */
804
for (i = 0; i < table->prop_count; i++) {
805
property = table->properties[i];
807
if (retval == MAPI_E_NOT_FOUND) {
808
property = (property & 0xFFFF0000) + PT_ERROR;
812
data = data_pointers[i];
815
libmapiserver_push_property(mem_ctx,
816
property, data, &row,
817
flagged?PT_ERROR:0, flagged, 0);
819
talloc_free(retvals);
820
talloc_free(data_pointers);
827
retval = mapistore_table_set_restrictions(emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object), object->backend_object, NULL, &status);
829
/* Adjust parameters */
831
mapi_repl->u.mapi_FindRow.HasRowData = 1;
834
mapi_repl->error_code = MAPI_E_NOT_FOUND;
837
mapi_repl->u.mapi_FindRow.row.length = row.length;
838
mapi_repl->u.mapi_FindRow.row.data = row.data;
842
memset (&row, 0, sizeof(DATA_BLOB));
843
DEBUG(0, ("FindRow for openchangedb\n"));
844
/* Restrict rows to be fetched */
845
retval = openchangedb_table_set_restrictions(object->backend_object, &request.res);
846
/* Then fetch rows */
847
/* Lookup the properties and check if we need to flag the PropertyRow blob */
848
while (!found && table->numerator < table->denominator) {
851
data_pointers = emsmdbp_object_table_get_row_props(NULL, emsmdbp_ctx, object, table->numerator, MAPISTORE_LIVEFILTERED_QUERY, &retvals);
854
for (i = 0; i < table->prop_count; i++) {
855
if (retvals[i] != MAPI_E_SUCCESS) {
861
libmapiserver_push_property(mem_ctx,
862
0x0000000b, (const void *)&flagged,
866
libmapiserver_push_property(mem_ctx,
867
0x00000000, (const void *)&flagged,
871
/* Push the properties */
872
for (i = 0; i < table->prop_count; i++) {
873
property = table->properties[i];
875
if (retval == MAPI_E_NOT_FOUND) {
876
property = (property & 0xFFFF0000) + PT_ERROR;
880
data = data_pointers[i];
883
libmapiserver_push_property(mem_ctx,
884
property, data, &row,
885
flagged?PT_ERROR:0, flagged, 0);
887
talloc_free(retvals);
888
talloc_free(data_pointers);
893
/* Reset restrictions */
894
openchangedb_table_set_restrictions(object->backend_object, NULL);
896
/* Adjust parameters */
898
mapi_repl->u.mapi_FindRow.HasRowData = 1;
901
mapi_repl->error_code = MAPI_E_NOT_FOUND;
904
mapi_repl->u.mapi_FindRow.row.length = row.length;
905
mapi_repl->u.mapi_FindRow.row.data = row.data;
579
912
return MAPI_E_SUCCESS;
916
\details EcDoRpc ResetTable (0x81) Rop. This operation resets the
918
- Removes the existing column set, restriction, and sort order (ignored) from the table.
919
- Invalidates bookmarks. (ignored)
920
- Resets the cursor to the beginning of the table.
922
\param mem_ctx pointer to the memory context
923
\param emsmdbp_ctx pointer to the emsmdb provider context
924
\param mapi_req pointer to the SetColumns EcDoRpc_MAPI_REQ
926
\param mapi_repl pointer to the SetColumns EcDoRpc_MAPI_REPL
928
\param handles pointer to the MAPI handles array
929
\param size pointer to the mapi_response size to update
931
\return MAPI_E_SUCCESS on success, otherwise MAPI error
933
_PUBLIC_ enum MAPISTATUS EcDoRpc_RopResetTable(TALLOC_CTX *mem_ctx,
934
struct emsmdbp_context *emsmdbp_ctx,
935
struct EcDoRpc_MAPI_REQ *mapi_req,
936
struct EcDoRpc_MAPI_REPL *mapi_repl,
937
uint32_t *handles, uint16_t *size)
939
enum MAPISTATUS retval;
940
struct mapi_handles *parent;
941
struct emsmdbp_object *object;
942
struct emsmdbp_object_table *table;
944
uint32_t handle, contextID;
945
uint8_t status; /* ignored */
947
DEBUG(4, ("exchange_emsmdb: [OXCTABL] ResetTable (0x81)\n"));
950
OPENCHANGE_RETVAL_IF(!emsmdbp_ctx, MAPI_E_NOT_INITIALIZED, NULL);
951
OPENCHANGE_RETVAL_IF(!mapi_req, MAPI_E_INVALID_PARAMETER, NULL);
952
OPENCHANGE_RETVAL_IF(!mapi_repl, MAPI_E_INVALID_PARAMETER, NULL);
953
OPENCHANGE_RETVAL_IF(!handles, MAPI_E_INVALID_PARAMETER, NULL);
954
OPENCHANGE_RETVAL_IF(!size, MAPI_E_INVALID_PARAMETER, NULL);
956
/* Initialize default empty ResetTable reply */
957
mapi_repl->opnum = mapi_req->opnum;
958
mapi_repl->handle_idx = mapi_req->handle_idx;
959
*size += libmapiserver_RopResetTable_size(mapi_repl);
961
handle = handles[mapi_req->handle_idx];
962
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
964
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
965
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
969
retval = mapi_handles_get_private_data(parent, &data);
971
mapi_repl->error_code = retval;
972
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
976
object = (struct emsmdbp_object *) data;
977
/* Ensure referring object exists and is a table */
978
if (!object || (object->type != EMSMDBP_OBJECT_TABLE)) {
979
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
980
DEBUG(5, (" missing object or not table\n"));
984
mapi_repl->error_code = MAPI_E_SUCCESS;
986
table = object->object.table;
987
if (table->ulType == MAPISTORE_RULE_TABLE) {
988
DEBUG(5, (" query on rules table are all faked right now\n"));
991
/* 1.1. removes the existing column set */
992
if (table->properties) {
993
talloc_free(table->properties);
994
table->properties = NULL;
995
table->prop_count = 0;
998
/* 1.2. empty restrictions */
999
if (emsmdbp_is_mapistore(object)) {
1000
contextID = emsmdbp_get_contextID(object);
1001
retval = mapistore_table_set_restrictions(emsmdbp_ctx->mstore_ctx, contextID, object->backend_object, NULL, &status);
1002
mapistore_table_get_row_count(emsmdbp_ctx->mstore_ctx, contextID, object->backend_object, MAPISTORE_PREFILTERED_QUERY, &object->object.table->denominator);
1004
DEBUG(0, (" mapistore Restrict: Not implemented yet\n"));
1008
/* 3. reset the cursor to the beginning of the table. */
1009
table->numerator = 0;
1014
return MAPI_E_SUCCESS;