OpenChange: Avoid crashing when creating embedded message in attachment
Signed-off-by: Kamen Mazdrashki <kamenim@samba.org> (cherry picked from commit 15a55f9f707247c9164e8fa7a102639744f686e5)
This commit is contained in:
parent
6bef678114
commit
f8028b5a94
|
@ -61,6 +61,17 @@ sogo_backend_unexpected_error()
|
||||||
return MAPISTORE_SUCCESS;
|
return MAPISTORE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum mapistore_error
|
||||||
|
sogo_backend_handle_objc_exception(NSException *e, const char *fn_name, const int line_no)
|
||||||
|
{
|
||||||
|
DEBUG(0,("[SOGo: %s:%d] - EXCEPTION: %s, reason: %s\n", fn_name, line_no, [[e name] UTF8String], [[e reason] UTF8String]));
|
||||||
|
if ([[e name] isEqual:@"NotImplementedException"])
|
||||||
|
{
|
||||||
|
return MAPISTORE_ERR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
return MAPISTORE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sogo_backend_atexit (void)
|
sogo_backend_atexit (void)
|
||||||
{
|
{
|
||||||
|
@ -73,6 +84,7 @@ sogo_backend_atexit (void)
|
||||||
GSUnregisterCurrentThread ();
|
GSUnregisterCurrentThread ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\details Initialize sogo mapistore backend
|
\details Initialize sogo mapistore backend
|
||||||
|
|
||||||
|
@ -1139,11 +1151,18 @@ sogo_message_attachment_create_embedded_message (void *attachment_object,
|
||||||
attachment = wrapper->instance;
|
attachment = wrapper->instance;
|
||||||
GSRegisterCurrentThread ();
|
GSRegisterCurrentThread ();
|
||||||
pool = [NSAutoreleasePool new];
|
pool = [NSAutoreleasePool new];
|
||||||
rc = [attachment createEmbeddedMessage: &message
|
@try
|
||||||
withMAPIStoreMsg: msg
|
{
|
||||||
inMemCtx: mem_ctx];
|
rc = [attachment createEmbeddedMessage: &message
|
||||||
if (rc == MAPISTORE_SUCCESS)
|
withMAPIStoreMsg: msg
|
||||||
*message_object = [message tallocWrapper: mem_ctx];
|
inMemCtx: mem_ctx];
|
||||||
|
if (rc == MAPISTORE_SUCCESS)
|
||||||
|
*message_object = [message tallocWrapper: mem_ctx];
|
||||||
|
}
|
||||||
|
@catch (NSException *e)
|
||||||
|
{
|
||||||
|
rc = sogo_backend_handle_objc_exception(e, __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
[pool release];
|
[pool release];
|
||||||
GSUnregisterCurrentThread ();
|
GSUnregisterCurrentThread ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue