\param connection connection identifier for callabck function
\param NotificationFlags mask for events to provide notifications for (see
below)
+ \param WholeStore whether the scope for this notification is whole
+ database
\param notify_callback notification callback function.
The Notification Flags can take the following values:
GetLastError
*/
_PUBLIC_ enum MAPISTATUS Subscribe(mapi_object_t *obj, uint32_t *connection,
- uint16_t NotificationFlags,
+ uint16_t NotificationFlags,
+ bool WholeStore,
mapi_notify_callback_t notify_callback)
{
TALLOC_CTX *mem_ctx;
request.NotificationFlags = NotificationFlags;
size += sizeof (uint16_t);
- request.WantWholeStore = 0x0;
+ request.WantWholeStore = WholeStore;
size += sizeof (uint8_t);
- request.FolderId.ID = mapi_object_get_id(obj);
- size += sizeof (uint64_t);
-
- request.MessageId.ID = 0x0;
- size += sizeof (uint64_t);
+ if (WholeStore == false) {
+ request.FolderId.ID = mapi_object_get_id(obj);
+ size += sizeof (uint64_t);
+ request.MessageId.ID = 0x0;
+ size += sizeof (uint64_t);
+ }
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_RegisterNotification;
TALLOC_CTX *mem_ctx,
struct EcDoRpc *r)
{
- DEBUG(3, ("exchange_emsmdb: EcDoRpc (0x2) not implemented\n"));
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ struct dcesrv_handle *h;
+ struct emsmdbp_context *emsmdbp_ctx;
+
+ DEBUG(3, ("exchange_emsmdb: EcDoRpc (0x2)\n"));
+
+ /* Step 0. Ensure incoming user is authenticated */
+ if (!NTLM_AUTH_IS_OK(dce_call)) {
+ DEBUG(1, ("No challenge requested by client, cannot authenticate\n"));
+ return MAPI_E_LOGON_FAILED;
+ }
+
+ h = dcesrv_handle_fetch(dce_call->context, r->in.handle, DCESRV_HANDLE_ANY);
+ emsmdbp_ctx = (struct emsmdbp_context *) h->data;
+
+ r->out.result = MAPI_E_SUCCESS;
+
+ return MAPI_E_SUCCESS;
}
/* newmail and created|modified object notifications in inbox */
ulEventMask = fnevObjectCreated;
- retval = Subscribe(&obj_inbox, &ulConnection, ulEventMask, (mapi_notify_callback_t)callback);
+ retval = Subscribe(&obj_inbox, &ulConnection, ulEventMask, false, (mapi_notify_callback_t)callback);
mapi_errstr("Subscribe", GetLastError());
ulEventMask = fnevNewMail;
- retval = Subscribe(&obj_inbox, &ulConnection, ulEventMask, (mapi_notify_callback_t)callback);
+ retval = Subscribe(&obj_inbox, &ulConnection, ulEventMask, false, (mapi_notify_callback_t)callback);
mapi_errstr("Subscribe", GetLastError());
ulEventMask = fnevNewMail|fnevObjectCreated|fnevObjectDeleted|
fnevObjectModified|fnevObjectMoved|fnevObjectCopied|
fnevSearchComplete|fnevTableModified|fnevStatusObjectModified;
- retval = Subscribe(obj_store, &ulConnection, ulEventMask, (mapi_notify_callback_t)callback);
- retval = Subscribe(&obj_inbox, &ulConnection, ulEventMask, (mapi_notify_callback_t)callback);
+ retval = Subscribe(obj_store, &ulConnection, ulEventMask, true, (mapi_notify_callback_t)callback);
+ retval = Subscribe(&obj_inbox, &ulConnection, ulEventMask, false, (mapi_notify_callback_t)callback);
if (retval != MAPI_E_SUCCESS) return false;
/* wait for notifications: infinite loop */