68
68
OPENCHANGE_RETVAL_IF(!handles, MAPI_E_INVALID_PARAMETER, NULL);
69
69
OPENCHANGE_RETVAL_IF(!size, MAPI_E_INVALID_PARAMETER, NULL);
71
/* Ensure parent handle references a folder object */
72
handle = handles[mapi_req->handle_idx];
73
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
74
OPENCHANGE_RETVAL_IF(retval, retval, NULL);
76
71
/* Initialize default GetRulesTable reply */
77
72
mapi_repl->opnum = mapi_req->opnum;
78
73
mapi_repl->handle_idx = mapi_req->u.mapi_GetRulesTable.handle_idx;
79
74
mapi_repl->error_code = MAPI_E_SUCCESS;
81
mapi_handles_get_private_data(parent, &data);
76
/* Ensure parent handle references a folder object */
77
handle = handles[mapi_req->handle_idx];
78
retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &parent);
80
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
81
DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
85
retval = mapi_handles_get_private_data(parent, &data);
87
mapi_repl->error_code = MAPI_E_NOT_FOUND;
88
DEBUG(5, (" handle data not found, idx = %x\n", mapi_req->handle_idx));
82
92
object = (struct emsmdbp_object *) data;
83
if (!object || object->type != EMSMDBP_OBJECT_FOLDER) {
84
mapi_repl->error_code = MAPI_E_NOT_FOUND;
93
if (object->type != EMSMDBP_OBJECT_FOLDER) {
94
mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
95
DEBUG(5, (" unhandled object type: %d\n", object->type));
99
/* Initialize Table object */
100
handle = handles[mapi_req->handle_idx];
88
101
retval = mapi_handles_add(emsmdbp_ctx->handles_ctx, handle, &rec);
89
102
handles[mapi_repl->handle_idx] = rec->handle;
104
object = emsmdbp_object_table_init((TALLOC_CTX *)rec, emsmdbp_ctx, object);
106
retval = mapi_handles_set_private_data(rec, object);
107
/* rules tables are stub objects for now */
108
object->object.table->denominator = 0;
109
object->object.table->ulType = MAPISTORE_RULE_TABLE;
92
112
*size += libmapiserver_RopGetRulesTable_size();