add mapi_response to emsmdb_transaction so we can get the results
authorJulien Kerihuel <j.kerihuel@openchange.org>
Sun, 28 Jan 2007 03:26:02 +0000 (03:26 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Sun, 28 Jan 2007 03:26:02 +0000 (03:26 +0000)
check the mapi call error core in OpenMsgStore

jkerihuel.

libmapi/emsmdb.c
libmapi/include/emsmdb.h
libmapi/mapi.c

index 9bdb9254c78ec5cfe41b99a5c5d0f0cb58baa60a..3a368052b34885fcc3cfff01588f65ae369e1432 100644 (file)
@@ -111,7 +111,7 @@ struct emsmdb_context *emsmdb_connect(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p
        return ret;
 }
 
-NTSTATUS emsmdb_transaction(struct emsmdb_context *emsmdb, struct mapi_request *req)
+NTSTATUS emsmdb_transaction(struct emsmdb_context *emsmdb, struct mapi_request *req, struct mapi_response **repl)
 {
        struct EcDoRpc  r;
        struct mapi_response *mapi_response;
@@ -137,6 +137,8 @@ NTSTATUS emsmdb_transaction(struct emsmdb_context *emsmdb, struct mapi_request *
                mapi_errstr("EcDoRpc", r.out.result);
        }
 
+       *repl = r.out.mapi_response;
+
        return status;
 }
 
index 3b387b6260ab7cc64a308b89ce3742dc33c8f62c..5333412f89243d9c17c67c76758dd5e1b579290a 100644 (file)
@@ -27,7 +27,4 @@ struct emsmdb_context {
   TALLOC_CTX *mem_ctx;
 };
 
-NTSTATUS emsmdb_transaction(struct emsmdb_context *emsmdb, struct mapi_request *);
-/* NTSTATUS emsmdb_transaction_unknown(struct emsmdb_context *emsmdb, struct MAPI_DATA blob); */
-
 #endif /* __EMSMDB_H__ */
index 3e112bd0f6b3dd8532af5d3e62af803bac2d4ecb..38152ca9d88980ffcc2d6a288ea6fb619f06194c 100644 (file)
 
 #include "openchange.h"
 #include "exchange.h"
+#include "ndr_exchange.h"
 #include "libmapi/include/emsmdb.h"
 #include "libmapi/mapicode.h"
 #include "libmapi/include/proto.h"
+#include "libmapi/include/mapi_proto.h"
 
 MAPISTATUS     OpenMsgStore(struct emsmdb_context *emsmdb, uint32_t ulFlags, 
                             uint32_t *handle_id, const char *mailbox)
 {
        struct mapi_request     *mapi_request;
+       struct mapi_response    *mapi_response;
        struct EcDoRpc_MAPI_REQ *mapi_req;
        struct OpenMsgStore_req request;
+       NTSTATUS                status;
        uint32_t                size;
        TALLOC_CTX              *mem_ctx;
 
@@ -38,8 +42,8 @@ MAPISTATUS    OpenMsgStore(struct emsmdb_context *emsmdb, uint32_t ulFlags,
        /* Fill the OpenMsgStore operation */
        request.col = 0x0;
        request.row = 0x1;
-       request.folderID_count = 0xc;
-       request.padding = 0x0;
+       request.folderID_count = 0xc;
+       request.padding = 0;
        request.mailbox_path = talloc_strdup(mem_ctx, mailbox);
        size = 10 + strlen(mailbox) + 1;
 
@@ -58,9 +62,13 @@ MAPISTATUS   OpenMsgStore(struct emsmdb_context *emsmdb, uint32_t ulFlags,
        mapi_request->handles = talloc_array(mem_ctx, uint32_t, 1);
        mapi_request->handles[0] = 0xffffffff;
 
-       emsmdb_transaction(emsmdb, mapi_request);
+       status = emsmdb_transaction(emsmdb, mapi_request, &mapi_response);
 
-       talloc_free(mem_ctx);
+       if (mapi_response->mapi_repl->u.mapi_OpenMsgStore.error_code != MAPI_E_SUCCESS) {
+               return mapi_response->mapi_repl->u.mapi_OpenMsgStore.error_code;
+       }
 
+       talloc_free(mem_ctx);
+       
        return MAPI_E_SUCCESS;
 }