Merge in sogo revs r3786-3829
authorJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 13 Mar 2012 10:52:50 +0000 (10:52 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 13 Mar 2012 10:52:50 +0000 (10:52 +0000)
14 files changed:
libmapi/libmapi.h
libmapi/property.c
libmapi/property_tags.c
libmapi/property_tags.h
mapiproxy/libmapistore/mapistore_backend.c
mapiproxy/servers/default/emsmdb/emsmdbp_object.c
mapiproxy/servers/default/emsmdb/oxcfxics.c
mapiproxy/servers/default/emsmdb/oxcmsg.c
mapiproxy/servers/default/emsmdb/oxomsg.c
mapiproxy/servers/default/nspi/emsabp.c
mapiproxy/servers/default/nspi/emsabp_property.c
properties_enum.h
property.idl
script/makepropslist.py

index c4bc82dfb060bac0f7905ff4e58aafe8c46c34ba..230f35f040a42b3f261d25becc5fea5ea781826a 100644 (file)
@@ -280,8 +280,10 @@ struct AppointmentRecurrencePattern *get_AppointmentRecurrencePattern(TALLOC_CTX
 struct Binary_r *set_RecurrencePattern(TALLOC_CTX *, const struct RecurrencePattern *);
 struct Binary_r *set_AppointmentRecurrencePattern(TALLOC_CTX *mem_ctx, const struct AppointmentRecurrencePattern *);
 struct TimeZoneStruct  *get_TimeZoneStruct(TALLOC_CTX *, struct Binary_r *);
+struct PtypServerId    *get_PtypServerId(TALLOC_CTX *, struct Binary_r *);
 struct GlobalObjectId  *get_GlobalObjectId(TALLOC_CTX *, struct Binary_r *);
 struct MessageEntryId  *get_MessageEntryId(TALLOC_CTX *, struct Binary_r *);
+struct FolderEntryId   *get_FolderEntryId(TALLOC_CTX *, struct Binary_r *);
 struct AddressBookEntryId *get_AddressBookEntryId(TALLOC_CTX *, struct Binary_r *);
 const char             *get_TypedString(struct TypedString *);
 bool                   set_mapi_SPropValue(TALLOC_CTX *, struct mapi_SPropValue *, const void *);
index c2b74deab433ca09d85cc0289e02f288cdbd7442..f21cc87f65113cd3f4e4b233f83e014098447b48 100644 (file)
@@ -412,6 +412,7 @@ _PUBLIC_ const void *get_SPropValue_data(struct SPropValue *lpProps)
        case PT_CLSID:
                return (const void *)lpProps->value.lpguid;
        case PT_BINARY:
+       case PT_SVREID:
                return (const void *)&lpProps->value.bin;
        case PT_OBJECT:
                return (const void *)&lpProps->value.object;
@@ -462,6 +463,7 @@ _PUBLIC_ struct SPropValue *add_SPropValue(TALLOC_CTX *mem_ctx,
 _PUBLIC_ bool set_mapi_SPropValue(TALLOC_CTX *mem_ctx, struct mapi_SPropValue *lpProps, const void *data)
 {
        if (data == NULL) {
+               lpProps->ulPropTag = (lpProps->ulPropTag & 0xffff0000) | PT_ERROR;
                lpProps->value.err = MAPI_E_NOT_FOUND;
                return false;
        }
@@ -521,6 +523,7 @@ _PUBLIC_ bool set_mapi_SPropValue(TALLOC_CTX *mem_ctx, struct mapi_SPropValue *l
                lpProps->value.MVszW = *((const struct mapi_SLPSTRArrayW *)data);
                break;
        default:
+               lpProps->ulPropTag = (lpProps->ulPropTag & 0xffff0000) | PT_ERROR;
                lpProps->value.err = MAPI_E_NOT_FOUND;
 
                return false;
@@ -554,6 +557,7 @@ _PUBLIC_ struct mapi_SPropValue *add_mapi_SPropValue(TALLOC_CTX *mem_ctx, struct
 _PUBLIC_ bool set_SPropValue(struct SPropValue *lpProps, const void *data)
 {
        if (data == NULL) {
+               lpProps->ulPropTag = (lpProps->ulPropTag & 0xffff0000) | PT_ERROR;
                lpProps->value.err = MAPI_E_NOT_FOUND;
                return false;
        }
@@ -577,6 +581,7 @@ _PUBLIC_ bool set_SPropValue(struct SPropValue *lpProps, const void *data)
                lpProps->value.lpszA = (const char *) data;
                break;
        case PT_BINARY:
+       case PT_SVREID:
                lpProps->value.bin = *((const struct Binary_r *)data);
                break;
        case PT_UNICODE:
@@ -619,6 +624,7 @@ _PUBLIC_ bool set_SPropValue(struct SPropValue *lpProps, const void *data)
                lpProps->value.object = *((const uint32_t *)data);
                break;
        default:
+               lpProps->ulPropTag = (lpProps->ulPropTag & 0xffff0000) | PT_ERROR;
                lpProps->value.err = MAPI_E_NOT_FOUND;
 
                return false;
@@ -1429,6 +1435,7 @@ _PUBLIC_ size_t set_ExceptionInfo_size(const struct ExceptionInfo *exc_info)
 /*         return size; */
 /* } */
 
+#warning the get_XXX NDR wrapper should be normalized
 /**
    \details Retrieve a TimeZoneStruct structure from a binary blob
 
@@ -1474,6 +1481,48 @@ _PUBLIC_ struct TimeZoneStruct *get_TimeZoneStruct(TALLOC_CTX *mem_ctx,
 }
 
 
+/**
+   \details Retrieve a PtypServerId structure from a binary blob
+
+   \param mem_ctx pointer to the memory context
+   \param bin pointer to the Binary_r structure with raw PtypServerId data
+
+   \return Allocated PtypServerId structure on success, otherwise
+   NULL
+
+   \note Developers must free the allocated PtypServerId when
+   finished.
+ */
+_PUBLIC_ struct PtypServerId *get_PtypServerId(TALLOC_CTX *mem_ctx, struct Binary_r *bin)
+{
+       struct PtypServerId     *PtypServerId = NULL;
+       struct ndr_pull         *ndr;
+       enum ndr_err_code       ndr_err_code;
+
+       /* Sanity checks */
+       if (!bin) return NULL;
+       if (!bin->cb) return NULL;
+       if (!bin->lpb) return NULL;
+
+       ndr = talloc_zero(mem_ctx, struct ndr_pull);
+       ndr->offset = 0;
+       ndr->data = bin->lpb;
+       ndr->data_size = bin->cb;
+
+       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+       PtypServerId = talloc_zero(mem_ctx, struct PtypServerId);
+       ndr_err_code = ndr_pull_PtypServerId(ndr, NDR_SCALARS, PtypServerId);
+
+       talloc_free(ndr);
+
+       if (ndr_err_code != NDR_ERR_SUCCESS) {
+               talloc_free(PtypServerId);
+               return NULL;
+       }
+
+       return PtypServerId;
+}
+
 /**
    \details Retrieve a GlobalObjectId structure from a binary blob
 
@@ -1561,6 +1610,48 @@ _PUBLIC_ struct MessageEntryId *get_MessageEntryId(TALLOC_CTX *mem_ctx, struct B
        return MessageEntryId;
 }
 
+/**
+   \details Retrieve a FolderEntryId structure from a binary blob
+
+   \param mem_ctx pointer to the memory context
+   \param bin pointer to the Binary_r structure with raw FolderEntryId data
+
+   \return Allocated FolderEntryId structure on success, otherwise
+   NULL
+
+   \note Developers must free the allocated FolderEntryId when
+   finished.
+ */
+_PUBLIC_ struct FolderEntryId *get_FolderEntryId(TALLOC_CTX *mem_ctx, struct Binary_r *bin)
+{
+       struct FolderEntryId    *FolderEntryId = NULL;
+       struct ndr_pull         *ndr;
+       enum ndr_err_code       ndr_err_code;
+
+       /* Sanity checks */
+       if (!bin) return NULL;
+       if (!bin->cb) return NULL;
+       if (!bin->lpb) return NULL;
+
+       ndr = talloc_zero(mem_ctx, struct ndr_pull);
+       ndr->offset = 0;
+       ndr->data = bin->lpb;
+       ndr->data_size = bin->cb;
+
+       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+       FolderEntryId = talloc_zero(mem_ctx, struct FolderEntryId);
+       ndr_err_code = ndr_pull_FolderEntryId(ndr, NDR_SCALARS, FolderEntryId);
+
+       talloc_free(ndr);
+
+       if (ndr_err_code != NDR_ERR_SUCCESS) {
+               talloc_free(FolderEntryId);
+               return NULL;
+       }
+
+       return FolderEntryId;
+}
+
 /**
    \details Retrieve a AddressBookEntryId structure from a binary blob
 
index 0a6a14d1f1cdba438ca2b14615b6bd6ccacfdb8c..ef8dbddc9c44fc5c6fecd950c549d157d58d5f73 100644 (file)
@@ -64,7 +64,7 @@ static struct mapi_proptags canonical_property_tags[] = {
        { PidTagAddressBookHierarchicalRootDepartment_Error,                  PT_ERROR,     "PidTagAddressBookHierarchicalRootDepartment_Error"                 },
        { PidTagAddressBookHierarchicalShowInDepartments,                     PT_OBJECT,    "PidTagAddressBookHierarchicalShowInDepartments"                    },
        { PidTagAddressBookHierarchicalShowInDepartments_Error,               PT_ERROR,     "PidTagAddressBookHierarchicalShowInDepartments_Error"              },
-       { PidTagAddressBookHomeMessageDatabase,                               PT_STRING8,   "PidTagAddressBookHomeMessageDatabase"                              },
+       { PidTagAddressBookHomeMessageDatabase,                               PT_UNICODE,   "PidTagAddressBookHomeMessageDatabase"                              },
        { PidTagAddressBookHomeMessageDatabase_Error,                         PT_ERROR,     "PidTagAddressBookHomeMessageDatabase_Error"                        },
        { PidTagAddressBookIsMaster,                                          PT_BOOLEAN,   "PidTagAddressBookIsMaster"                                         },
        { PidTagAddressBookIsMaster_Error,                                    PT_ERROR,     "PidTagAddressBookIsMaster_Error"                                   },
index a7bc7aff79d5da63765617e6b3041e67a9dec791..4c92ac43558a02a9084f5f46d42119796b5540c0 100644 (file)
@@ -68,6 +68,7 @@
 #define PidTagAccessLevel                                                    PROP_TAG(PT_LONG      , 0x0FF7)  /* 0x0FF70003 */
 #define PidTagAccessLevel_Error                                              PROP_TAG(PT_ERROR     , 0x0FF7)  /* 0x0FF7000A */
 #define PidTagAccess_Error                                                   PROP_TAG(PT_ERROR     , 0x0FF4)  /* 0x0FF4000A */
+#define PidTagAccessControlListData                                    PROP_TAG(PT_BINARY     , 0x3FE0)
 #define PidTagAccount                                                        PROP_TAG(PT_UNICODE   , 0x3A00)  /* 0x3A00001F */
 #define PidTagAccount_Error                                                  PROP_TAG(PT_ERROR     , 0x3A00)  /* 0x3A00000A */
 #define PidTagAdditionalRenEntryIds                                          PROP_TAG(PT_MV_BINARY , 0x36D8)  /* 0x36D81102 */
 #define PidTagAddressBookHierarchicalRootDepartment_Error                    PROP_TAG(PT_ERROR     , 0x8C98)  /* 0x8C98000A */
 #define PidTagAddressBookHierarchicalShowInDepartments                       PROP_TAG(PT_OBJECT    , 0x8C94)  /* 0x8C94000D */
 #define PidTagAddressBookHierarchicalShowInDepartments_Error                 PROP_TAG(PT_ERROR     , 0x8C94)  /* 0x8C94000A */
-#define PidTagAddressBookHomeMessageDatabase                                 PROP_TAG(PT_STRING8   , 0x8006)  /* 0x8006001E */
+#define PidTagAddressBookHomeMessageDatabase                                 PROP_TAG(PT_UNICODE   , 0x8006)  /* 0x8006001E */
 #define PidTagAddressBookHomeMessageDatabase_Error                           PROP_TAG(PT_ERROR     , 0x8006)  /* 0x8006000A */
 #define PidTagAddressBookIsMaster                                            PROP_TAG(PT_BOOLEAN   , 0xFFFB)  /* 0xFFFB000B */
 #define PidTagAddressBookIsMaster_Error                                      PROP_TAG(PT_ERROR     , 0xFFFB)  /* 0xFFFB000A */
 #define PidTagAddressBookModerationEnabled                                   PROP_TAG(PT_BOOLEAN   , 0x8CB5)  /* 0x8CB5000B */
 #define PidTagAddressBookModerationEnabled_Error                             PROP_TAG(PT_ERROR     , 0x8CB5)  /* 0x8CB5000A */
 #define PidTagAddressBookNetworkAddress                                      PROP_TAG(PT_MV_UNICODE, 0x8170)  /* 0x8170101F */
+#define PidTagAddressBookNetworkAddress_string8                              PROP_TAG(PT_MV_STRING8, 0x8170)  /* 0x8170101E */
 #define PidTagAddressBookNetworkAddress_Error                                PROP_TAG(PT_ERROR     , 0x8170)  /* 0x8170000A */
 #define PidTagAddressBookObjectDistinguishedName                             PROP_TAG(PT_UNICODE   , 0x803C)  /* 0x803C001F */
 #define PidTagAddressBookObjectDistinguishedName_Error                       PROP_TAG(PT_ERROR     , 0x803C)  /* 0x803C000A */
 #define PidTagAddressBookPhoneticSurname                                     PROP_TAG(PT_UNICODE   , 0x8C8F)  /* 0x8C8F001F */
 #define PidTagAddressBookPhoneticSurname_Error                               PROP_TAG(PT_ERROR     , 0x8C8F)  /* 0x8C8F000A */
 #define PidTagAddressBookProxyAddresses                                      PROP_TAG(PT_MV_UNICODE, 0x800F)  /* 0x800F101F */
+#define PidTagAddressBookProxyAddresses_string8                              PROP_TAG(PT_MV_STRING8, 0x800F)  /* 0x800F101E */
 #define PidTagAddressBookProxyAddresses_Error                                PROP_TAG(PT_ERROR     , 0x800F)  /* 0x800F000A */
 #define PidTagAddressBookPublicDelegates                                     PROP_TAG(PT_OBJECT    , 0x8015)  /* 0x8015000D */
 #define PidTagAddressBookPublicDelegates_Error                               PROP_TAG(PT_ERROR     , 0x8015)  /* 0x8015000A */
index aaca80dcdbbd2516b1b6630d28cfc3df7fa75b2d..070bd87a3ecdbc5b6ac27ae4b89130c8c9db982d 100644 (file)
@@ -339,34 +339,45 @@ enum mapistore_error mapistore_backend_create_context(TALLOC_CTX *mem_ctx, struc
        int                             i;
 
        DEBUG(0, ("namespace is %s and backend_uri is '%s'\n", namespace, uri));
+
+       context = talloc_zero(NULL, struct backend_context);
+
        for (i = 0; i < num_backends; i++) {
                if (backends[i].backend->backend.namespace && 
                    !strcmp(namespace, backends[i].backend->backend.namespace)) {
                        found = true;
-                       retval = backends[i].backend->backend.create_context(NULL, conn_info, tdbwrap, uri, &backend_object);
+                       retval = backends[i].backend->backend.create_context(context, conn_info, tdbwrap, uri, &backend_object);
                        if (retval != MAPISTORE_SUCCESS) {
-                               return retval;
+                               goto end;
                        }
 
                        break;
                }
        }
+
        if (found == false) {
                DEBUG(0, ("MAPISTORE: no backend with namespace '%s' is available\n", namespace));
-               return MAPISTORE_ERR_NOT_FOUND;
+               retval = MAPISTORE_ERR_NOT_FOUND; 
+               goto end;
        }
 
-       context = talloc_zero(mem_ctx, struct backend_context);
-       context->backend = backends[i].backend;
        context->backend_object = backend_object;
-       talloc_reference(context, backend_object);
-       context->backend->context.get_root_folder(backend_object, context, fid, &context->root_folder_object);
-       talloc_unlink(NULL, backend_object);
+       context->backend = backends[i].backend;
+       retval = context->backend->context.get_root_folder(backend_object, context, fid, &context->root_folder_object);
+       if (retval != MAPISTORE_SUCCESS) {
+               goto end;
+       }
+
        context->ref_count = 1;
        context->uri = talloc_asprintf(context, "%s%s", namespace, uri);
        *context_p = context;
 
-       return MAPISTORE_SUCCESS;
+       (void) talloc_reference(mem_ctx, context);
+
+end:
+       talloc_unlink(NULL, context);
+
+       return retval;
 }
 
 
index 9cfdaa2ef292439fb29dc67bb24e68b9505ec60b..a0661f9c533101a0d0e86d1305de6f0124dfd20f 100644 (file)
@@ -676,7 +676,7 @@ static int emsmdbp_object_destructor(void *data)
                DEBUG(4, ("[%s:%d] mapistore folder context retval = %d\n", __FUNCTION__, __LINE__, ret));
                break;
        case EMSMDBP_OBJECT_TABLE:
-               if (emsmdbp_is_mapistore(object) && object->object.table->handle > 0) {
+               if (emsmdbp_is_mapistore(object) && object->backend_object && object->object.table->handle > 0) {
                        mapistore_table_handle_destructor(object->emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object), object->backend_object, object->object.table->handle);
                }
                 if (object->object.table->subscription_list) {
@@ -1242,7 +1242,7 @@ end:
 
        return ret;
 }
+
 _PUBLIC_ struct emsmdbp_object *emsmdbp_folder_open_table(TALLOC_CTX *mem_ctx, 
                                                          struct emsmdbp_object *parent_object, 
                                                          uint32_t table_type, uint32_t handle_id)
@@ -2619,9 +2619,9 @@ static int emsmdbp_object_get_properties_mapistore_root(TALLOC_CTX *mem_ctx, str
        uint32_t                        contextID;
         uint32_t                        *obj_count;
        uint8_t                         *has_subobj;
-       time_t                          unix_time;
-       NTTIME                          nt_time;
-       struct FILETIME                 *ft;
+       /* time_t                               unix_time; */
+       /* NTTIME                               nt_time; */
+       /* struct FILETIME                      *ft; */
 
        contextID = emsmdbp_get_contextID(object);
 
@@ -2679,17 +2679,7 @@ static int emsmdbp_object_get_properties_mapistore_root(TALLOC_CTX *mem_ctx, str
                        data_pointers[i] = obj_count;
                        retval = MAPI_E_SUCCESS;
                }
-               else if (properties->aulPropTag[i] == PidTagLocalCommitTimeMax) {
-                       /* TODO: temporary hack */
-                       unix_time = time(NULL) & 0xffffff00;
-                       unix_to_nt_time(&nt_time, unix_time);
-                       ft = talloc_zero(data_pointers, struct FILETIME);
-                       ft->dwLowDateTime = (nt_time & 0xffffffff);
-                       ft->dwHighDateTime = nt_time >> 32;
-                       data_pointers[i] = ft;
-                       retval = MAPI_E_SUCCESS;
-               }
-               else if (properties->aulPropTag[i] == PR_ACCESS || properties->aulPropTag[i] == PR_ACCESS_LEVEL) {
+               else if (properties->aulPropTag[i] == PidTagLocalCommitTimeMax || properties->aulPropTag[i] == PR_ACCESS || properties->aulPropTag[i] == PR_ACCESS_LEVEL) {
                        struct mapistore_property_data prop_data;
 
                        mapistore_properties_get_properties(emsmdbp_ctx->mstore_ctx, contextID,
index 5ef761d47e6e503de94d04f9d727376c37bf1158..4451b10f49cdaab7a8b3149d14b4a066ad38793c 100644 (file)
@@ -1106,10 +1106,10 @@ static void oxcfxics_push_folderChange(TALLOC_CTX *mem_ctx, struct emsmdbp_conte
                        oxcfxics_ndr_push_properties(sync_data->ndr, sync_data->cutmarks_ndr, emsmdbp_ctx->mstore_ctx->nprops_ctx, &query_props, header_data_pointers, (enum MAPISTATUS *) header_retvals);
 
                        /** remaining props */
-                       if (table_object->object.table->prop_count > 5) {
-                               query_props.cValues = table_object->object.table->prop_count - 5;
-                               query_props.aulPropTag = table_object->object.table->properties + 5;
-                               oxcfxics_ndr_push_properties(sync_data->ndr, sync_data->cutmarks_ndr, emsmdbp_ctx->mstore_ctx->nprops_ctx, &query_props, data_pointers + 5, (enum MAPISTATUS *) retvals + 5);
+                       if (table_object->object.table->prop_count > 7) {
+                               query_props.cValues = table_object->object.table->prop_count - 7;
+                               query_props.aulPropTag = table_object->object.table->properties + 7;
+                               oxcfxics_ndr_push_properties(sync_data->ndr, sync_data->cutmarks_ndr, emsmdbp_ctx->mstore_ctx->nprops_ctx, &query_props, data_pointers + 7, (enum MAPISTATUS *) retvals + 7);
                        }
 
                end_row:
index 7ffdefc55d4b2d5585148e5c058410c0f7b4ca71..e3ccf71d1a088ac375de4f93fce4fb4431e6e11e 100644 (file)
@@ -192,11 +192,7 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopOpenMessage(TALLOC_CTX *mem_ctx,
        void                            *data;
        uint64_t                        folderID;
        uint64_t                        messageID = 0;
-       /* uint32_t                     contextID; */
-       uint32_t                        handle;
        struct oxcmsg_prop_index        prop_index;
-       /* bool                         mapistore = false; */
-       /* struct indexing_folders_list *flist; */
        int                             i;
 
        DEBUG(4, ("exchange_emsmdb: [OXCMSG] OpenMessage (0x03)\n"));
@@ -238,7 +234,6 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopOpenMessage(TALLOC_CTX *mem_ctx,
        folderID = request->FolderId;
 
        /* Initialize Message object */
-       handle = handles[mapi_req->handle_idx];
        retval = mapi_handles_add(emsmdbp_ctx->handles_ctx, handle, &object_handle);
 
        if (request->OpenModeFlags == ReadOnly) {
@@ -415,7 +410,6 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopCreateMessage(TALLOC_CTX *mem_ctx,
        /* Initialize Message object */
        handle = handles[mapi_req->handle_idx];
        retval = mapi_handles_add(emsmdbp_ctx->handles_ctx, handle, &message_handle);
-       handles[mapi_repl->handle_idx] = message_handle->handle;
 
        message_object = emsmdbp_object_message_init((TALLOC_CTX *)message_handle, emsmdbp_ctx, messageID, folder_object);
        message_object->object.message->read_write = true;
@@ -449,6 +443,8 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopCreateMessage(TALLOC_CTX *mem_ctx,
                break;
        }
 
+       handles[mapi_repl->handle_idx] = message_handle->handle;
+
        /* Add default properties to message MS-OXCMSG 3.2.5.2 */
        retval = mapi_handles_set_private_data(message_handle, message_object);
 
index 9dcc7f0ef271ac13876ab79a48d1e322b27a7dff..12c66aba52dd10c16e6d55afb7276a97a2559afd 100644 (file)
 #include "mapiproxy/libmapiserver/libmapiserver.h"
 #include "dcesrv_exchange_emsmdb.h"
 
-static void oxomsg_mapistore_handle_target_entryid(struct emsmdbp_context *emsmdbp_ctx, struct emsmdbp_object *old_message_object)
+static void oxomsg_mapistore_handle_message_relocation(struct emsmdbp_context *emsmdbp_ctx, struct emsmdbp_object *old_message_object)
 {
        TALLOC_CTX                      *mem_ctx;
-       enum MAPITAGS                   property = PidTagTargetEntryId;
-       struct mapistore_property_data  property_data;
+       enum MAPITAGS                   properties[] = { PidTagTargetEntryId, PidTagSentMailSvrEID };
+       uint32_t                        properties_count = sizeof(properties) / sizeof(enum MAPITAGS);
+       struct mapistore_property_data  *property_data;
        enum MAPITAGS                   ex_properties[] = { PidTagTargetEntryId, PidTagChangeKey, PidTagPredecessorChangeList };
        struct SPropTagArray            excluded_tags = { sizeof(ex_properties) / sizeof(enum MAPITAGS), ex_properties };
        struct Binary_r                 *bin_data;
        struct MessageEntryId           *entryID;
+       struct PtypServerId             *folderSvrID;
        uint32_t                        contextID;
        uint64_t                        folderID;
        uint64_t                        messageID;
        uint16_t                        replID;
-       int                             ret;
+       int                             ret, i;
        char                            *owner;
        struct emsmdbp_object           *folder_object;
        struct emsmdbp_object           *message_object;
 
        mem_ctx = talloc_zero(NULL, TALLOC_CTX);
 
+       property_data = talloc_array(mem_ctx, struct mapistore_property_data, properties_count);
+
        contextID = emsmdbp_get_contextID(old_message_object);
 
-       mapistore_properties_get_properties(emsmdbp_ctx->mstore_ctx, contextID, old_message_object->backend_object, mem_ctx, 1, &property, &property_data);
-       if (property_data.error) {
-               return;
-       }
+       mapistore_properties_get_properties(emsmdbp_ctx->mstore_ctx, contextID, old_message_object->backend_object, mem_ctx, properties_count, properties, property_data);
+       for (i = 0; i < properties_count; i++) { 
+               if (property_data[i].error) {
+                       continue;
+               }
 
-       /* DEBUG(5, (__location__": old message fid: %.16"PRIx64"\n", old_message_object->parent_object->object.folder->folderID)); */
-       /* DEBUG(5, (__location__": old message mid: %.16"PRIx64"\n", old_message_object->object.message->messageID)); */
+               /* DEBUG(5, (__location__": old message fid: %.16"PRIx64"\n", old_message_object->parent_object->object.folder->folderID)); */
+               /* DEBUG(5, (__location__": old message mid: %.16"PRIx64"\n", old_message_object->object.message->messageID)); */
 
-       owner = emsmdbp_get_owner(old_message_object);
-       bin_data = property_data.data;
-       entryID = get_MessageEntryId(mem_ctx, bin_data);
-       if (!entryID) {
-               DEBUG(5, (__location__": invalid entryID\n"));
-               return;
-       }
+               owner = emsmdbp_get_owner(old_message_object);
+               bin_data = property_data[i].data;
 
-       ret = emsmdbp_guid_to_replid(emsmdbp_ctx, owner, &entryID->FolderDatabaseGuid, &replID);
-       if (ret) {
-               DEBUG(5, (__location__": unable to deduce folder replID\n"));
-               return;
-       }
-       folderID = (entryID->FolderGlobalCounter.value << 16) | replID;
-       /* DEBUG(5, (__location__": dest folder id: %.16"PRIx64"\n", folderID)); */
+               switch (properties[i]) {
+               case PidTagTargetEntryId:
+                       entryID = get_MessageEntryId(mem_ctx, bin_data);
+                       if (!entryID) {
+                               DEBUG(5, (__location__": invalid entryID\n"));
+                               continue;
+                       }
 
-       ret = emsmdbp_guid_to_replid(emsmdbp_ctx, owner, &entryID->MessageDatabaseGuid, &replID);
-       if (ret) {
-               DEBUG(5, (__location__": unable to deduce message replID\n"));
-       }
-       messageID = (entryID->MessageGlobalCounter.value << 16) | replID;
-       /* DEBUG(5, (__location__": dest message id: %.16"PRIx64"\n", messageID)); */
+                       ret = emsmdbp_guid_to_replid(emsmdbp_ctx, owner, &entryID->FolderDatabaseGuid, &replID);
+                       if (ret) {
+                               DEBUG(5, (__location__": unable to deduce folder replID\n"));
+                               continue;
+                       }
+                       folderID = (entryID->FolderGlobalCounter.value << 16) | replID;
+                       /* DEBUG(5, (__location__": dest folder id: %.16"PRIx64"\n", folderID)); */
 
-       if (emsmdbp_object_open_folder_by_fid(mem_ctx, emsmdbp_ctx, old_message_object, folderID, &folder_object) != MAPISTORE_SUCCESS) {
-               DEBUG(5, (__location__": unable to open folder\n"));
-               return;
-       }
+                       ret = emsmdbp_guid_to_replid(emsmdbp_ctx, owner, &entryID->MessageDatabaseGuid, &replID);
+                       if (ret) {
+                               DEBUG(5, (__location__": unable to deduce message replID\n"));
+                               continue;
+                       }
+                       messageID = (entryID->MessageGlobalCounter.value << 16) | replID;
+                       /* DEBUG(5, (__location__": dest message id: %.16"PRIx64"\n", messageID)); */
+                       break;
+               case PidTagSentMailSvrEID:
+                       folderSvrID = get_PtypServerId(mem_ctx, bin_data);
+                       if (!folderSvrID) {
+                               DEBUG(5, (__location__": invalid folderSvrID\n"));
+                               continue;
+                       }
 
-       message_object = emsmdbp_object_message_init(mem_ctx, emsmdbp_ctx, messageID, folder_object);
-       if (mapistore_folder_create_message(emsmdbp_ctx->mstore_ctx, contextID, folder_object->backend_object, message_object, messageID, false, &message_object->backend_object)) {
-               DEBUG(5, (__location__": unable to create message in backend\n"));
-               return;
-       }
+                       folderID = folderSvrID->FolderId;
+                       openchangedb_get_new_folderID(emsmdbp_ctx->oc_ctx, &messageID);
+
+                       /* DEBUG(5, (__location__": dest folder id: %.16"PRIx64"\n", folderID)); */
+                       break;
+               default:
+                       DEBUG(5, (__location__": invalid entryid property: %.8x\n", properties[i]));
+                       continue;
+               }
+
+               if (emsmdbp_object_open_folder_by_fid(mem_ctx, emsmdbp_ctx, old_message_object, folderID, &folder_object) != MAPISTORE_SUCCESS) {
+                       DEBUG(5, (__location__": unable to open folder\n"));
+                       continue;
+               }
+
+               message_object = emsmdbp_object_message_init(mem_ctx, emsmdbp_ctx, messageID, folder_object);
+               if (mapistore_folder_create_message(emsmdbp_ctx->mstore_ctx, contextID, folder_object->backend_object, message_object, messageID, false, &message_object->backend_object)) {
+                       DEBUG(5, (__location__": unable to create message in backend\n"));
+                       continue;
+               }
 
-       /* FIXME: (from oxomsg 3.2.5.1) PidTagMessageFlags: mfUnsent and mfRead must be cleared */
-       emsmdbp_object_copy_properties(emsmdbp_ctx, old_message_object, message_object, &excluded_tags, true);
+               /* FIXME: (from oxomsg 3.2.5.1) PidTagMessageFlags: mfUnsent and mfRead must be cleared */
+               emsmdbp_object_copy_properties(emsmdbp_ctx, old_message_object, message_object, &excluded_tags, true);
 
-       mapistore_message_save(emsmdbp_ctx->mstore_ctx, contextID, message_object->backend_object);
-       mapistore_indexing_record_add_mid(emsmdbp_ctx->mstore_ctx, contextID, owner, messageID);
+               mapistore_message_save(emsmdbp_ctx->mstore_ctx, contextID, message_object->backend_object);
+               mapistore_indexing_record_add_mid(emsmdbp_ctx->mstore_ctx, contextID, owner, messageID);
+       }
 
        talloc_free(mem_ctx);
 }
@@ -194,7 +221,7 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopSubmitMessage(TALLOC_CTX *mem_ctx,
                flags = mapi_req->u.mapi_SubmitMessage.SubmitFlags;
                owner = emsmdbp_get_owner(object);
                mapistore_message_submit(emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object), object->backend_object, flags);
-               oxomsg_mapistore_handle_target_entryid(emsmdbp_ctx, object);
+               oxomsg_mapistore_handle_message_relocation(emsmdbp_ctx, object);
                mapistore_indexing_record_add_mid(emsmdbp_ctx->mstore_ctx, contextID, owner, messageID);
                break;
        }
@@ -419,7 +446,7 @@ _PUBLIC_ enum MAPISTATUS EcDoRpc_RopTransportSend(TALLOC_CTX *mem_ctx,
        case true:
                mapistore_message_submit(emsmdbp_ctx->mstore_ctx, emsmdbp_get_contextID(object), object->backend_object, 0);
 
-               oxomsg_mapistore_handle_target_entryid(emsmdbp_ctx, object);
+               oxomsg_mapistore_handle_message_relocation(emsmdbp_ctx, object);
                /* mapistore_indexing_record_add_mid(emsmdbp_ctx->mstore_ctx, contextID, messageID); */
                break;
        }
index e5cd324087811470f6e0c1c5c165e1ce82efa606..4aee53ff1ba5993cc166289747bf19d592c7a6e5 100644 (file)
@@ -481,6 +481,10 @@ _PUBLIC_ void *emsabp_query(TALLOC_CTX *mem_ctx, struct emsabp_context *emsabp_c
                data = talloc_zero(mem_ctx, uint32_t);
                *((uint32_t *)data) = 0x00160000;
                return data;
+       case PidTagAddressBookHierarchicalIsHierarchicalGroup:
+               data = talloc_zero(mem_ctx, uint32_t);
+               *((uint32_t *)data) = 0;
+               return data;
        case PR_ENTRYID:
        case PR_ORIGINAL_ENTRYID:
                bin = talloc(mem_ctx, struct Binary_r);
index 85e200912f3bf7ae91540f03687e57b312641593..29d4995f273727d930f0b4a4df6abc8b825ff099 100644 (file)
@@ -40,18 +40,25 @@ static const struct emsabp_property emsabp_property[] = {
        { PidTagAccount,                        "sAMAccountName",       false,  NULL                    },
        { PR_GIVEN_NAME,                        "givenName",            false,  NULL                    },
        { PR_SURNAME,                           "sn",                   false,  NULL                    },
+       { PR_SURNAME_UNICODE,                           "sn",                   false,  NULL                    },
        { PR_TRANSMITTABLE_DISPLAY_NAME,        "displayName",          false,  NULL                    },
+       { PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,        "displayName",          false,  NULL                    },
        { PR_7BIT_DISPLAY_NAME,                 "displayName",          false,  NULL                    },
+       { PR_7BIT_DISPLAY_NAME_UNICODE,         "displayName",          false,  NULL                    },
        { PR_EMS_AB_HOME_MTA,                   "homeMTA",              true,   "legacyExchangeDN"      },
        { PR_EMS_AB_ASSOC_NT_ACCOUNT,           "assocNTAccount",       false,  NULL                    },
        { PidTagCompanyName,                    "company",              false,  NULL                    },
+       { PidTagCompanyName_string8,                    "company",              false,  NULL                    },
        { PidTagDisplayName,                    "displayName",          false,  NULL                    },
        { PidTagDisplayName_string8,            "displayName",          false,  NULL                    },
        { PidTagEmailAddress,                   "legacyExchangeDN",     false,  NULL                    },
        { PidTagEmailAddress_string8,           "legacyExchangeDN",     false,  NULL                    },
        { PidTagAddressBookHomeMessageDatabase, "homeMDB",              true,   "legacyExchangeDN"      },
+       { PidTagAddressBookHomeMessageDatabase_string8, "homeMDB",              true,   "legacyExchangeDN"      },
        { PidTagAddressBookProxyAddresses,      "proxyAddresses",       false,  NULL                    },
+       { PidTagAddressBookProxyAddresses_string8,      "proxyAddresses",       false,  NULL                    },
        { PidTagAddressBookNetworkAddress,      "networkAddress",       false,  NULL                    },
+       { PidTagAddressBookNetworkAddress_string8,      "networkAddress",       false,  NULL                    },
        { PidTagTitle,                          "personalTitle",        false,  NULL                    },
        { PR_EMS_AB_OBJECT_GUID,                "objectGUID",           false,  NULL                    },
        { 0,                                    NULL,                   false,  NULL                    }
index 025edbc7365f2543c6521c44630fb2a88a7e0d8d..22dcd09ad0eb7f427c45180e92d4f7c41f95e8a0 100644 (file)
@@ -8,6 +8,8 @@ typedef [v1_enum, flag(NDR_PAHEX)] enum {
        PidTagAccessLevel_Error                                              = 0x0FF7000A,
        PidTagAccess_Error                                                   = 0x0FF4000A,
        PidTagAccount                                                        = 0x3A00001F,
+       PidTagAccessControlListData                                          = 0x3FE00102,
+       PidTagAccessControlListData_Error                                    = 0x3FE0000A,
        PidTagAccount_Error                                                  = 0x3A00000A,
        PidTagAccount_string8                                                = 0x3A00001E,
        PidTagAdditionalRenEntryIds                                          = 0x36D81102,
@@ -55,7 +57,8 @@ typedef [v1_enum, flag(NDR_PAHEX)] enum {
        PidTagAddressBookHierarchicalRootDepartment_Error                    = 0x8C98000A,
        PidTagAddressBookHierarchicalShowInDepartments                       = 0x8C94000D,
        PidTagAddressBookHierarchicalShowInDepartments_Error                 = 0x8C94000A,
-       PidTagAddressBookHomeMessageDatabase                                 = 0x8006001E,
+       PidTagAddressBookHomeMessageDatabase                                 = 0x8006001F,
+       PidTagAddressBookHomeMessageDatabase_string8                         = 0x8006001E,
        PidTagAddressBookHomeMessageDatabase_Error                           = 0x8006000A,
        PidTagAddressBookIsMaster                                            = 0xFFFB000B,
        PidTagAddressBookIsMaster_Error                                      = 0xFFFB000A,
@@ -73,6 +76,7 @@ typedef [v1_enum, flag(NDR_PAHEX)] enum {
        PidTagAddressBookModerationEnabled                                   = 0x8CB5000B,
        PidTagAddressBookModerationEnabled_Error                             = 0x8CB5000A,
        PidTagAddressBookNetworkAddress                                      = 0x8170101F,
+       PidTagAddressBookNetworkAddress_string8                              = 0x8170101E,
        PidTagAddressBookNetworkAddress_Error                                = 0x8170000A,
        PidTagAddressBookObjectDistinguishedName                             = 0x803C001F,
        PidTagAddressBookObjectDistinguishedName_Error                       = 0x803C000A,
@@ -104,6 +108,7 @@ typedef [v1_enum, flag(NDR_PAHEX)] enum {
        PidTagAddressBookPhoneticSurname_Error                               = 0x8C8F000A,
        PidTagAddressBookPhoneticSurname_string8                             = 0x8C8F001E,
        PidTagAddressBookProxyAddresses                                      = 0x800F101F,
+       PidTagAddressBookProxyAddresses_string8                              = 0x800F101E,
        PidTagAddressBookProxyAddresses_Error                                = 0x800F000A,
        PidTagAddressBookPublicDelegates                                     = 0x8015000D,
        PidTagAddressBookPublicDelegates_Error                               = 0x8015000A,
index 91a5e5617130b8cb523f5b7557b0bf2b9abac1ca..684c319e6c22b5f117cdc5e26104277d80d6c8ea 100644 (file)
@@ -9,13 +9,27 @@ import "exchange.idl";
 ]
 interface property
 {
+       typedef [v1_enum] enum {
+               seOpenToDelete          = 0x00000001,
+               seNoFrame               = 0x00000008,
+               seCoerceToInbox         = 0x00000010,
+               seOpenToCopy            = 0x00000020,
+               seOpenToMove            = 0x00000040,
+               seOpenForCtxMenu        = 0x00000100,
+               seCannotUndoDelete      = 0x00000400,
+               seCannotUndoCopy        = 0x00000800,
+               seCannotUndoMove        = 0x00001000,
+               seHasScript             = 0x00002000,
+               seOpenToPermDelete      = 0x00004000
+       } SideEffects;
+
        typedef [enum16bit] enum {
                RecurFrequency_Daily    = 0x200A,
                RecurFrequency_Weekly   = 0x200B,
                RecurFrequency_Monthly  = 0x200C,
                RecurFrequency_Yearly   = 0x200D
        } RecurFrequency;
-       
+
        typedef [enum16bit] enum {
                PatternType_Day         = 0x0,
                PatternType_Week        = 0x1,
@@ -278,6 +292,14 @@ interface property
                eitLTPPublicNewsgroupFolder     = 0x0c
        } EntryIdFolderType;
 
+       /* PtypServerId */
+       typedef [public,flag(NDR_NOALIGN)] struct {
+               uint8                   ours;
+               dlong                   FolderId;
+               dlong                   MessageId;
+               int32                   Instance;
+       } PtypServerId;
+
        /* FolderEntryId */
        typedef [public,flag(NDR_NOALIGN)] struct {
                uint32                  Flags;
index d0c2fce5d63cc5940eda3f466b368ff74aca4f16..8a20977100d1d4761ed86a78d0806d58d5782297 100755 (executable)
@@ -213,9 +213,11 @@ knownareas = [
         "Address Properties",
         "Address Properties Property set",
         "Appointment Property set",
+        "Appointment",
         "Archive",
         "BestBody",
         "Calendar",
+        "Calendar Document",
         "Calendar Document Property set",
         "Calendar Property set",
         "Common",
@@ -229,6 +231,7 @@ knownareas = [
         "Conversation Actions",
         "Conversations",
         "Email",
+        "E-mail",
         "Email Property set",
         "Exchange",
         "Exchange Administrative",
@@ -304,6 +307,7 @@ knownareas = [
         "SMS",
         "Spam",
         "Sticky Notes",
+        "Structured Documents",
         "Structured Documents Property set",
         "Sync",
         "Table Properties",