[Pkg-samba-maint] r3059 - in trunk/openchange: . debian libmapi libmapi/conf libmapi++ torture utils utils/exchange2ical utils/mapitest utils/mapitest/modules
jelmer at alioth.debian.org
jelmer at alioth.debian.org
Sat Sep 26 00:26:16 UTC 2009
Author: jelmer
Date: 2009-09-26 00:26:13 +0000 (Sat, 26 Sep 2009)
New Revision: 3059
Modified:
trunk/openchange/ChangeLog
trunk/openchange/debian/changelog
trunk/openchange/exchange.idl
trunk/openchange/libmapi++/attachment.h
trunk/openchange/libmapi/FXICS.c
trunk/openchange/libmapi/IMAPIContainer.c
trunk/openchange/libmapi/IMAPIFolder.c
trunk/openchange/libmapi/IMAPIProp.c
trunk/openchange/libmapi/IMAPISupport.c
trunk/openchange/libmapi/IMAPITable.c
trunk/openchange/libmapi/IMessage.c
trunk/openchange/libmapi/IMsgStore.c
trunk/openchange/libmapi/IStoreFolder.c
trunk/openchange/libmapi/IStream.c
trunk/openchange/libmapi/IUnknown.c
trunk/openchange/libmapi/IXPLogon.c
trunk/openchange/libmapi/conf/mapi-properties
trunk/openchange/libmapi/mapi_object.c
trunk/openchange/torture/mapi_fetchattach.c
trunk/openchange/torture/mapi_namedprops.c
trunk/openchange/torture/mapi_sendattach.c
trunk/openchange/utils/exchange2ical/exchange2ical_utils.c
trunk/openchange/utils/mapitest/module.c
trunk/openchange/utils/mapitest/modules/module_oxcmsg.c
trunk/openchange/utils/openchangeclient.c
Log:
New upstream snapshot.
Modified: trunk/openchange/ChangeLog
===================================================================
--- trunk/openchange/ChangeLog 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/ChangeLog 2009-09-26 00:26:13 UTC (rev 3059)
@@ -1,3 +1,75 @@
+2009-09-20
+ bradh
+ [r1521]
+ Modify mapi_object_set_logon_id() to be able to report errors.
+
+ Original patch by Erik Hovland, I made some changes.
+
+2009-09-19
+ bradh
+ [r1519]
+ Implement RopReloadCachedInformation (0x10).
+
+ Minor change to IDL (previously implemented), and adds
+ implementaiton and mapitest code.
+
+ Also editorial comment fix in some related mapitest stuff.
+
+ Resolves ticket #186
+ [r1518]
+ Implement GetValidAttachments ROP (0x52).
+
+ Includes IDL, implementation and mapitest.
+
+ mapitest also checks DeleteAttach behaviour, which I don't think we previously
+ covered anywhere.
+
+ Also includes a comment fix in the mapitest code.
+
+2009-09-16
+ bradh
+ [r1516]
+ Whitespace cleanup.
+
+ Patch by Erik Hovland <erik at hovland.org>
+
+2009-09-14
+ bradh
+ [r1514]
+ Update the properties list.
+
+ Patch from Girish Venkatachalam <girish at gayatri-hitech.com>
+
+2009-09-12
+ bradh
+ [r1512]
+ Update API to use MAPITAGS enum.
+ [r1511]
+ Update to match API change.
+ [r1510]
+ Use appropriate enum here.
+ [r1509]
+ Use enum for OpenEmbeddedMessage call.
+ [r1508]
+ Use enums where appropriate.
+ [r1507]
+ Update users of FindRow to use enums.
+ [r1506]
+ We are supposed to be returning a MAPISTATUS, so switch to using
+ the OPENCHANGE_RETVAL_ERR macro here.
+ [r1505]
+ Use appropriate enums instead of int types.
+ [r1504]
+ Use enums instead of ints / hardcoded values.
+ [r1503]
+ Use enum types where appropriate.
+
+ Fixes warnings from Intel C compiler.
+ [r1502]
+ Return a suitable MAPISTATUS if we can't talloc sufficient memory here.
+
+ Fixes warning from Intel compiler.
+
2009-09-11
bradh
[r1500]
Modified: trunk/openchange/debian/changelog
===================================================================
--- trunk/openchange/debian/changelog 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/debian/changelog 2009-09-26 00:26:13 UTC (rev 3059)
@@ -1,4 +1,4 @@
-openchange (1:0.8.2+svn1507-1) unstable; urgency=low
+openchange (1:0.8.2+svn1522-1) unstable; urgency=low
* New upstream snapshot.
* Upload to unstable.
Modified: trunk/openchange/exchange.idl
===================================================================
--- trunk/openchange/exchange.idl 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/exchange.idl 2009-09-26 00:26:13 UTC (rev 3059)
@@ -855,6 +855,7 @@
op_MAPI_FindRow = 0x4f,
op_MAPI_Progress = 0x50,
op_MAPI_TransportNewMail = 0x51,
+ op_MAPI_GetValidAttachments = 0x52,
op_MAPI_GetNamesFromIDs = 0x55,
op_MAPI_GetIDsFromNames = 0x56,
op_MAPI_UpdateDeferredActionMessages = 0x57,
@@ -1464,8 +1465,7 @@
TypedString SubjectPrefix;
TypedString NormalizedSubject;
uint16 RecipientCount;
- uint16 ColumnCount;
- MAPITAGS RecipientColumns[ColumnCount];
+ mapi_SPropTagArray RecipientColumns;
uint8 RowCount;
OpenRecipientRow RecipientRows[RowCount];
} ReloadCachedInformation_repl;
@@ -1911,7 +1911,7 @@
TableFlags TableFlags;
} GetAttachmentTable_req;
- typedef [flag(NDR_NOALIGN)] struct {
+ typedef [flag(NDR_NOALIGN)] struct {
} GetAttachmentTable_repl;
/*************************/
@@ -2765,6 +2765,16 @@
typedef [flag(NDR_NOALIGN)] struct {
} TransportNewMail_repl;
+ /**************************/
+ /* EcDoRpc Function 0x52 */
+ typedef [flag(NDR_NOALIGN)] struct {
+ } GetValidAttachments_req;
+
+ typedef [flag(NDR_NOALIGN)] struct {
+ uint16 AttachmentIdCount;
+ uint32 AttachmentIdArray[AttachmentIdCount];
+ } GetValidAttachments_repl;
+
/*************************/
/* EcDoRpc Function 0x55 */
typedef [enum8bit] enum {
@@ -3522,6 +3532,7 @@
[case(op_MAPI_FindRow)] FindRow_req mapi_FindRow;
[case(op_MAPI_Progress)] Progress_req mapi_Progress;
[case(op_MAPI_TransportNewMail)] TransportNewMail_req mapi_TransportNewMail;
+ [case(op_MAPI_GetValidAttachments)] GetValidAttachments_req mapi_GetValidAttachments;
[case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_req mapi_GetNamesFromIDs;
[case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_req mapi_GetIDsFromNames;
[case(op_MAPI_UpdateDeferredActionMessages)] UpdateDeferredActionMessages_req mapi_UpdateDeferredActionMessages;
@@ -3644,6 +3655,7 @@
[case(op_MAPI_FindRow)] FindRow_repl mapi_FindRow;
[case(op_MAPI_Progress)] Progress_repl mapi_Progress;
[case(op_MAPI_TransportNewMail)] TransportNewMail_repl mapi_TransportNewMail;
+ [case(op_MAPI_GetValidAttachments)] GetValidAttachments_repl mapi_GetValidAttachments;
[case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_repl mapi_GetNamesFromIDs;
[case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_repl mapi_GetIDsFromNames;
[case(op_MAPI_UpdateDeferredActionMessages)] UpdateDeferredActionMessages_repl mapi_UpdateDeferredActionMessages;
Modified: trunk/openchange/libmapi/FXICS.c
===================================================================
--- trunk/openchange/libmapi/FXICS.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/FXICS.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -63,6 +63,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -72,6 +73,9 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetLocalReplicaIds");
size = 0;
@@ -82,7 +86,7 @@
/* Fill the MAPI_REQ structure */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetLocalReplicaIds;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetLocalReplicaIds = request;
size += 5;
Modified: trunk/openchange/libmapi/IMAPIContainer.c
===================================================================
--- trunk/openchange/libmapi/IMAPIContainer.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMAPIContainer.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -99,7 +99,8 @@
session = mapi_object_get_session(obj_container);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_container);
+ if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetContentsTable");
size = 0;
@@ -225,7 +226,8 @@
session = mapi_object_get_session(obj_container);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_container);
+ if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetHierarchyTable");
size = 0;
@@ -320,7 +322,8 @@
session = mapi_object_get_session(obj_container);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_container);
+ if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetTable");
size = 0;
@@ -415,7 +418,8 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_folder);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetRulesTable");
size = 0;
@@ -502,6 +506,7 @@
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
uint32_t i, j;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -511,6 +516,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "ModifyTable");
size = 0;
@@ -531,7 +539,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_ModifyTable;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx= 0;
mapi_req->u.mapi_ModifyTable = request;
size += 5;
@@ -616,6 +624,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -625,6 +634,9 @@
session = mapi_object_get_session(obj_container);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetSearchCriteria");
size = 0;
@@ -651,7 +663,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetSearchCriteria;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_container);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetSearchCriteria = request;
size += 5;
@@ -717,6 +729,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -728,6 +741,9 @@
session = mapi_object_get_session(obj_container);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetSearchCriteria");
size = 0;
@@ -740,7 +756,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetSearchCriteria;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_container);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetSearchCriteria = request;
size += 5;
Modified: trunk/openchange/libmapi/IMAPIFolder.c
===================================================================
--- trunk/openchange/libmapi/IMAPIFolder.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMAPIFolder.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -64,7 +64,8 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_folder);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "CreateMessage");
size = 0;
@@ -148,12 +149,15 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!obj_folder, MAPI_E_INVALID_PARAMETER, NULL);
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "DeleteMessages");
size = 0;
@@ -171,7 +175,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_DeleteMessages;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_DeleteMessages = request;
size += 5;
@@ -233,6 +237,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -240,6 +245,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "HardDeleteMessages");
size = 0;
@@ -256,7 +264,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_HardDeleteMessages;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_HardDeleteMessages = request;
size += 5;
@@ -313,6 +321,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -321,6 +330,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetMessageStatus");
size = 0;
@@ -331,7 +343,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetMessageStatus;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetMessageStatus = request;
size += 5;
@@ -409,6 +421,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -417,6 +430,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetMessageStatus");
size = 0;
@@ -433,7 +449,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetMessageStatus;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetMessageStatus = request;
size += 5;
@@ -500,6 +516,7 @@
struct MoveCopyMessages_req request;
struct mapi_session *session[2];
uint32_t size;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -511,6 +528,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(session[0] != session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "MoveCopyMessages");
size = 0;
@@ -534,7 +554,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_MoveCopyMessages;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_src);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_MoveCopyMessages = request;
size += 5;
@@ -619,7 +639,8 @@
session = mapi_object_get_session(obj_parent);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_parent);
+ if ((retval = mapi_object_get_logon_id(obj_parent, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
/* Sanitify check on the folder type */
OPENCHANGE_RETVAL_IF((ulFolderType != FOLDER_GENERIC &&
@@ -747,6 +768,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -754,6 +776,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "EmptyFolder");
size = 0;
@@ -767,7 +792,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_EmptyFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_EmptyFolder = request;
size += 5;
@@ -835,6 +860,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -846,6 +872,9 @@
(!(DeleteFolderFlags & 0x10)),
MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_parent, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "DeleteFolder");
size = 0;
@@ -858,7 +887,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_DeleteFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_parent);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_DeleteFolder = request;
size += 5;
@@ -924,6 +953,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -939,6 +969,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!session[2], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "MoveFolder");
size = 0;
@@ -967,7 +1000,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_MoveFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_MoveFolder = request;
size += 5;
@@ -1033,6 +1066,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1048,6 +1082,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!session[2], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CopyFolder");
size = 0;
@@ -1079,7 +1116,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CopyFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_CopyFolder = request;
size += 5;
@@ -1147,6 +1184,7 @@
NTSTATUS status;
struct mapi_response *mapi_response;
enum MAPISTATUS retval;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1154,6 +1192,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetReadFlags");
size = 0;
@@ -1172,7 +1213,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetReadFlags;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetReadFlags = request;
size += 5;
@@ -1230,6 +1271,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1237,6 +1279,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "HardDeleteMessagesAndSubfolders");
size = 0;
@@ -1250,7 +1295,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_HardDeleteMessagesAndSubfolders;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_HardDeleteMessagesAndSubfolders = request;
size += 5;
Modified: trunk/openchange/libmapi/IMAPIProp.c
===================================================================
--- trunk/openchange/libmapi/IMAPIProp.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMAPIProp.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -73,7 +73,8 @@
uint32_t size;
TALLOC_CTX *mem_ctx;
bool named = false;
-
+ uint8_t logon_id;
+
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!obj, MAPI_E_INVALID_PARAMETER, NULL);
@@ -82,6 +83,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetProps");
/* Named property mapping */
@@ -116,7 +120,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetProps;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetProps = request;
size += 5;
@@ -195,6 +199,7 @@
unsigned long i;
struct mapi_SPropValue *mapi_props;
bool named = false;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -203,6 +208,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetProps");
size = 0;
@@ -236,7 +244,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetProps;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetProps = request;
size += 5;
@@ -305,6 +313,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity Checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -319,6 +328,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(session[0] != session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_parent, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SaveChangesAttachment");
size = 0;
@@ -330,7 +342,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SaveChangesAttachment;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_parent);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SaveChangesAttachment = request;
size += 5;
@@ -387,6 +399,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -395,6 +408,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetPropList");
/* Reset */
@@ -404,7 +420,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetPropList;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -474,6 +490,7 @@
NTSTATUS status;
enum MAPISTATUS retval;
uint32_t size;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -482,6 +499,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetPropsAll");
size = 0;
@@ -494,7 +514,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetPropsAll;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetPropsAll = request;
size += 5;
@@ -553,6 +573,7 @@
NTSTATUS status;
enum MAPISTATUS retval;
uint32_t size;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -562,6 +583,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "DeleteProps");
size = 0;
@@ -574,7 +598,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_DeleteProps;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_DeleteProps = request;
size += 5;
@@ -642,6 +666,7 @@
unsigned long i;
struct mapi_SPropValue *mapi_props;
bool named = false;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -650,6 +675,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetPropertiesNoReplicate");
size = 0;
@@ -683,7 +711,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetPropertiesNoReplicate;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetPropertiesNoReplicate = request;
size += 5;
@@ -743,6 +771,7 @@
NTSTATUS status;
enum MAPISTATUS retval;
uint32_t size;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -752,6 +781,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "DeletePropertiesNoReplicate");
size = 0;
@@ -764,7 +796,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_DeletePropertiesNoReplicate;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_DeletePropertiesNoReplicate = request;
size += 5;
@@ -830,6 +862,7 @@
enum MAPISTATUS retval;
uint32_t size= 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -838,6 +871,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
/* Initialization */
mem_ctx = talloc_named(NULL, 0, "GetNamesFromIDs");
size = 0;
@@ -852,7 +888,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetNamesFromIDs;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetNamesFromIDs = request;
size += 5;
@@ -935,6 +971,7 @@
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
uint32_t i;
+ uint8_t logon_id;
/* sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -947,6 +984,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
/* Initialization */
mem_ctx = talloc_named(NULL, 0, "GetIDsFromNames");
size = 0;
@@ -975,7 +1015,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetIDsFromNames;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetIDsFromNames = request;
size += 5;
@@ -1049,6 +1089,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1057,6 +1098,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
/* Initialization */
mem_ctx = talloc_named(NULL, 0, "QueryNamesFromIDs");
size = 0;
@@ -1078,7 +1122,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_QueryNamedProperties;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_QueryNamedProperties = request;
size += 5;
@@ -1159,6 +1203,7 @@
enum MAPISTATUS retval;
uint32_t size;
int i;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1172,6 +1217,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(session[0] != session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CopyProps");
size = 0;
@@ -1190,7 +1238,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CopyProperties;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_src);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_CopyProperties = request;
size += 5; // sizeof( EcDoRpc_MAPI_REQ )
@@ -1275,6 +1323,7 @@
enum MAPISTATUS retval;
uint32_t size;
int i;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1288,6 +1337,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(session[0] != session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CopyProps");
size = 0;
@@ -1308,7 +1360,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CopyTo;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_src);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_CopyTo = request;
size += 5; // sizeof( EcDoRpc_MAPI_REQ )
Modified: trunk/openchange/libmapi/IMAPISupport.c
===================================================================
--- trunk/openchange/libmapi/IMAPISupport.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMAPISupport.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -88,6 +88,7 @@
NTSTATUS status;
uint32_t size = 0;
static uint32_t ulConnection = 0;
+ uint8_t logon_id = 0;
/* Sanity Checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -98,6 +99,9 @@
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!session->notify_ctx, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "Subscribe");
/* Fill the Subscribe operation */
@@ -120,7 +124,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_RegisterNotification;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_RegisterNotification = request;
size += 5;
Modified: trunk/openchange/libmapi/IMAPITable.c
===================================================================
--- trunk/openchange/libmapi/IMAPITable.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMAPITable.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -61,6 +61,7 @@
enum MAPISTATUS retval;
uint32_t size;
mapi_object_table_t *table;
+ uint8_t logon_id = 0;
/* sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -69,6 +70,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetColumns");
size = 0;
@@ -81,7 +85,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetColumns;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetColumns = request;
size += 5;
@@ -156,6 +160,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity Checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -164,13 +169,16 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "QueryPosition");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_QueryPosition;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -245,6 +253,7 @@
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
mapi_object_table_t *table;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -253,6 +262,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "QueryRows");
size = 0;
@@ -266,7 +278,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_QueryRows;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_QueryRows = request;
size += 5;
@@ -335,6 +347,7 @@
uint32_t size;
TALLOC_CTX *mem_ctx;
mapi_object_table_t *table;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -343,6 +356,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!obj_table, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "QueryColumns");
cols->cValues = 0;
@@ -351,7 +367,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_QueryColumnsAll;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -425,6 +441,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -433,6 +450,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SeekRow");
*row = 0;
@@ -448,7 +468,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SeekRow;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SeekRow = request;
size += 5;
@@ -517,6 +537,7 @@
uint32_t size;
TALLOC_CTX *mem_ctx;
struct SBinary_short bin;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -528,6 +549,9 @@
retval = mapi_object_bookmark_find(obj_table, lpbkPosition, &bin);
OPENCHANGE_RETVAL_IF(retval, MAPI_E_INVALID_BOOKMARK, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SeekRowBookmark");
/* Fill the SeekRowBookmark operation */
@@ -544,7 +568,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SeekRowBookmark;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SeekRowBookmark = request;
size += 5;
@@ -619,6 +643,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -628,6 +653,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SeekRowApprox");
/* Fill the SeekRowApprox operation */
@@ -640,7 +668,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SeekRowApprox;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SeekRowApprox = request;
size += 5;
@@ -700,6 +728,7 @@
TALLOC_CTX *mem_ctx;
mapi_object_table_t *mapi_table;
mapi_object_bookmark_t *bookmark;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -708,13 +737,16 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CreateBookmark");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CreateBookmark;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -793,6 +825,7 @@
struct mapi_session *session;
NTSTATUS status;
enum MAPISTATUS retval;
+ uint8_t logon_id = 0;
/* Sanity check */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -808,6 +841,9 @@
bookmark = table->bookmark;
OPENCHANGE_RETVAL_IF(!bookmark, MAPI_E_INVALID_BOOKMARK, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "FreeBookmark");
while (bookmark) {
@@ -826,7 +862,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_FreeBookmark;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_FreeBookmark = request;
size += 5;
@@ -889,6 +925,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -898,6 +935,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SortTable");
/* Fill the SortTable operation */
@@ -916,7 +956,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SortTable;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SortTable = request;
size += 5;
@@ -1033,6 +1073,7 @@
struct mapi_session *session;
NTSTATUS status;
enum MAPISTATUS retval;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1041,13 +1082,16 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "Reset");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_ResetTable;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -1122,6 +1166,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1131,6 +1176,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "Restrict");
/* Fill the Restrict operation */
@@ -1146,7 +1194,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_Restrict;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_Restrict = request;
size += 5;
@@ -1230,6 +1278,7 @@
TALLOC_CTX *mem_ctx;
mapi_object_table_t *table;
struct SBinary_short bin;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1239,6 +1288,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
if (bkOrigin >= 3) {
retval = mapi_object_bookmark_find(obj_table, bkOrigin, &bin);
OPENCHANGE_RETVAL_IF(retval, MAPI_E_INVALID_BOOKMARK, NULL);
@@ -1270,7 +1322,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_FindRow;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_FindRow = request;
size += 5;
@@ -1346,6 +1398,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1354,13 +1407,16 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetStatus");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetStatus;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -1419,6 +1475,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1428,13 +1485,16 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "Abort");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_Abort;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -1518,6 +1578,7 @@
uint32_t size;
mapi_object_table_t *table;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1528,6 +1589,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "ExpandRow");
size = 0;
@@ -1540,7 +1604,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_ExpandRow;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_ExpandRow = request;
size += 5;
@@ -1620,6 +1684,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1628,6 +1693,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CollapseRow");
size = 0;
@@ -1638,7 +1706,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CollapseRow;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_CollapseRow = request;
size += 5;
@@ -1712,6 +1780,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1719,7 +1788,9 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
-
+
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetCollapseState");
size = 0;
@@ -1733,7 +1804,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetCollapseState;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetCollapseState = request;
size += 5;
@@ -1803,6 +1874,7 @@
uint32_t size;
TALLOC_CTX *mem_ctx;
mapi_object_table_t *mapi_table;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1811,7 +1883,10 @@
session = mapi_object_get_session(obj_table);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
-
+
+ if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetCollapseState");
size = 0;
@@ -1825,7 +1900,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetCollapseState;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_table);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetCollapseState = request;
size += 5;
Modified: trunk/openchange/libmapi/IMessage.c
===================================================================
--- trunk/openchange/libmapi/IMessage.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMessage.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -94,7 +94,8 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_message);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "CreateAttach");
size = 0;
@@ -170,6 +171,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -177,6 +179,9 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "DeleteAttach");
size = 0;
@@ -187,7 +192,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_DeleteAttach;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_message);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_DeleteAttach = request;
size += 5;
@@ -252,7 +257,8 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_message);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetAttachmentTable");
size = 0;
@@ -302,6 +308,89 @@
/**
+ \details Get the valid attachment IDs for a message
+
+ This function returns the list of valid attachment IDs for a message.
+ You can then use these IDs with the OpenAttach and DeleteAttach functions.
+
+ \param obj_message the message to operate on
+ \param NumAttachments the number of attachments for the message
+ \param AttachmentIds array of attachment Ids
+
+ The AttachmentIds array has NumAttachments elements.
+
+ \return MAPI_E_SUCCESS on success, otherwise MAPI error.
+
+ \note Developers may also call GetLastError() to retrieve the last
+ MAPI error code. Possible MAPI error codes are:
+ - MAPI_E_NOT_INITIALIZED: MAPI subsystem has not been initialized
+ - MAPI_E_INVALID_PARAMETER: a parameter is incorrect (e.g. null pointer)
+ - MAPI_E_CALL_FAILED: A network problem was encountered during the
+ transaction
+
+ \sa OpenAttach, DeleteAttach
+ */
+_PUBLIC_ enum MAPISTATUS GetValidAttach(mapi_object_t *obj_message, uint16_t *NumAttachments, uint32_t **AttachmentIds)
+{
+ struct mapi_request *mapi_request;
+ struct mapi_response *mapi_response;
+ struct EcDoRpc_MAPI_REQ *mapi_req;
+ struct GetValidAttachments_repl *reply;
+ struct mapi_session *session;
+ NTSTATUS status;
+ enum MAPISTATUS retval;
+ uint32_t size = 0;
+ TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
+
+ /* Sanity checks */
+ OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
+ OPENCHANGE_RETVAL_IF(!obj_message, MAPI_E_INVALID_PARAMETER, NULL);
+ OPENCHANGE_RETVAL_IF(!NumAttachments, MAPI_E_INVALID_PARAMETER, NULL);
+ OPENCHANGE_RETVAL_IF(!AttachmentIds, MAPI_E_INVALID_PARAMETER, NULL);
+ session = mapi_object_get_session(obj_message);
+ OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+ mem_ctx = talloc_named(NULL, 0, "GetValidAttach");
+ size = 0;
+
+ /* Fill the MAPI_REQ request */
+ mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
+ mapi_req->opnum = op_MAPI_GetValidAttachments;
+ mapi_req->logon_id = logon_id;
+ mapi_req->handle_idx = 0;
+ size += 5;
+
+ /* Fill the mapi_request structure */
+ mapi_request = talloc_zero(mem_ctx, struct mapi_request);
+ mapi_request->mapi_len = size + sizeof (uint32_t);
+ mapi_request->length = size;
+ mapi_request->mapi_req = mapi_req;
+ mapi_request->handles = talloc_array(mem_ctx, uint32_t, 1);
+ mapi_request->handles[0] = mapi_object_get_handle(obj_message);
+
+ status = emsmdb_transaction(session->emsmdb->ctx, mapi_request, &mapi_response);
+ OPENCHANGE_RETVAL_IF(!NT_STATUS_IS_OK(status), MAPI_E_CALL_FAILED, mem_ctx);
+ OPENCHANGE_RETVAL_IF(!mapi_response->mapi_repl, MAPI_E_CALL_FAILED, mem_ctx);
+ retval = mapi_response->mapi_repl->error_code;
+ OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
+
+ OPENCHANGE_CHECK_NOTIFICATION(session, mapi_response);
+
+ /* Retrieve the result */
+ reply = &(mapi_response->mapi_repl->u.mapi_GetValidAttachments);
+ *NumAttachments = reply->AttachmentIdCount;
+ *AttachmentIds = talloc_steal((TALLOC_CTX *)session, reply->AttachmentIdArray);
+
+ talloc_free(mapi_response);
+ talloc_free(mem_ctx);
+
+ return MAPI_E_SUCCESS;
+}
+
+/**
\details Open an attachment to a message
This function opens one attachment from a message. The attachment
@@ -341,7 +430,8 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_message);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "OpenAttach");
size = 0;
@@ -541,6 +631,7 @@
unsigned long i_prop, j;
unsigned long i_recip;
uint32_t count;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -550,6 +641,9 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "ModifyRecipients");
size = 0;
@@ -702,7 +796,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_ModifyRecipients;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_message);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_ModifyRecipients = request;
size += 5;
@@ -764,6 +858,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -772,6 +867,9 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "ReadRecipients");
size = 0;
@@ -785,7 +883,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_ReadRecipients;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_message);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_ReadRecipients = request;
size += 5;
@@ -844,6 +942,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -852,6 +951,9 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "RemoveAllRecipients");
size = 0;
@@ -862,7 +964,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_RemoveAllRecipients;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_message);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_RemoveAllRecipients = request;
size += 5;
@@ -921,6 +1023,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -929,6 +1032,9 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SubmitMessage");
size = 0;
@@ -939,7 +1045,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SubmitMessage;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_message);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SubmitMessage = request;
size += 5;
@@ -1004,6 +1110,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1016,6 +1123,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(session[0] != session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "AbortSubmit");
size = 0;
@@ -1029,7 +1139,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_AbortSubmit;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_AbortSubmit = request;
size += 5;
@@ -1094,6 +1204,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1107,6 +1218,9 @@
OPENCHANGE_RETVAL_IF(!session[0], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(parent, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SaveChangesMessage");
size = 0;
@@ -1120,7 +1234,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SaveChangesMessage;
- mapi_req->logon_id = mapi_object_get_logon_id(parent);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SaveChangesMessage = request;
size += 5;
@@ -1168,6 +1282,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1177,13 +1292,16 @@
session = mapi_object_get_session(obj_message);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "TransportSend");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_TransportSend;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_message);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -1286,6 +1404,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1297,6 +1416,9 @@
OPENCHANGE_RETVAL_IF(!session[0], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetMessageReadFlags");
size = 0;
@@ -1312,7 +1434,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetMessageReadFlag;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetMessageReadFlag = request;
size += 5;
@@ -1431,7 +1553,8 @@
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!obj_embeddedmsg, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_attach);
+ if ((retval = mapi_object_get_logon_id(obj_attach, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "OpenEmbeddedMessage");
Modified: trunk/openchange/libmapi/IMsgStore.c
===================================================================
--- trunk/openchange/libmapi/IMsgStore.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IMsgStore.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -65,7 +65,8 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_store);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "OpenFolder");
@@ -144,6 +145,7 @@
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
mapi_id_t folderId;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -156,6 +158,9 @@
OPENCHANGE_RETVAL_IF(!session[1], MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(session[0] != session[1], MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
folderId = mapi_object_get_id(obj_folder);
OPENCHANGE_RETVAL_IF(!folderId, MAPI_E_INVALID_PARAMETER, NULL);
@@ -169,7 +174,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_PublicFolderIsGhosted;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_PublicFolderIsGhosted = request;
size += 5;
@@ -239,7 +244,8 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_folder);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "OpenPublicFolderByName");
size = 0;
@@ -320,6 +326,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -328,6 +335,8 @@
OPENCHANGE_RETVAL_IF(!lpszMessageClass, MAPI_E_INVALID_PARAMETER, NULL);
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "SetReceiveFolder");
@@ -341,7 +350,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetReceiveFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetReceiveFolder = request;
size += 5;
@@ -406,13 +415,16 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!obj_store, MAPI_E_INVALID_PARAMETER, NULL);
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
-
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetReceiveFolder");
*id_folder = 0;
@@ -429,7 +441,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetReceiveFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetReceiveFolder = request;
size += 5;
@@ -493,12 +505,15 @@
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
uint32_t i;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!obj_store, MAPI_E_INVALID_PARAMETER, NULL);
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetReceiveFolderTable");
size = 0;
@@ -506,7 +521,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetReceiveFolderTable;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -591,6 +606,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -598,6 +614,8 @@
OPENCHANGE_RETVAL_IF(!FolderId, MAPI_E_INVALID_PARAMETER, NULL);
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "GetTransportFolder");
size = 0;
@@ -605,7 +623,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetTransportFolder;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -676,6 +694,7 @@
TALLOC_CTX *mem_ctx;
mapi_id_t FolderId;
uint32_t i;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -688,6 +707,9 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
FolderId = mapi_object_get_id(obj_folder);
OPENCHANGE_RETVAL_IF(!FolderId, MAPI_E_INVALID_PARAMETER, NULL);
@@ -702,7 +724,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetOwningServers;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_GetOwningServers = request;
size += 5;
@@ -776,6 +798,7 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity Checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -785,13 +808,16 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetStoreState");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetStoreState;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -885,6 +911,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -894,6 +921,9 @@
session = mapi_object_get_session(obj_folder);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "TransportNewMail");
/* Fill the TransportNewMail operation */
@@ -910,7 +940,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_TransportNewMail;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_folder);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_TransportNewMail = request;
size += 5;
Modified: trunk/openchange/libmapi/IStoreFolder.c
===================================================================
--- trunk/openchange/libmapi/IStoreFolder.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IStoreFolder.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -85,7 +85,8 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_store);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "OpenMessage");
@@ -165,3 +166,129 @@
return MAPI_E_SUCCESS;
}
+
+/**
+ \details Retrieve the message properties for an already open message.
+
+ This function is very similar to OpenMessage, but works on an already
+ open message object.
+
+ \param obj_store the store to read from
+ \param id_folder the folder ID
+ \param id_message the message ID
+ \param obj_message the resulting message object
+ \param ulFlags
+
+ Possible ulFlags values:
+ - 0x0: read only access
+ - 0x1: ReadWrite
+ - 0x3: Create
+
+ \return MAPI_E_SUCCESS on success, otherwise MAPI error.
+
+ \note Developers may also call GetLastError() to retrieve the last
+ MAPI error code. Possible MAPI error codes are:
+ - MAPI_E_NOT_INITIALIZED: MAPI subsystem has not been initialized
+ - MAPI_E_INVALID_PARAMETER: obj_store is undefined
+ - MAPI_E_CALL_FAILED: A network problem was encountered during the
+ transaction
+
+ \sa OpenMessage
+*/
+_PUBLIC_ enum MAPISTATUS ReloadCachedInformation(mapi_object_t *obj_message)
+{
+ struct mapi_request *mapi_request;
+ struct mapi_response *mapi_response;
+ struct EcDoRpc_MAPI_REQ *mapi_req;
+ struct ReloadCachedInformation_req request;
+ struct ReloadCachedInformation_repl *reply;
+ struct mapi_session *session;
+ mapi_object_message_t *message;
+ struct SPropValue lpProp;
+ NTSTATUS status;
+ enum MAPISTATUS retval;
+ uint32_t size = 0;
+ TALLOC_CTX *mem_ctx;
+ uint32_t i = 0;
+ uint8_t logon_id;
+
+ /* Sanity checks */
+ OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
+ OPENCHANGE_RETVAL_IF(!obj_message, MAPI_E_INVALID_PARAMETER, NULL);
+ session = mapi_object_get_session(obj_message);
+ OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+
+ if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
+ mem_ctx = talloc_named(NULL, 0, "ReloadCachedInformation");
+
+ /* Fill the ReloadCachedInformation operation */
+ request.Reserved = 0x0000;
+ size += sizeof (uint16_t);
+
+ /* Fill the MAPI_REQ request */
+ mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
+ mapi_req->opnum = op_MAPI_ReloadCachedInformation;
+ mapi_req->logon_id = logon_id;
+ mapi_req->handle_idx = 0;
+ mapi_req->u.mapi_ReloadCachedInformation = request;
+ size += 5;
+
+ /* Fill the mapi_request structure */
+ mapi_request = talloc_zero(mem_ctx, struct mapi_request);
+ mapi_request->mapi_len = size + sizeof (uint32_t);
+ mapi_request->length = size;
+ mapi_request->mapi_req = mapi_req;
+ mapi_request->handles = talloc_array(mem_ctx, uint32_t, 1);
+ mapi_request->handles[0] = mapi_object_get_handle(obj_message);
+
+ status = emsmdb_transaction(session->emsmdb->ctx, mapi_request, &mapi_response);
+ OPENCHANGE_RETVAL_IF(!NT_STATUS_IS_OK(status), MAPI_E_CALL_FAILED, mem_ctx);
+ OPENCHANGE_RETVAL_IF(!mapi_response->mapi_repl, MAPI_E_CALL_FAILED, mem_ctx);
+ retval = mapi_response->mapi_repl->error_code;
+
+ OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
+
+ OPENCHANGE_CHECK_NOTIFICATION(session, mapi_response);
+
+ /* Store ReloadCachedInformation reply data */
+ reply = &mapi_response->mapi_repl->u.mapi_ReloadCachedInformation;
+
+ message = talloc_zero((TALLOC_CTX *)session, mapi_object_message_t);
+ message->cValues = reply->RecipientColumns.cValues;
+ message->SRowSet.cRows = reply->RowCount;
+ message->SRowSet.aRow = talloc_array((TALLOC_CTX *)message, struct SRow, reply->RowCount + 1);
+
+ message->SPropTagArray.cValues = reply->RecipientColumns.cValues;
+ message->SPropTagArray.aulPropTag = talloc_steal(message, reply->RecipientColumns.aulPropTag);
+
+ for (i = 0; i < reply->RowCount; i++) {
+ emsmdb_get_SRow((TALLOC_CTX *)message, global_mapi_ctx->lp_ctx,
+ &(message->SRowSet.aRow[i]), &message->SPropTagArray,
+ reply->RecipientRows[i].RecipientRow.prop_count,
+ &reply->RecipientRows[i].RecipientRow.prop_values,
+ reply->RecipientRows[i].RecipientRow.layout, 1);
+
+ lpProp.ulPropTag = PR_RECIPIENT_TYPE;
+ lpProp.value.l = reply->RecipientRows[i].RecipientType;
+ SRow_addprop(&(message->SRowSet.aRow[i]), lpProp);
+
+ lpProp.ulPropTag = PR_INTERNET_CPID;
+ lpProp.value.l = reply->RecipientRows[i].CodePageId;
+ SRow_addprop(&(message->SRowSet.aRow[i]), lpProp);
+ }
+
+ /* add SPropTagArray elements we automatically append to SRow */
+ SPropTagArray_add((TALLOC_CTX *)message, &message->SPropTagArray, PR_RECIPIENT_TYPE);
+ SPropTagArray_add((TALLOC_CTX *)message, &message->SPropTagArray, PR_INTERNET_CPID);
+
+ talloc_free(obj_message->private_data);
+ obj_message->private_data = (void *) message;
+
+ talloc_free(mapi_response);
+ talloc_free(mem_ctx);
+
+ errno = 0;
+ return MAPI_E_SUCCESS;
+}
Modified: trunk/openchange/libmapi/IStream.c
===================================================================
--- trunk/openchange/libmapi/IStream.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IStream.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -60,8 +60,9 @@
\sa ReadStream, WriteStream, GetLastError
*/
-_PUBLIC_ enum MAPISTATUS OpenStream(mapi_object_t *obj_related, uint32_t PropertyTag,
- uint8_t OpenModeFlags, mapi_object_t *obj_stream)
+_PUBLIC_ enum MAPISTATUS OpenStream(mapi_object_t *obj_related, enum MAPITAGS PropertyTag,
+ enum OpenStream_OpenModeFlags OpenModeFlags,
+ mapi_object_t *obj_stream)
{
struct mapi_request *mapi_request;
struct mapi_response *mapi_response;
@@ -79,7 +80,8 @@
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_related);
+ if ((retval = mapi_object_get_logon_id(obj_related, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "OpenStream");
@@ -173,12 +175,16 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
session = mapi_object_get_session(obj_stream);
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "ReadStream");
*ByteRead = 0;
@@ -191,7 +197,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_ReadStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_ReadStream = request;
size += 5;
@@ -268,6 +274,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity Checks */
session = mapi_object_get_session(obj_stream);
@@ -276,6 +283,9 @@
OPENCHANGE_RETVAL_IF(!blob, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(blob->length > 0x7000, MAPI_E_TOO_BIG, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "WriteStream");
size = 0;
@@ -289,7 +299,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_WriteStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_WriteStream = request;
size += 5;
@@ -347,6 +357,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
session = mapi_object_get_session(obj_stream);
@@ -354,13 +365,16 @@
OPENCHANGE_RETVAL_IF(!obj_stream, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CommitStream");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CommitStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -415,6 +429,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -422,13 +437,16 @@
session = mapi_object_get_session(obj_stream);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "GetStreamSize");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_GetStreamSize;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -498,6 +516,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -507,6 +526,9 @@
OPENCHANGE_RETVAL_IF((Origin > 2), MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!NewPosition, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SeekStream");
size = 0;
@@ -520,7 +542,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SeekStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SeekStream = request;
size += 5;
@@ -578,6 +600,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -585,6 +608,9 @@
session = mapi_object_get_session(obj_stream);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetStreamSize");
size = 0;
@@ -595,7 +621,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetStreamSize;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SetStreamSize = request;
size += 5;
@@ -660,6 +686,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity Check */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -677,6 +704,9 @@
OPENCHANGE_RETVAL_IF(!ReadByteCount, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!WrittenByteCount, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "CopyToStream");
size = 0;
@@ -690,7 +720,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_CopyToStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_src);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_CopyToStream = request;
size += 5;
@@ -757,6 +787,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -764,6 +795,9 @@
session = mapi_object_get_session(obj_stream);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "LockRegionStream");
size = 0;
@@ -778,7 +812,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_LockRegionStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_LockRegionStream = request;
size += 5;
@@ -836,6 +870,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -843,6 +878,9 @@
session = mapi_object_get_session(obj_stream);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "UnlockRegionStream");
size = 0;
@@ -857,7 +895,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_UnlockRegionStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_UnlockRegionStream = request;
size += 5;
@@ -920,7 +958,8 @@
session = mapi_object_get_session(obj_src);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
- logon_id = mapi_object_get_logon_id(obj_src);
+ if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
mem_ctx = talloc_named(NULL, 0, "CloneStream");
size = 0;
@@ -1002,6 +1041,7 @@
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
uint32_t size;
+ uint8_t logon_id = 0;
/* Sanity Checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -1011,6 +1051,9 @@
OPENCHANGE_RETVAL_IF(!blob, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(blob->length > 0x7000, MAPI_E_TOO_BIG, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "WriteAndCommitStream");
size = 0;
@@ -1024,7 +1067,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_WriteAndCommitStream;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_stream);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_WriteAndCommitStream = request;
size += 5;
Modified: trunk/openchange/libmapi/IUnknown.c
===================================================================
--- trunk/openchange/libmapi/IUnknown.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IUnknown.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -118,18 +118,23 @@
NTSTATUS status;
TALLOC_CTX *mem_ctx;
uint32_t size = 0;
+ enum MAPISTATUS retval;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "Release");
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_Release;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -202,6 +207,7 @@
uint32_t size = 0;
enum MAPISTATUS retval;
int i;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -209,6 +215,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "LongTermIdFromId");
/* Fill the LongTermIdFromId operation */
@@ -218,7 +227,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_LongTermIdFromId;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_LongTermIdFromId = request;
size += 5;
@@ -285,6 +294,7 @@
TALLOC_CTX *mem_ctx;
uint32_t size = 0;
enum MAPISTATUS retval;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -292,6 +302,9 @@
session = mapi_object_get_session(obj);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "IdFromLongTermId");
size = 0;
@@ -302,7 +315,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_IdFromLongTermId;
- mapi_req->logon_id = mapi_object_get_logon_id(obj);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_IdFromLongTermId = request;
size += 5;
Modified: trunk/openchange/libmapi/IXPLogon.c
===================================================================
--- trunk/openchange/libmapi/IXPLogon.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/IXPLogon.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -60,6 +60,7 @@
enum MAPISTATUS retval;
uint32_t size;
TALLOC_CTX *mem_ctx;
+ uint8_t logon_id = 0;
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
@@ -68,13 +69,16 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "AddressTypes");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_AddressTypes;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -132,7 +136,8 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
-
+ uint8_t logon_id = 0;
+
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!obj_store, MAPI_E_INVALID_PARAMETER, NULL);
@@ -140,13 +145,16 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SetSpooler");
size = 0;
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SetSpooler;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
size += 5;
@@ -209,7 +217,8 @@
enum MAPISTATUS retval;
uint32_t size = 0;
TALLOC_CTX *mem_ctx;
-
+ uint8_t logon_id = 0;
+
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!global_mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!obj_store, MAPI_E_INVALID_PARAMETER, NULL);
@@ -219,6 +228,9 @@
session = mapi_object_get_session(obj_store);
OPENCHANGE_RETVAL_IF(!session, MAPI_E_INVALID_PARAMETER, NULL);
+ if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
+ return retval;
+
mem_ctx = talloc_named(NULL, 0, "SpoolerLockMessage");
size = 0;
@@ -232,7 +244,7 @@
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
mapi_req->opnum = op_MAPI_SpoolerLockMessage;
- mapi_req->logon_id = mapi_object_get_logon_id(obj_store);
+ mapi_req->logon_id = logon_id;
mapi_req->handle_idx = 0;
mapi_req->u.mapi_SpoolerLockMessage = request;
size += 5;
Modified: trunk/openchange/libmapi/conf/mapi-properties
===================================================================
--- trunk/openchange/libmapi/conf/mapi-properties 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/conf/mapi-properties 2009-09-26 00:26:13 UTC (rev 3059)
@@ -224,6 +224,7 @@
0x0e670102 PR_AGE_LIMIT
0x0e790003 PR_TRUST_SENDER
0x0e960102 PR_ATTACH_VIRUS_SCAN_INFO
+0x0e9b0003 PR_EXTENDED_RULE_SIZE_LIMIT
0x0ff40003 PR_ACCESS PidTagAccess
0x0ff50003 PR_ROW_TYPE
0x0ff60102 PR_INSTANCE_KEY PidTagInstanceKey
@@ -788,8 +789,10 @@
0x66670102 PR_FOREIGN_ID
0x66680102 PR_FOREIGN_REPORT_ID
0x66690102 PR_FOREIGN_SUBJECT_ID
-0x666a0102 PR_INTERNAL_TRACE_INFO
+0x666a0003 PR_PROHIBIT_RECEIVE_QUOTA
0x666c000b PR_IN_CONFLICT
+0x666d0003 PR_MAX_SUBMIT_MESSAGE_SIZE
+0x666e0003 PR_PROHIBIT_SEND_QUOTA
0x66700102 PR_LONGTERM_ENTRYID_FROM_TABLE
0x66710014 PR_MEMBER_ID
0x6672001e PR_MEMBER_NAME
@@ -890,6 +893,7 @@
0x67200102 PR_INTERNET_FREE_DOC_INFO
0x67210003 PR_PF_OVER_HARD_QUOTA_LIMIT
0x67220003 PR_PF_MSG_SIZE_LIMIT
+0x674000fb PR_SENT_MAILSVR_EID PidTagSentMailSvrEID
0x67430003 PR_CONNECTION_MODULUS
0x6744001e PR_DELIVER_TO_DN
0x67460003 PR_MIME_SIZE
Modified: trunk/openchange/libmapi/mapi_object.c
===================================================================
--- trunk/openchange/libmapi/mapi_object.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi/mapi_object.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -232,12 +232,18 @@
\details Retrieve the logon id for a given MAPI object
\param obj pointer to the object to retrieve the logon id from
+ \param logon_id pointer to a variable to store the logon id
- \return the object logon ID on success, otherwise -1
+ \return MAPI_E_SUCCESS on success, otherwise MAPI error.
*/
-_PUBLIC_ uint8_t mapi_object_get_logon_id(mapi_object_t *obj)
+_PUBLIC_ enum MAPISTATUS mapi_object_get_logon_id(mapi_object_t *obj, uint8_t *logon_id)
{
- return (!obj) ? -1 : obj->logon_id;
+ if (!obj || !logon_id)
+ return MAPI_E_INVALID_PARAMETER;
+
+ *logon_id = obj->logon_id;
+
+ return MAPI_E_SUCCESS;
}
Modified: trunk/openchange/libmapi++/attachment.h
===================================================================
--- trunk/openchange/libmapi++/attachment.h 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/libmapi++/attachment.h 2009-09-26 00:26:13 UTC (rev 3059)
@@ -86,7 +86,7 @@
} else {
mapi_object_t obj_stream;
mapi_object_init(&obj_stream);
- if (OpenStream(&m_object, PR_ATTACH_DATA_BIN, 0, &obj_stream) != MAPI_E_SUCCESS)
+ if (OpenStream(&m_object, PR_ATTACH_DATA_BIN, OpenStream_ReadOnly, &obj_stream) != MAPI_E_SUCCESS)
throw mapi_exception(GetLastError(), "attachment::attachment : OpenStream");
if (GetStreamSize(&obj_stream, &m_data_size) != MAPI_E_SUCCESS)
Modified: trunk/openchange/torture/mapi_fetchattach.c
===================================================================
--- trunk/openchange/torture/mapi_fetchattach.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/torture/mapi_fetchattach.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -199,7 +199,7 @@
retval = OpenAttach(&obj_message, num_attach, &obj_attach);
mapi_errstr("OpenAttach", GetLastError());
if (retval == MAPI_E_SUCCESS) {
- retval = OpenStream(&obj_attach, PR_ATTACH_DATA_BIN, 0, &obj_stream);
+ retval = OpenStream(&obj_attach, PR_ATTACH_DATA_BIN, OpenStream_ReadOnly, &obj_stream);
mapi_errstr("OpenStream", GetLastError());
/* read stream content */
Modified: trunk/openchange/torture/mapi_namedprops.c
===================================================================
--- trunk/openchange/torture/mapi_namedprops.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/torture/mapi_namedprops.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -112,7 +112,7 @@
retval = OpenMessage(&obj_folder,
SRowSet.aRow[0].lpProps[0].value.d,
SRowSet.aRow[0].lpProps[1].value.d,
- &obj_message, MAPI_MODIFY|MAPI_CREATE);
+ &obj_message, Create);
if (retval != MAPI_E_SUCCESS) return false;
retval = GetPropsAll(&obj_message, &props_array);
Modified: trunk/openchange/torture/mapi_sendattach.c
===================================================================
--- trunk/openchange/torture/mapi_sendattach.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/torture/mapi_sendattach.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -176,7 +176,7 @@
if (retval != MAPI_E_SUCCESS) return false;
/* OpenStream on CreateAttach handle */
- retval = OpenStream(&obj_attach, PR_ATTACH_DATA_BIN, 2, &obj_stream);
+ retval = OpenStream(&obj_attach, PR_ATTACH_DATA_BIN, OpenStream_Create, &obj_stream);
mapi_errstr("OpenStream", GetLastError());
if (retval != MAPI_E_SUCCESS) return false;
Modified: trunk/openchange/utils/exchange2ical/exchange2ical_utils.c
===================================================================
--- trunk/openchange/utils/exchange2ical/exchange2ical_utils.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/utils/exchange2ical/exchange2ical_utils.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -9,12 +9,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -109,7 +109,7 @@
return ical_calendartype[i].calendar;
}
}
-
+
return NULL;
}
@@ -141,7 +141,7 @@
enum icalproperty_class get_ical_class(uint32_t sensivity)
{
uint32_t i;
-
+
for (i = 0; ical_class[i].classtype != ICAL_CLASS_NONE; ++i) {
if (sensivity == ical_class[i].sensivity) {
return ical_class[i].classtype;
@@ -206,12 +206,12 @@
nttime |= ft->dwLowDateTime;
nttime_to_timeval(&temp_timeval, nttime);
tm = gmtime(&temp_timeval.tv_sec);
-
- tt.year = tm->tm_year + 1900;
- tt.month = tm->tm_mon + 1;
- tt.day = tm->tm_mday;
- tt.hour = tm->tm_hour;
- tt.minute = tm->tm_min;
+
+ tt.year = tm->tm_year + 1900;
+ tt.month = tm->tm_mon + 1;
+ tt.day = tm->tm_mday;
+ tt.hour = tm->tm_hour;
+ tt.minute = tm->tm_min;
tt.second = tm->tm_sec;
tt.is_date = 0;
tt.is_utc = 1;
@@ -233,12 +233,12 @@
nttime |= ft->dwLowDateTime;
nttime_to_timeval(&temp_timeval, nttime);
tm = gmtime(&temp_timeval.tv_sec);
-
- tt.year = tm->tm_year + 1900;
- tt.month = tm->tm_mon + 1;
- tt.day = tm->tm_mday;
- tt.hour = 0;
- tt.minute = 0;
+
+ tt.year = tm->tm_year + 1900;
+ tt.month = tm->tm_mon + 1;
+ tt.day = tm->tm_mday;
+ tt.hour = 0;
+ tt.minute = 0;
tt.second = 0;
tt.is_date = 1;
tt.is_utc = 1;
@@ -246,4 +246,4 @@
tt.zone = NULL;
return tt;
-}
\ No newline at end of file
+}
Modified: trunk/openchange/utils/mapitest/module.c
===================================================================
--- trunk/openchange/utils/mapitest/module.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/utils/mapitest/module.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -155,6 +155,8 @@
mapitest_suite_add_test(suite, "GET-MESSAGE-STATUS", "Get message status", mapitest_oxcmsg_GetMessageStatus);
mapitest_suite_add_test(suite, "SET-MESSAGE-STATUS", "Set message status", mapitest_oxcmsg_SetMessageStatus);
mapitest_suite_add_test(suite, "OPEN-EMBEDDED-MESSAGE", "Open a message embedded in another message", mapitest_oxcmsg_OpenEmbeddedMessage);
+ mapitest_suite_add_test(suite, "GET-VALID-ATTACHMENTS", "Get valid attachment IDs for a message", mapitest_oxcmsg_GetValidAttachments);
+ mapitest_suite_add_test(suite, "RELOAD-CACHED-INFORMATION", "Reload cached information for a message", mapitest_oxcmsg_ReloadCachedInformation);
mapitest_suite_register(mt, suite);
Modified: trunk/openchange/utils/mapitest/modules/module_oxcmsg.c
===================================================================
--- trunk/openchange/utils/mapitest/modules/module_oxcmsg.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/utils/mapitest/modules/module_oxcmsg.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -446,14 +446,14 @@
ret = true;
- /* Step 5. Remove all recipients */
+ /* Step 4. Remove all recipients */
retval = RemoveAllRecipients(&obj_message);
mapitest_print_retval(mt, "RemoveAllRecipients");
if (GetLastError() != MAPI_E_SUCCESS) {
ret = false;
}
- /* Step 4. Save the message */
+ /* Step 5. Save the message */
retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadOnly);
mapitest_print_retval(mt, "SaveChangesMessage");
if (GetLastError() != MAPI_E_SUCCESS) {
@@ -1114,7 +1114,7 @@
return false;
}
- /* Step 2. Open Outbox folder */
+ /* Step 2. Open Inbox folder */
mapi_object_init(&obj_folder);
ret = mapitest_common_folder_open(mt, &obj_store, &obj_folder, olFolderInbox);
if (ret == false) {
@@ -1226,7 +1226,7 @@
mapi_object_release(&obj_store);
return false;
}
- retval = OpenEmbeddedMessage(&obj_attach, &obj_embeddedmsg, 0);
+ retval = OpenEmbeddedMessage(&obj_attach, &obj_embeddedmsg, MAPI_READONLY);
mapitest_print(mt, "* %-35s: 0x%.8x\n", "OpenEmbeddedMessage", retval);
if (retval != MAPI_E_SUCCESS) {
mapi_object_release(&obj_attach);
@@ -1263,3 +1263,308 @@
return true;
}
+
+
+/**
+ \details Test the GetValidAttachments (0x52) and CreateAttach (0x23) operations
+
+ This function:
+ -# Logs on the user private mailbox
+ -# Open the Inbox folder
+ -# Create a test message
+ -# Check the number of valid attachments is zero
+ -# Create two attachments
+ -# Check the number of valid attachments is two (numbered 0 and 1)
+ -# Delete the first attachment
+ -# Check the number of valid attachments is one (numbered 1)
+ -# Delete the test message
+
+ \param mt pointer to the top-level mapitest structure
+
+ \return true on success, otherwise false
+ */
+_PUBLIC_ bool mapitest_oxcmsg_GetValidAttachments(struct mapitest *mt)
+{
+ enum MAPISTATUS retval;
+ bool ret;
+ mapi_object_t obj_store;
+ mapi_object_t obj_folder;
+ mapi_object_t obj_message;
+ mapi_object_t obj_attach0;
+ mapi_object_t obj_attach1;
+ mapi_id_t id_msgs[1];
+ struct SPropValue attach[3];
+ uint16_t numAttach;
+ uint32_t *attachmentIds;
+
+ /* Step 1. Logon */
+ mapi_object_init(&obj_store);
+ retval = OpenMsgStore(mt->session, &obj_store);
+ if (retval != MAPI_E_SUCCESS) {
+ mapi_object_release(&obj_store);
+ return false;
+ }
+
+ /* Step 2. Open Inbox folder */
+ mapi_object_init(&obj_folder);
+ ret = mapitest_common_folder_open(mt, &obj_store, &obj_folder, olFolderInbox);
+ if (ret == false) {
+ mapi_object_release(&obj_folder);
+ mapi_object_release(&obj_store);
+ return false;
+ }
+
+ /* Step 3. Create the test message and save it */
+ mapi_object_init(&obj_message);
+ ret = mapitest_common_message_create(mt, &obj_folder, &obj_message, OXCMSG_SETREADFLAGS);
+ if (ret == false) return ret;
+
+ retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadWrite);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "SaveChangesMessage", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ mapi_object_release(&obj_message);
+ mapi_object_release(&obj_folder);
+ mapi_object_release(&obj_store);
+ return false;
+ }
+
+ ret = true;
+
+ /* Step 4. Check the number of valid attachments */
+ numAttach = 99;
+ retval = GetValidAttach(&obj_message, &numAttach, &attachmentIds);
+ mapitest_print(mt, "* %-35s: 0x%.8x (%d)\n", "GetValidAttach", retval, numAttach);
+ if (numAttach != 0) {
+ ret = false;
+ goto cleanup;
+ }
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 5. Create two attachments to the message */
+ mapi_object_init(&obj_attach0);
+ retval = CreateAttach(&obj_message, &obj_attach0);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "CreateAttach", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* use SetProps() to set the attachment up */
+ attach[0].ulPropTag = PR_ATTACH_METHOD;
+ attach[0].value.l = ATTACH_BY_VALUE;
+ attach[1].ulPropTag = PR_RENDERING_POSITION;
+ attach[1].value.l = 0;
+ attach[2].ulPropTag = PR_ATTACH_FILENAME;
+ attach[2].value.lpszA = "Attachment 0";
+ retval = SetProps(&obj_attach0, attach, 3);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "SetProps", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Save the changes to the attachment and then the message */
+ retval = SaveChangesAttachment(&obj_message, &obj_attach0, KeepOpenReadOnly);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "SaveChangesAttachment", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ mapi_object_init(&obj_attach1);
+ retval = CreateAttach(&obj_message, &obj_attach1);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "CreateAttach", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* use SetProps() to set the attachment up */
+ attach[0].ulPropTag = PR_ATTACH_METHOD;
+ attach[0].value.l = ATTACH_BY_VALUE;
+ attach[1].ulPropTag = PR_RENDERING_POSITION;
+ attach[1].value.l = 0;
+ attach[2].ulPropTag = PR_ATTACH_FILENAME;
+ attach[2].value.lpszA = "Attachment 1";
+ retval = SetProps(&obj_attach1, attach, 3);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "SetProps", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Save the changes to the attachment and then the message */
+ retval = SaveChangesAttachment(&obj_message, &obj_attach1, KeepOpenReadOnly);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "SaveChangesAttachment", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadWrite);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "SaveChangesMessage", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 6. Check the number of valid attachments */
+ numAttach = 99;
+ retval = GetValidAttach(&obj_message, &numAttach, &attachmentIds);
+ mapitest_print(mt, "* %-35s: 0x%.8x (%d)\n", "GetValidAttach", retval, numAttach);
+ if (numAttach != 2) {
+ ret = false;
+ goto cleanup;
+ }
+ mapitest_print(mt, "IDs: %d, %d\n", attachmentIds[0], attachmentIds[1]);
+ if ( (attachmentIds[0] != 0) || (attachmentIds[1] != 1) ) {
+ ret = false;
+ goto cleanup;
+ }
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 7. Delete the first attachment */
+ retval = DeleteAttach(&obj_message, attachmentIds[0]);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "DeleteAttach", retval);
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 8. Check the number of valid attachments */
+ numAttach = 99;
+ retval = GetValidAttach(&obj_message, &numAttach, &attachmentIds);
+ mapitest_print(mt, "* %-35s: 0x%.8x (%d)\n", "GetValidAttach", retval, numAttach);
+ if (numAttach != 1) {
+ ret = false;
+ goto cleanup;
+ }
+ mapitest_print(mt, "IDs: %d\n", attachmentIds[0]);
+ if ( (attachmentIds[0] != 1) ) {
+ ret = false;
+ goto cleanup;
+ }
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 9. Delete the message */
+ id_msgs[0] = mapi_object_get_id(&obj_message);
+ retval = DeleteMessage(&obj_folder, id_msgs, 1);
+ mapitest_print(mt, "* %-35s: 0x%.8x\n", "DeleteMessage", retval);
+ if (GetLastError() != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+cleanup:
+ /* Release */
+ mapi_object_release(&obj_attach0);
+ mapi_object_release(&obj_attach1);
+ mapi_object_release(&obj_message);
+ mapi_object_release(&obj_folder);
+ mapi_object_release(&obj_store);
+
+ return ret;
+}
+
+/**
+ \details Test the ReloadCachedInformation (0x10) operation
+
+ This function:
+ -# Logs on to the user private mailbox
+ -# Open the outbox folder
+ -# Create the message
+ -# Save the message
+ -# Reloads the cached message information
+ -# Delete the message
+
+ \param mt pointer to the top-level mapitest structure
+
+ \return true on success, otherwise false
+ */
+_PUBLIC_ bool mapitest_oxcmsg_ReloadCachedInformation(struct mapitest *mt)
+{
+ enum MAPISTATUS retval;
+ mapi_object_t obj_store;
+ mapi_object_t obj_folder;
+ mapi_object_t obj_message;
+ mapi_id_t id_folder;
+ mapi_id_t id_msgs[1];
+ bool ret;
+
+ ret = true;
+
+ /* Step 1. Logon */
+ mapi_object_init(&obj_store);
+ retval = OpenMsgStore(mt->session, &obj_store);
+ mapitest_print_retval(mt, "OpenMsgStore");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 2. Open Outbox folder */
+ retval = GetDefaultFolder(&obj_store, &id_folder, olFolderOutbox);
+ mapitest_print_retval(mt, "GetDefaultFolder");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ mapi_object_init(&obj_folder);
+ retval = OpenFolder(&obj_store, id_folder, &obj_folder);
+ mapitest_print_retval(mt, "OpenFolder");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 3. Create the message */
+ mapi_object_init(&obj_message);
+ retval = CreateMessage(&obj_folder, &obj_message);
+ mapitest_print_retval(mt, "CreateMessage");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 4. Save the message */
+ retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadOnly);
+ mapitest_print_retval(mt, "SaveChangesMessage");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 5. Reload cached information */
+ retval = ReloadCachedInformation(&obj_message);
+ mapitest_print_retval(mt, "ReloadCachedInformation");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+ /* Step 6. Delete the saved message */
+ id_msgs[0] = mapi_object_get_id(&obj_message);
+ retval = DeleteMessage(&obj_folder, id_msgs, 1);
+ mapitest_print_retval(mt, "DeleteMessage");
+ if (retval != MAPI_E_SUCCESS) {
+ ret = false;
+ goto cleanup;
+ }
+
+cleanup:
+ /* Release */
+ mapi_object_release(&obj_message);
+ mapi_object_release(&obj_folder);
+ mapi_object_release(&obj_store);
+
+ return ret;
+}
Modified: trunk/openchange/utils/openchangeclient.c
===================================================================
--- trunk/openchange/utils/openchangeclient.c 2009-09-26 00:25:46 UTC (rev 3058)
+++ trunk/openchange/utils/openchangeclient.c 2009-09-26 00:26:13 UTC (rev 3059)
@@ -1915,7 +1915,7 @@
fid = (const uint64_t *)find_SPropValue_data(&SRowSet.aRow[i], PR_FID);
mid = (const uint64_t *)find_SPropValue_data(&SRowSet.aRow[i], PR_MID);
if (mid && *mid == smid) {
- retval = OpenMessage(obj_folder, *fid, *mid, obj_message, MAPI_MODIFY);
+ retval = OpenMessage(obj_folder, *fid, *mid, obj_message, ReadWrite);
mapi_object_release(&obj_htable);
return retval;
}
More information about the Pkg-samba-maint
mailing list