- Fix Subscribe semantic bug and add WholeStore boolean parameter
authorJulien Kerihuel <j.kerihuel@openchange.org>
Thu, 15 Jan 2009 01:43:42 +0000 (01:43 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Thu, 15 Jan 2009 01:43:42 +0000 (01:43 +0000)
- propagate API change to tools/torture callers

libmapi/IMAPISupport.c
mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.c
torture/mapi_newmail.c
utils/openchangeclient.c

index c5d0751a876e0069104ace666c8a99d4dbad2feb..0aadcb789516ebd83bfa5abb9f66dacb84018cea 100644 (file)
@@ -39,6 +39,8 @@
    \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:
@@ -67,7 +69,8 @@
    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;
@@ -100,15 +103,16 @@ _PUBLIC_ enum MAPISTATUS Subscribe(mapi_object_t *obj, uint32_t   *connection,
        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;
index 2b0f19c0a47ea643b87d260a0b892470df6e3f37..4dd3c20da2a506357e07842b20da753dab27a068 100644 (file)
@@ -226,8 +226,23 @@ static enum MAPISTATUS dcesrv_EcDoRpc(struct dcesrv_call_state *dce_call,
                                      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;
 }
 
 
index 0a206873757634744b69d7c45a6dd14141eb0679..e757de954fa1c1814c628b2991146f4018d3adcc 100644 (file)
@@ -98,11 +98,11 @@ bool torture_rpc_mapi_newmail(struct torture_context *torture)
 
        /* 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());
 
 
index e1b977131f96d2d7f78fd698bcbe19639d3f5a2f..5f893af26aa1ce3d1242eecda82d214c87a2801d 100644 (file)
@@ -2312,8 +2312,8 @@ static bool openchangeclient_notifications(TALLOC_CTX *mem_ctx, mapi_object_t *o
        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 */