---------- Forwarded Message ----------
Subject: GetPropList + GetProps != GetPropsAll
Date: Thursday 18 March 2010, 02:25:27 am
From: Milan Crha <[email protected]>
To: [email protected]
Hi,
while working on another approach for [1], I realized that replacing
GetPropsAll call with GetPropList and GetProps call doesn't work for
distribution lists in a user's address book. I have one distribution
list filled on my Exchange 2007 server, and also couple ordinary
contacts. The contacts are all fine with code [2], but when it starts to
fetch items from the distribution list, then libmapi crashes deep in
GetProps call, thus I guess nothing I would be able to influence from
outside, also because I only play with a list of tags, thus integers.
Could you look at it and tell me whether I'm really right with the
consumption that GetPropList + GetProps is equal to GetPropsAll?
The code [2] below does only one thing to the array of tags returned
from GetPropList, it changes all PT_STRING8 properties to PT_UNICODE.
I also tried to not modify the array at all, because I know the
distribution list has about 145 properties, so I skipped the changing
for this amount of items, but it crashed anyway.
I'm using revision 1730 of OpenChange svn.
Thanks and bye,
Milan
P.S.: I would like to add this to your tracker, but I cannot create an
account there, and I do not have any yet.
[1] https://bugzilla.gnome.org/show_bug.cgi?id=600389
[2] see below
//-------------------------------------------------------------------
static enum MAPISTATUS
ema_GetPropsAll (TALLOC_CTX *mem_ctx, mapi_object_t *mapi_obj, struct
mapi_SPropValue_array *properties)
{
enum MAPISTATUS retval;
struct SPropTagArray *sPropTagArray;
struct SPropValue *lpProps;
uint32_t i, prop_count;
if (!mem_ctx || !mapi_obj || !properties) {
return MAPI_E_INVALID_PARAMETER;
}
sPropTagArray = talloc_zero (mem_ctx, struct SPropTagArray);
retval = GetPropList (mapi_obj, sPropTagArray);
if (retval != MAPI_E_SUCCESS) {
MAPIFreeBuffer (sPropTagArray);
return retval;
}
/* request unicode strings instead of non-unicode */
for (i = 0; i < sPropTagArray->cValues; i++) {
if ((sPropTagArray->aulPropTag[i] & 0xFFFF) == PT_STRING8) {
sPropTagArray->aulPropTag[i] =
(sPropTagArray->aulPropTag[i] &
~0xFFFF) | PT_UNICODE;
}
}
prop_count = 0;
lpProps = talloc_zero (mem_ctx, struct SPropValue);
retval = GetProps (mapi_obj, sPropTagArray, &lpProps, &prop_count);
if (retval != MAPI_E_SUCCESS) {
MAPIFreeBuffer (sPropTagArray);
MAPIFreeBuffer (lpProps);
return retval;
}
/* Conversion from SPropValue to mapi_SPropValue. (no padding here) */
properties->cValues = prop_count;
properties->lpProps = talloc_zero_array (mem_ctx, struct
mapi_SPropValue, prop_count + 1);
for (i = 0; i < prop_count; i++)
cast_mapi_SPropValue (&properties->lpProps[i], &lpProps[i]);
/* do not free lpProps, because string values are just assigned into
properties array, not copied */
MAPIFreeBuffer (sPropTagArray);
return retval;
}
//-------------------------------------------------------------------
-----------------------------------------
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel