uint32_t count;
int i;
- mem_ctx = talloc_named(NULL, 0, "exchange2ical");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_folder), 0, "exchange2ical");
exchange2ical_init(mem_ctx, &exchange2ical);
/* Open the contents table */
/*sanity check*/
if(icalcomponent_isa(vevent) != ICAL_VEVENT_COMPONENT) return;
- mem_ctx = talloc_named(NULL, 0, "ical2exchange");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_folder), 0, "ical2exchange");
ical2exchange.lpProps = talloc_array(mem_ctx, struct SPropValue, 2);
ical2exchange_init(&ical2exchange, mem_ctx);
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetLocalReplicaIds");
+ mem_ctx = talloc_named(session, 0, "GetLocalReplicaIds");
size = 0;
/* Fill the GetLocalReplicaIds operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXDestConfigure");
+ mem_ctx = talloc_named(session, 0, "FXDestConfigure");
size = 0;
/* Fill the ConfigureDestination operation */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "TellVersion");
+ mem_ctx = talloc_named(session, 0, "TellVersion");
size = 0;
/* Fill the operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXCopyFolder");
+ mem_ctx = talloc_named(session, 0, "FXCopyFolder");
size = 0;
/* Fill the CopyFolder operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXCopyMessages");
+ mem_ctx = talloc_named(session, 0, "FXCopyMessages");
size = 0;
/* Fill the CopyMessages operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXCopyTo");
+ mem_ctx = talloc_named(session, 0, "FXCopyTo");
size = 0;
/* Fill the CopyTo operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXCopyProperties");
+ mem_ctx = talloc_named(session, 0, "FXCopyProperties");
size = 0;
/* Fill the CopyProperties operation */
if ((retval = mapi_object_get_logon_id(obj_source_context, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXGetBuffer");
+ mem_ctx = talloc_named(session, 0, "FXGetBuffer");
size = 0;
/* Fill the GetBuffer operation */
if ((retval = mapi_object_get_logon_id(obj_dest_context, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FXPutBuffer");
+ mem_ctx = talloc_named(session, 0, "FXPutBuffer");
size = 0;
/* Fill the PutBuffer operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "RopSynchronizationConfigure");
+ mem_ctx = talloc_named(session, 0, "RopSynchronizationConfigure");
size = 0;
/* Fill the SyncConfigure operation */
if ((retval = mapi_object_get_logon_id(obj_sync_context, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ICSSyncUploadStateBegin");
+ mem_ctx = talloc_named(session, 0, "ICSSyncUploadStateBegin");
size = 0;
/* Fill the RopSynchronizationUploadStateBegin operation */
if ((retval = mapi_object_get_logon_id(obj_sync_context, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ICSSyncUploadStateContinue");
+ mem_ctx = talloc_named(session, 0, "ICSSyncUploadStateContinue");
size = 0;
/* Fill the RopSynchronizationUploadStateBegin operation */
if ((retval = mapi_object_get_logon_id(obj_sync_context, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ICSSyncUploadStateEnd");
+ mem_ctx = talloc_named(session, 0, "ICSSyncUploadStateEnd");
size = 0;
/* Fill the MAPI_REQ structure */
return retval;
}
- mem_ctx = talloc_named(NULL, 0, __FUNCTION__);
+ mem_ctx = talloc_named(session, 0, __FUNCTION__);
size = 0;
/* Fill the SetLocalReplicaMidsetDeleted operation */
if ((retval = mapi_object_get_logon_id(folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, __FUNCTION__);
+ mem_ctx = talloc_named(session, 0, __FUNCTION__);
size = 0;
/* Fill the SyncOpenCollector operation */
return retval;
}
- mem_ctx = talloc_named(NULL, 0, __FUNCTION__);
+ mem_ctx = talloc_named(session, 0, __FUNCTION__);
/* Fill the SyncGetTransferState operation */
request.handle_idx = 0x01;
OPENCHANGE_RETVAL_IF(!rowset, MAPI_E_INVALID_PARAMETER, NULL);
nspi = (struct nspi_context *)session->nspi->ctx;
- mem_ctx = talloc_named(NULL, 0, "ResolveNames");
+ mem_ctx = talloc_named(session, 0, "ResolveNames");
switch (flags) {
case MAPI_UNICODE:
OPENCHANGE_RETVAL_IF(!SRowSet, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!SPropTagArray, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "GetGALTable");
+ mem_ctx = talloc_named(session, 0, "GetGALTable");
nspi = (struct nspi_context *)session->nspi->ctx;
if (ulFlags == TABLE_START) {
OPENCHANGE_RETVAL_IF(!session->nspi, MAPI_E_SESSION_LIMIT, NULL);
OPENCHANGE_RETVAL_IF(!session->nspi->ctx, MAPI_E_SESSION_LIMIT, NULL);
- mem_ctx = talloc_named(NULL, 0, "GetGALTableCount");
+ mem_ctx = talloc_named(session, 0, "GetGALTableCount");
nspi = (struct nspi_context *) session->nspi->ctx;
nspi->pStat->CurrentRec = 0;
OPENCHANGE_RETVAL_IF(!ppRowSet, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!username, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "GetABRecipientInfo");
+ mem_ctx = talloc_named(session, 0, "GetABRecipientInfo");
nspi_ctx = (struct nspi_context *)session->nspi->ctx;
/* Step 1. Resolve the username */
if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetContentsTable");
+ mem_ctx = talloc_named(session, 0, "GetContentsTable");
size = 0;
/* Fill the GetContentsTable operation */
if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetHierarchyTable");
+ mem_ctx = talloc_named(session, 0, "GetHierarchyTable");
size = 0;
/* Fill the GetHierarchyTable operation */
if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetPermissionsTable");
+ mem_ctx = talloc_named(session, 0, "GetPermissionsTable");
size = 0;
/* Fill the GetPermissionsTable operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetRulesTable");
+ mem_ctx = talloc_named(session, 0, "GetRulesTable");
size = 0;
/* Fill the GetRulesTable operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ModifyPermissions");
+ mem_ctx = talloc_named(session, 0, "ModifyPermissions");
/* Fill the ModifyPermissions operation */
request.rowList = *permsdata;
if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetSearchCriteria");
+ mem_ctx = talloc_named(session, 0, "SetSearchCriteria");
size = 0;
/* Fill the SetSearchCriteria operation */
if ((retval = mapi_object_get_logon_id(obj_container, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetSearchCriteria");
+ mem_ctx = talloc_named(session, 0, "GetSearchCriteria");
size = 0;
/* Fill the GetSearchCriteria operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CreateMessage");
+ mem_ctx = talloc_named(session, 0, "CreateMessage");
size = 0;
/* Fill the OpenFolder operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "DeleteMessages");
+ mem_ctx = talloc_named(session, 0, "DeleteMessages");
size = 0;
/* Fill the DeleteMessages operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "HardDeleteMessages");
+ mem_ctx = talloc_named(session, 0, "HardDeleteMessages");
size = 0;
/* Fill the HardDeleteMessages operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetMessageStatus");
+ mem_ctx = talloc_named(session, 0, "GetMessageStatus");
size = 0;
/* Fill the GetMessageStatus operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetMessageStatus");
+ mem_ctx = talloc_named(session, 0, "SetMessageStatus");
size = 0;
/* Fill the SetMessageStatus operation */
if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "MoveCopyMessages");
+ mem_ctx = talloc_named(session[0], 0, "MoveCopyMessages");
size = 0;
/* Fill the CopyMessage operation */
ulFolderType != FOLDER_SEARCH),
MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "CreateFolder");
+ mem_ctx = talloc_named(session, 0, "CreateFolder");
size = 0;
/* Fill the CreateFolder operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "EmptyFolder");
+ mem_ctx = talloc_named(session, 0, "EmptyFolder");
size = 0;
/* Fill the EmptyFolder operation */
if ((retval = mapi_object_get_logon_id(obj_parent, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "DeleteFolder");
+ mem_ctx = talloc_named(session, 0, "DeleteFolder");
size = 0;
/* Fill the DeleteFolder operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "MoveFolder");
+ mem_ctx = talloc_named(session[0], 0, "MoveFolder");
size = 0;
/* Fill the MoveFolder operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CopyFolder");
+ mem_ctx = talloc_named(session[0], 0, "CopyFolder");
size = 0;
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetReadFlags");
+ mem_ctx = talloc_named(session, 0, "SetReadFlags");
size = 0;
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "HardDeleteMessagesAndSubfolders");
+ mem_ctx = talloc_named(session, 0, "HardDeleteMessagesAndSubfolders");
size = 0;
/* Fill the EmptyFolder operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetProps");
+ mem_ctx = talloc_named(session, 0, "GetProps");
/* Named property mapping */
nameid = mapi_nameid_new(mem_ctx);
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetProps");
+ mem_ctx = talloc_named(session, 0, "SetProps");
size = 0;
/* Named property mapping */
if ((retval = mapi_object_get_logon_id(obj_parent, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SaveChangesAttachment");
+ mem_ctx = talloc_named(session[0], 0, "SaveChangesAttachment");
size = 0;
/* Fill the SaveChangesAttachment operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetPropList");
+ mem_ctx = talloc_named(session, 0, "GetPropList");
/* Reset */
proptags->cValues = 0;
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetPropsAll");
+ mem_ctx = talloc_named(session, 0, "GetPropsAll");
size = 0;
/* Fill the GetPropsAll operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "DeleteProps");
+ mem_ctx = talloc_named(session, 0, "DeleteProps");
size = 0;
/* Fill the DeleteProps operation */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetPropertiesNoReplicate");
+ mem_ctx = talloc_named(session, 0, "SetPropertiesNoReplicate");
size = 0;
/* Named property mapping */
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "DeletePropertiesNoReplicate");
+ mem_ctx = talloc_named(session, 0, "DeletePropertiesNoReplicate");
size = 0;
/* Fill the DeletePropertiesNoReplicate operation */
return retval;
/* Initialization */
- mem_ctx = talloc_named(NULL, 0, "GetNamesFromIDs");
+ mem_ctx = talloc_named(session, 0, "GetNamesFromIDs");
size = 0;
/* Fill the GetNamesFromIDs operation */
return retval;
/* Initialization */
- mem_ctx = talloc_named(NULL, 0, "GetIDsFromNames");
+ mem_ctx = talloc_named(session, 0, "GetIDsFromNames");
size = 0;
/* Fill the GetIDsFromNames operation */
return retval;
/* Initialization */
- mem_ctx = talloc_named(NULL, 0, "QueryNamesFromIDs");
+ mem_ctx = talloc_named(session, 0, "QueryNamesFromIDs");
size = 0;
/* Fill the QueryNamedProperties operation */
if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CopyProps");
+ mem_ctx = talloc_named(session[0], 0, "CopyProps");
size = 0;
/* Fill the CopyProperties operation */
if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CopyProps");
+ mem_ctx = talloc_named(session[0], 0, "CopyProps");
size = 0;
/* Fill the CopyProperties operation */
OPENCHANGE_RETVAL_IF(!session->nspi->ctx, MAPI_E_END_OF_SESSION, NULL);
OPENCHANGE_RETVAL_IF(!legacyDN, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "FindGoodServer");
+ mem_ctx = talloc_named(session, 0, "FindGoodServer");
nspi = (struct nspi_context *) session->nspi->ctx;
if (server == false) {
OPENCHANGE_RETVAL_IF(retval, MAPI_E_FAILONEPROVIDER, NULL);
retry:
- mem_ctx = talloc_named(NULL, 0, "OpenPublicFolder");
+ mem_ctx = talloc_named(session, 0, "OpenPublicFolder");
size = 0;
/* Fill the Logon operation */
OPENCHANGE_RETVAL_IF(retval, MAPI_E_FAILONEPROVIDER, NULL);
retry:
- mem_ctx = talloc_named(NULL, 0, "OpenMsgStore");
+ mem_ctx = talloc_named(session, 0, "OpenMsgStore");
size = 0;
if (!username) {
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "Subscribe");
+ mem_ctx = talloc_named(session, 0, "Subscribe");
/* Fill the Subscribe operation */
request.handle_idx = 0x1;
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetColumns");
+ mem_ctx = talloc_named(session, 0, "SetColumns");
size = 0;
/* Fill the SetColumns operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "QueryPosition");
+ mem_ctx = talloc_named(session, 0, "QueryPosition");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "QueryRows");
+ mem_ctx = talloc_named(session, 0, "QueryRows");
size = 0;
/* Fill the QueryRows operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "QueryColumns");
+ mem_ctx = talloc_named(session, 0, "QueryColumns");
cols->cValues = 0;
size = 0;
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SeekRow");
+ mem_ctx = talloc_named(session, 0, "SeekRow");
*row = 0;
/* Fill the SeekRow operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SeekRowBookmark");
+ mem_ctx = talloc_named(session, 0, "SeekRowBookmark");
/* Fill the SeekRowBookmark operation */
size = 0;
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SeekRowApprox");
+ mem_ctx = talloc_named(session, 0, "SeekRowApprox");
/* Fill the SeekRowApprox operation */
size = 0;
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CreateBookmark");
+ mem_ctx = talloc_named(session, 0, "CreateBookmark");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "FreeBookmark");
+ mem_ctx = talloc_named(session, 0, "FreeBookmark");
while (bookmark) {
if (bookmark->index == bkPosition) {
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SortTable");
+ mem_ctx = talloc_named(session, 0, "SortTable");
/* Fill the SortTable operation */
size = 0;
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "Reset");
+ mem_ctx = talloc_named(session, 0, "Reset");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "Restrict");
+ mem_ctx = talloc_named(session, 0, "Restrict");
/* Fill the Restrict operation */
size = 0;
OPENCHANGE_RETVAL_IF(retval, MAPI_E_INVALID_BOOKMARK, NULL);
}
- mem_ctx = talloc_named(NULL, 0, "FindRow");
+ mem_ctx = talloc_named(session, 0, "FindRow");
/* Fill the FindRow operation */
size = 0;
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetStatus");
+ mem_ctx = talloc_named(session, 0, "GetStatus");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "Abort");
+ mem_ctx = talloc_named(session, 0, "Abort");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ExpandRow");
+ mem_ctx = talloc_named(session, 0, "ExpandRow");
size = 0;
/* Fill the ExpandRow operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CollapseRow");
+ mem_ctx = talloc_named(session, 0, "CollapseRow");
size = 0;
/* Fill the CollapseRow operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetCollapseState");
+ mem_ctx = talloc_named(session, 0, "GetCollapseState");
size = 0;
/* Fill the GetCollapseState operation */
if ((retval = mapi_object_get_logon_id(obj_table, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetCollapseState");
+ mem_ctx = talloc_named(session, 0, "SetCollapseState");
size = 0;
/* Fill the SetCollapseState operation */
return NT_STATUS_INVALID_PARAMETER;
}
- ev = tevent_context_init(talloc_autofree_context());
+ ev = tevent_context_init(parent_ctx);
tevent_loop_allow_nesting(ev);
status = dcerpc_pipe_connect(parent_ctx,
if (!mapi_ctx) return MAPI_E_NOT_INITIALIZED;
if (!mapi_ctx->session) return MAPI_E_NOT_INITIALIZED;
- mem_ctx = talloc_named(NULL, 0, "RfrGetNewDSA");
+ mem_ctx = talloc_named(session, 0, "RfrGetNewDSA");
profile = session->profile;
binding = build_binding_string(mapi_ctx, mem_ctx, server, profile);
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CreateAttach");
+ mem_ctx = talloc_named(session, 0, "CreateAttach");
size = 0;
/* Fill the CreateAttach operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "DeleteAttach");
+ mem_ctx = talloc_named(session, 0, "DeleteAttach");
size = 0;
/* Fill the DeleteAttach operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetAttachmentTable");
+ mem_ctx = talloc_named(session, 0, "GetAttachmentTable");
size = 0;
/* Fill the GetAttachmentTable operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetValidAttach");
+ mem_ctx = talloc_named(session, 0, "GetValidAttach");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "OpenAttach");
+ mem_ctx = talloc_named(session, 0, "OpenAttach");
size = 0;
/* Fill the OpenAttach operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ModifyRecipients");
+ mem_ctx = talloc_named(session, 0, "ModifyRecipients");
size = 0;
/* Fill the ModifyRecipients operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ReadRecipients");
+ mem_ctx = talloc_named(session, 0, "ReadRecipients");
size = 0;
/* Fill the ReadRecipients operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "RemoveAllRecipients");
+ mem_ctx = talloc_named(session, 0, "RemoveAllRecipients");
size = 0;
/* Fill the RemoveAllRecipients operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SubmitMessage");
+ mem_ctx = talloc_named(session, 0, "SubmitMessage");
size = 0;
/* Fill the SubmitMessage operation */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "AbortSubmit");
+ mem_ctx = talloc_named(session, 0, "AbortSubmit");
size = 0;
/* Fill the AbortSubmit operation */
if ((retval = mapi_object_get_logon_id(parent, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SaveChangesMessage");
+ mem_ctx = talloc_named(session, 0, "SaveChangesMessage");
size = 0;
/* Fill the SaveChangesMessage operation */
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "TransportSend");
+ mem_ctx = talloc_named(session, 0, "TransportSend");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetMessageReadFlags");
+ mem_ctx = talloc_named(session[0], 0, "SetMessageReadFlags");
size = 0;
/* Fill the SetMessageReadFlags operation */
if ((retval = mapi_object_get_logon_id(obj_attach, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "OpenEmbeddedMessage");
+ mem_ctx = talloc_named(session, 0, "OpenEmbeddedMessage");
/* Fill the OpenEmbeddedMessage request */
request.handle_idx = 0x1;
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "OpenFolder");
+ mem_ctx = talloc_named(session, 0, "OpenFolder");
/* Fill the OpenFolder operation */
request.handle_idx = 0x1;
folderId = mapi_object_get_id(obj_folder);
OPENCHANGE_RETVAL_IF(!folderId, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "PublicFolderIsGhosted");
+ mem_ctx = talloc_named(session, 0, "PublicFolderIsGhosted");
size = 0;
/* Fill the PublicFolderIsGhosted operation */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "OpenPublicFolderByName");
+ mem_ctx = talloc_named(session, 0, "OpenPublicFolderByName");
size = 0;
/* Fill the OpenPublicFolderByName operation */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetReceiveFolder");
+ mem_ctx = talloc_named(session, 0, "SetReceiveFolder");
/* Fill the SetReceiveFolder operation */
size = 0;
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetReceiveFolder");
+ mem_ctx = talloc_named(session, 0, "GetReceiveFolder");
*id_folder = 0;
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetReceiveFolderTable");
+ mem_ctx = talloc_named(session, 0, "GetReceiveFolderTable");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetTransportFolder");
+ mem_ctx = talloc_named(session, 0, "GetTransportFolder");
size = 0;
/* Fill the MAPI_REQ request */
FolderId = mapi_object_get_id(obj_folder);
OPENCHANGE_RETVAL_IF(!FolderId, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "GetOwningServers");
+ mem_ctx = talloc_named(session, 0, "GetOwningServers");
size = 0;
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetStoreState");
+ mem_ctx = talloc_named(session, 0, "GetStoreState");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_folder, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "TransportNewMail");
+ mem_ctx = talloc_named(session, 0, "TransportNewMail");
/* Fill the TransportNewMail operation */
size = 0;
OPENCHANGE_RETVAL_IF(!profile, MAPI_E_BAD_VALUE, NULL);
OPENCHANGE_RETVAL_IF(!value, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "mapi_profile_add_string_attr");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapi_profile_add_string_attr");
ldb_ctx = mapi_ctx->ldb_ctx;
/* Retrieve the profile from the database */
OPENCHANGE_RETVAL_IF(!profname, MAPI_E_BAD_VALUE, NULL);
ldb_ctx = mapi_ctx->ldb_ctx;
- mem_ctx = talloc_named(NULL, 0, "mapi_profile_modify_string_attr");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapi_profile_modify_string_attr");
/* Retrieve the profile from the database */
ret = ldb_search(ldb_ctx, mem_ctx, &res, ldb_get_default_basedn(ldb_ctx), scope, attrs, "(cn=%s)(cn=Profiles)", profname);
OPENCHANGE_RETVAL_IF(!profname, MAPI_E_BAD_VALUE, NULL);
ldb_ctx = mapi_ctx->ldb_ctx;
- mem_ctx = talloc_named(NULL, 0, "mapi_profile_delete_string_attr");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapi_profile_delete_string_attr");
/* Retrieve the profile from the database */
ret = ldb_search(ldb_ctx, mem_ctx, &res, ldb_get_default_basedn(ldb_ctx), scope, attrs, "(cn=%s)(cn=Profiles)", profname);
FILE *f;
struct tevent_context *ev;
- OPENCHANGE_RETVAL_IF(!profiledb, MAPI_E_CALL_FAILED, NULL);
- OPENCHANGE_RETVAL_IF(!ldif_path, MAPI_E_CALL_FAILED, NULL);
+ OPENCHANGE_RETVAL_IF(!profiledb, MAPI_E_INVALID_PARAMETER, NULL);
+ OPENCHANGE_RETVAL_IF(!ldif_path, MAPI_E_INVALID_PARAMETER, NULL);
mem_ctx = talloc_named(NULL, 0, "CreateProfileStore");
OPENCHANGE_RETVAL_IF(!mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!mapi_ctx->ldb_ctx, MAPI_E_NOT_INITIALIZED, NULL);
- mem_ctx = talloc_named(NULL, 0, "CreateProfile");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "CreateProfile");
retval = ldb_create_profile(mem_ctx, mapi_ctx->ldb_ctx, profile);
OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
OPENCHANGE_RETVAL_IF(!mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!mapi_ctx->ldb_ctx, MAPI_E_NOT_INITIALIZED, NULL);
- mem_ctx = talloc_named(NULL, 0, "DeleteProfile");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "DeleteProfile");
retval = ldb_delete_profile(mem_ctx, mapi_ctx->ldb_ctx, profile);
OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
talloc_free(mem_ctx);
OPENCHANGE_RETVAL_IF(!profile || !old_password ||
!password, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "ChangeProfilePassword");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "ChangeProfilePassword");
retval = ldb_test_password(mapi_ctx, mem_ctx, profile, password);
OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
OPENCHANGE_RETVAL_IF(!profile_src, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!profile_dst, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "CopyProfile");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "CopyProfile");
retval = ldb_copy_profile(mem_ctx, mapi_ctx->ldb_ctx, profile_src, profile_dst);
OPENCHANGE_RETVAL_IF(retval, retval, mem_ctx);
retval = OpenProfile(mapi_ctx, &profile, profile_src, NULL);
OPENCHANGE_RETVAL_IF(retval, MAPI_E_NOT_FOUND, NULL);
- mem_ctx = talloc_named(NULL, 0, "DuplicateProfile");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "DuplicateProfile");
retval = GetProfileAttr(&profile, "username", &count, &attr_tmp);
OPENCHANGE_RETVAL_IF(retval || !count, MAPI_E_NOT_FOUND, mem_ctx);
OPENCHANGE_RETVAL_IF(!mapi_ctx->ldb_ctx, MAPI_E_NOT_INITIALIZED, NULL);
OPENCHANGE_RETVAL_IF(!profname, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "SetDefaultProfile");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "SetDefaultProfile");
/* open profile */
retval = ldb_load_profile(mem_ctx, mapi_ctx->ldb_ctx, &profile, profname, NULL);
OPENCHANGE_RETVAL_IF(!mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
ldb_ctx = mapi_ctx->ldb_ctx;
- mem_ctx = talloc_autofree_context();
+ mem_ctx = mapi_ctx->mem_ctx;
basedn = ldb_dn_new(ldb_ctx, ldb_ctx, "CN=Profiles");
ret = ldb_search(ldb_ctx, mem_ctx, &res, basedn, scope, attrs, "(cn=*)");
mapi_ctx = session->mapi_ctx;
- mem_ctx = talloc_named(NULL, 0, "ProcessNetworkProfile");
+ mem_ctx = talloc_named(session, 0, "ProcessNetworkProfile");
nspi = (struct nspi_context *) session->nspi->ctx;
profname = session->profile->profname;
index = 0;
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "OpenMessage");
+ mem_ctx = talloc_named(session, 0, "OpenMessage");
/* Fill the OpenMessage operation */
request.handle_idx = 0x1;
if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ReloadCachedInformation");
+ mem_ctx = talloc_named(session, 0, "ReloadCachedInformation");
/* Fill the ReloadCachedInformation operation */
request.Reserved = 0x0000;
if ((retval = mapi_object_get_logon_id(obj_related, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "OpenStream");
+ mem_ctx = talloc_named(session, 0, "OpenStream");
size = 0;
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "ReadStream");
+ mem_ctx = talloc_named(session, 0, "ReadStream");
*ByteRead = 0;
size = 0;
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "WriteStream");
+ mem_ctx = talloc_named(session, 0, "WriteStream");
size = 0;
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CommitStream");
+ mem_ctx = talloc_named(session, 0, "CommitStream");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "GetStreamSize");
+ mem_ctx = talloc_named(session, 0, "GetStreamSize");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SeekStream");
+ mem_ctx = talloc_named(session, 0, "SeekStream");
size = 0;
/* Fill the SeekStream operation */
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetStreamSize");
+ mem_ctx = talloc_named(session, 0, "SetStreamSize");
size = 0;
/* Fill the SetStreamSize operation */
if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CopyToStream");
+ mem_ctx = talloc_named(session[0], 0, "CopyToStream");
size = 0;
/* Fill the CopyToStream operation */
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "LockRegionStream");
+ mem_ctx = talloc_named(session, 0, "LockRegionStream");
size = 0;
/* Fill the LockRegionStream operation */
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "UnlockRegionStream");
+ mem_ctx = talloc_named(session, 0, "UnlockRegionStream");
size = 0;
/* Fill the LockRegionStream operation */
if ((retval = mapi_object_get_logon_id(obj_src, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "CloneStream");
+ mem_ctx = talloc_named(session, 0, "CloneStream");
size = 0;
/* Fill the CloneStream operation */
if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "WriteAndCommitStream");
+ mem_ctx = talloc_named(session, 0, "WriteAndCommitStream");
size = 0;
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "Release");
+ mem_ctx = talloc_named(session, 0, "Release");
/* Fill the MAPI_REQ request */
mapi_req = talloc_zero(mem_ctx, struct EcDoRpc_MAPI_REQ);
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "LongTermIdFromId");
+ mem_ctx = talloc_named(session, 0, "LongTermIdFromId");
/* Fill the LongTermIdFromId operation */
request.Id = id;
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "IdFromLongTermId");
+ mem_ctx = talloc_named(session, 0, "IdFromLongTermId");
size = 0;
/* Fill the IdFromLongTermId operation */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "AddressTypes");
+ mem_ctx = talloc_named(session, 0, "AddressTypes");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SetSpooler");
+ mem_ctx = talloc_named(session, 0, "SetSpooler");
size = 0;
/* Fill the MAPI_REQ request */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "SpoolerLockMessage");
+ mem_ctx = talloc_named(session, 0, "SpoolerLockMessage");
size = 0;
/* Fill the SpoolerLockMessage operation */
if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, "RecipientOptions");
+ mem_ctx = talloc_named(session, 0, "RecipientOptions");
size = 0;
/* Build the OptionsData request */
/* Sanity checks */
OPENCHANGE_RETVAL_IF(!mapi_ctx, MAPI_E_NOT_INITIALIZED, NULL);
- debuglevel = talloc_asprintf(talloc_autofree_context(), "%u", level);
+ debuglevel = talloc_asprintf(mapi_ctx->mem_ctx, "%u", level);
ret = lpcfg_set_cmdline(mapi_ctx->lp_ctx, "log level", debuglevel);
talloc_free(debuglevel);
if (!return_value) return NULL;
if (!session->profile->mailbox) return NULL;
- mem_ctx = talloc_named(NULL, 0, "emsmdb_connect");
+ mem_ctx = talloc_named(parent_mem_ctx, 0, "emsmdb_connect");
ret = talloc_zero(parent_mem_ctx, struct emsmdb_context);
ret->rpc_connection = p;
if (!cred) return NULL;
if (!return_value) return NULL;
- tmp_ctx = talloc_named(NULL, 0, "emsmdb_connect_ex");
+ tmp_ctx = talloc_named(mem_ctx, 0, "emsmdb_connect_ex");
ctx = talloc_zero(mem_ctx, struct emsmdb_context);
ctx->rpc_connection = p;
emsmdb_ctx = (struct emsmdb_context *)session->emsmdb->ctx;
notify_ctx = (struct mapi_notify_ctx *)session->notify_ctx;
- mem_ctx = talloc_named(NULL, 0, "emsmdb_register_notification");
+ mem_ctx = talloc_named(session, 0, "emsmdb_register_notification");
request.in.handle = &emsmdb_ctx->handle;
request.in.iRpc = 0x0;
if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
return retval;
- mem_ctx = talloc_named(NULL, 0, __FUNCTION__);
+ mem_ctx = talloc_named(session, 0, __FUNCTION__);
/* Fill the SyncOpenAdvisor operation */
request.handle_idx = 0x01;
return retval;
}
- mem_ctx = talloc_named(NULL, 0, __FUNCTION__);
+ mem_ctx = talloc_named(session, 0, __FUNCTION__);
/* Fill the SetSyncNotificationGuid operation */
request.NotificationGuid = Guid;
return NULL;
}
- mem_ctx = talloc_named(NULL, 0, __FUNCTION__);
+ mem_ctx = talloc_named(parent_ctx, 0, __FUNCTION__);
r.in.dwFlags = 0;
{
DATA_BLOB b;
- GUID_to_ndr_blob(&(mapi_sprop->value.lpguid), talloc_autofree_context(), &b);
+ GUID_to_ndr_blob(&(mapi_sprop->value.lpguid), mem_ctx, &b);
sprop->value.lpguid = talloc_zero(mem_ctx, struct FlatUID_r);
sprop->value.lpguid = (struct FlatUID_r *)memcpy(sprop->value.lpguid->ab, b.data, 16);
return (sizeof (struct FlatUID_r));
DATA_BLOB b;
sprop->value.MVguid.lpguid[i] = talloc_zero(mem_ctx, struct FlatUID_r);
- GUID_to_ndr_blob(&(mapi_sprop->value.MVguid.lpguid[i]), talloc_autofree_context(), &b);
+ GUID_to_ndr_blob(&(mapi_sprop->value.MVguid.lpguid[i]), mem_ctx, &b);
sprop->value.MVguid.lpguid[i] = (struct FlatUID_r *)memcpy(sprop->value.MVguid.lpguid[i]->ab, b.data, sizeof(struct FlatUID_r));
size += (sizeof (struct FlatUID_r));
}
uint16_t count;
uint32_t i;
- mem_ctx = talloc_named(NULL, 0, "mapi_SPropValue_array_named");
+ mem_ctx = talloc_named(mapi_object_get_session(obj), 0, "mapi_SPropValue_array_named");
for (i = 0; i < props->cValues; i++) {
if ((props->lpProps[i].ulPropTag & 0xFFFF0000) > 0x80000000) {
store = (mapi_object_store_t *)obj_store->private_data;
OPENCHANGE_RETVAL_IF(!store, MAPI_E_NOT_INITIALIZED, NULL);
- mem_ctx = talloc_named(NULL, 0, "CacheDefaultFolders");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_store), 0, "CacheDefaultFolders");
mapi_object_init(&obj_inbox);
retval = GetReceiveFolder(obj_store, &id_inbox, NULL);
OPENCHANGE_RETVAL_IF(!unread, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!total, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "GetFolderItemsCount");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_folder), 0, "GetFolderItemsCount");
SPropTagArray = set_SPropTagArray(mem_ctx, 0x2,
PR_CONTENT_UNREAD,
rowList.ModifyFlags = 0;
- mem_ctx = talloc_named(NULL, 0, "AddUserPermission");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_folder), 0, "AddUserPermission");
/* query Address book */
rowList.ModifyFlags = 0;
- mem_ctx = talloc_named(NULL, 0, "ModifyUserPermission");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_folder), 0, "ModifyUserPermission");
SPropTagArray = set_SPropTagArray(mem_ctx, 2, PR_ENTRYID, PR_DISPLAY_NAME);
names[0] = username;
OPENCHANGE_RETVAL_IF(!obj_folder, MAPI_E_INVALID_PARAMETER, NULL);
OPENCHANGE_RETVAL_IF(!username, MAPI_E_INVALID_PARAMETER, NULL);
- mem_ctx = talloc_named(NULL, 0, "RemoveUserPermission");
+ mem_ctx = talloc_named(mapi_object_get_session(obj_folder), 0, "RemoveUserPermission");
SPropTagArray = set_SPropTagArray(mem_ctx, 2, PR_ENTRYID, PR_DISPLAY_NAME);
names[0] = username;
static bool mapiprofile_createdb(const char *profdb, const char *ldif_path)
{
enum MAPISTATUS retval;
-
+
if (access(profdb, F_OK) == 0) {
fprintf(stderr, "[ERROR] mapiprofile: %s already exists\n", profdb);
return false;
retval = CreateProfileStore(profdb, ldif_path);
if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("CreateProfileStore", GetLastError());
+ mapi_errstr("CreateProfileStore", retval);
return false;
}
+
return true;
}
fprintf(stderr, "CTRL-C caught ... Deleting profile\n");
if ((retval = DeleteProfile(g_mapi_ctx, g_profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("DeleteProfile", GetLastError());
+ mapi_errstr("DeleteProfile", retval);
}
(void) signal(SIGINT, SIG_DFL);
exit (1);
}
-static bool mapiprofile_create(const char *profdb, const char *profname,
+static bool mapiprofile_create(struct mapi_context *mapi_ctx,
+ const char *profdb, const char *profname,
const char *pattern, const char *username,
const char *password, const char *address,
const char *language, const char *workstation,
uint8_t exchange_version, const char *kerberos)
{
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
struct mapi_session *session = NULL;
TALLOC_CTX *mem_ctx;
struct mapi_profile profile;
char *cpid_str;
char *lcid_str;
- mem_ctx = talloc_named(NULL, 0, "mapiprofile_create");
-
- retval = MAPIInitialize(&mapi_ctx, profdb);
- if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- talloc_free(mem_ctx);
- return false;
- }
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapiprofile_create");
/* catch CTRL-C */
g_profname = profname;
retval = OpenProfile(mapi_ctx, &profile, profname, NULL);
if (retval == MAPI_E_SUCCESS) {
fprintf(stderr, "[ERROR] mapiprofile: profile \"%s\" already exists\n", profname);
- MAPIUninitialize(mapi_ctx);
talloc_free(mem_ctx);
return false;
}
retval = CreateProfile(mapi_ctx, profname, username, password, flags);
if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("CreateProfile", GetLastError());
+ mapi_errstr("CreateProfile", retval);
talloc_free(mem_ctx);
return false;
}
printf("Invalid Language supplied or unknown system language '%s\n'", language);
printf("Deleting profile\n");
if ((retval = DeleteProfile(mapi_ctx, profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("DeleteProfile", GetLastError());
+ mapi_errstr("DeleteProfile", retval);
}
talloc_free(mem_ctx);
return false;
retval = MapiLogonProvider(mapi_ctx, &session, profname, password, PROVIDER_ID_NSPI);
if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("MapiLogonProvider", GetLastError());
+ mapi_errstr("MapiLogonProvider", retval);
printf("Deleting profile\n");
if ((retval = DeleteProfile(mapi_ctx, profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("DeleteProfile", GetLastError());
+ mapi_errstr("DeleteProfile", retval);
}
talloc_free(mem_ctx);
return false;
retval = ProcessNetworkProfile(session, username, (mapi_profile_callback_t) callback, "Select a user id");
if (retval != MAPI_E_SUCCESS && retval != 0x1) {
- mapi_errstr("ProcessNetworkProfile", GetLastError());
+ mapi_errstr("ProcessNetworkProfile", retval);
printf("Deleting profile\n");
if ((retval = DeleteProfile(mapi_ctx, profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("DeleteProfile", GetLastError());
+ mapi_errstr("DeleteProfile", retval);
}
talloc_free(mem_ctx);
return false;
talloc_free(mem_ctx);
- MAPIUninitialize(mapi_ctx);
-
return true;
}
-static void mapiprofile_delete(const char *profdb, const char *profname)
+static void mapiprofile_delete(struct mapi_context *mapi_ctx, const char *profdb, const char *profname)
{
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
-
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
if ((retval = DeleteProfile(mapi_ctx, profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("DeleteProfile", GetLastError());
+ mapi_errstr("DeleteProfile", retval);
exit (1);
}
printf("Profile %s deleted from database %s\n", profname, profdb);
-
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_rename(const char *profdb, const char *old_profname, const char *new_profname)
+static void mapiprofile_rename(struct mapi_context *mapi_ctx, const char *profdb, const char *old_profname, const char *new_profname)
{
TALLOC_CTX *mem_ctx;
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
char *profname;
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", retval);
- exit (1);
- }
-
- mem_ctx = talloc_named(NULL, 0, "mapiprofile_rename");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapiprofile_rename");
if (!old_profname) {
if ((retval = GetDefaultProfile(mapi_ctx, &profname)) != MAPI_E_SUCCESS) {
talloc_free(profname);
talloc_free(mem_ctx);
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_set_default(const char *profdb, const char *profname)
+static void mapiprofile_set_default(struct mapi_context *mapi_ctx, const char *profdb, const char *profname)
{
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
-
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
if ((retval = SetDefaultProfile(mapi_ctx, profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("SetDefaultProfile", GetLastError());
+ mapi_errstr("SetDefaultProfile", retval);
exit (1);
}
printf("Profile %s is now set the default one\n", profname);
-
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_get_default(const char *profdb)
+static void mapiprofile_get_default(struct mapi_context *mapi_ctx, const char *profdb)
{
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
char *profname;
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
-
if ((retval = GetDefaultProfile(mapi_ctx, &profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("GetDefaultProfile", GetLastError());
+ mapi_errstr("GetDefaultProfile", retval);
exit (1);
}
printf("Default profile is set to %s\n", profname);
talloc_free(profname);
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_get_fqdn(const char *profdb,
- const char *opt_profname,
+static void mapiprofile_get_fqdn(struct mapi_context *mapi_ctx,
+ const char *profdb,
+ const char *opt_profname,
const char *password,
bool opt_dumpdata)
{
TALLOC_CTX *mem_ctx;
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
struct mapi_session *session = NULL;
const char *serverFQDN;
char *profname;
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
-
SetMAPIDumpData(mapi_ctx, opt_dumpdata);
- mem_ctx = talloc_named(NULL, 0, "mapiprofile_get_fqdn");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapiprofile_get_fqdn");
if (!opt_profname) {
if ((retval = GetDefaultProfile(mapi_ctx, &profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("GetDefaultProfile", GetLastError());
+ mapi_errstr("GetDefaultProfile", retval);
talloc_free(mem_ctx);
exit (1);
}
talloc_free(profname);
talloc_free(mem_ctx);
if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("MapiLogonProvider", GetLastError());
+ mapi_errstr("MapiLogonProvider", retval);
exit (1);
}
retval = RfrGetFQDNFromLegacyDN(mapi_ctx, session, &serverFQDN);
if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("RfrGetFQDNFromLegacyDN", GetLastError());
+ mapi_errstr("RfrGetFQDNFromLegacyDN", retval);
exit (1);
}
printf("%s is at %s\n", mapi_ctx->session->profile->homemdb, serverFQDN);
-
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_list(const char *profdb)
+static void mapiprofile_list(struct mapi_context *mapi_ctx, const char *profdb)
{
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
struct SRowSet proftable;
uint32_t count = 0;
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
-
memset(&proftable, 0, sizeof (struct SRowSet));
if ((retval = GetProfileTable(mapi_ctx, &proftable)) != MAPI_E_SUCCESS) {
- mapi_errstr("GetProfileTable", GetLastError());
+ mapi_errstr("GetProfileTable", retval);
exit (1);
}
}
}
-
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_dump(const char *profdb, const char *opt_profname)
+static void mapiprofile_dump(struct mapi_context *mapi_ctx, const char *profdb, const char *opt_profname)
{
TALLOC_CTX *mem_ctx;
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
struct mapi_profile profile;
char *profname;
char *exchange_version = NULL;
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
-
- mem_ctx = talloc_named(NULL, 0, "mapiprofile_dump");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapiprofile_dump");
if (!opt_profname) {
if ((retval = GetDefaultProfile(mapi_ctx, &profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("GetDefaultProfile", GetLastError());
+ mapi_errstr("GetDefaultProfile", retval);
talloc_free(mem_ctx);
exit (1);
}
if (retval && (retval != MAPI_E_INVALID_PARAMETER)) {
talloc_free(mem_ctx);
- mapi_errstr("OpenProfile", GetLastError());
+ mapi_errstr("OpenProfile", retval);
exit (1);
}
end:
talloc_free(mem_ctx);
- MAPIUninitialize(mapi_ctx);
}
-static void mapiprofile_attribute(const char *profdb, const char *opt_profname,
+static void mapiprofile_attribute(struct mapi_context *mapi_ctx, const char *profdb, const char *opt_profname,
const char *attribute)
{
TALLOC_CTX *mem_ctx;
enum MAPISTATUS retval;
- struct mapi_context *mapi_ctx;
struct mapi_profile profile;
char *profname = NULL;
char **value = NULL;
unsigned int count = 0;
unsigned int i;
- if ((retval = MAPIInitialize(&mapi_ctx, profdb)) != MAPI_E_SUCCESS) {
- mapi_errstr("MAPIInitialize", GetLastError());
- exit (1);
- }
-
- mem_ctx = talloc_named(NULL, 0, "mapiprofile_attribute");
+ mem_ctx = talloc_named(mapi_ctx->mem_ctx, 0, "mapiprofile_attribute");
if (!opt_profname) {
if ((retval = GetDefaultProfile(mapi_ctx, &profname)) != MAPI_E_SUCCESS) {
- mapi_errstr("GetDefaultProfile", GetLastError());
+ mapi_errstr("GetDefaultProfile", retval);
exit (1);
}
} else {
retval = OpenProfile(mapi_ctx, &profile, profname, NULL);
if (retval && (retval != MAPI_E_INVALID_PARAMETER)) {
- mapi_errstr("OpenProfile", GetLastError());
+ mapi_errstr("OpenProfile", retval);
talloc_free(profname);
talloc_free(mem_ctx);
exit (1);
}
if ((retval = GetProfileAttr(&profile, attribute, &count, &value))) {
- mapi_errstr("ProfileGetAttr", GetLastError());
+ mapi_errstr("ProfileGetAttr", retval);
talloc_free(profname);
talloc_free(mem_ctx);
exit (1);
MAPIFreeBuffer(value);
talloc_free(profname);
talloc_free(mem_ctx);
-
- MAPIUninitialize(mapi_ctx);
}
static void show_help(poptContext pc, const char *param)
int main(int argc, const char *argv[])
{
TALLOC_CTX *mem_ctx;
+ struct mapi_context *mapi_ctx = NULL;
int error;
poptContext pc;
int opt;
}
}
+ if (MAPIInitialize(&mapi_ctx, profdb) != MAPI_E_SUCCESS) {
+ mapi_errstr("MAPIInitialize", GetLastError());
+ exit (1);
+ }
+
if (opt_krb) {
if (strncmp(opt_krb, "yes", 3) && strncmp(opt_krb, "no", 2)) {
fprintf(stderr,
}
talloc_free((void *)version);
- if (! mapiprofile_create(profdb, profname, pattern, username, password, address,
+ if (! mapiprofile_create(mapi_ctx, profdb, profname, pattern, username, password, address,
language, workstation, domain, realm, nopass, opt_seal,
opt_dumpdata, opt_debuglevel,
exchange_version[i].version,
}
if (rename) {
- mapiprofile_rename(profdb, profname, rename);
+ mapiprofile_rename(mapi_ctx, profdb, profname, rename);
}
if (getfqdn == true) {
- mapiprofile_get_fqdn(profdb, profname, password, opt_dumpdata);
+ mapiprofile_get_fqdn(mapi_ctx, profdb, profname, password, opt_dumpdata);
}
if (listlangs == true) {
}
if (setdflt == true) {
- mapiprofile_set_default(profdb, profname);
+ mapiprofile_set_default(mapi_ctx, profdb, profname);
}
if (getdflt == true) {
- mapiprofile_get_default(profdb);
+ mapiprofile_get_default(mapi_ctx, profdb);
}
if (delete == true) {
- mapiprofile_delete(profdb, profname);
+ mapiprofile_delete(mapi_ctx, profdb, profname);
}
if (list == true) {
- mapiprofile_list(profdb);
+ mapiprofile_list(mapi_ctx, profdb);
}
if (dump == true) {
- mapiprofile_dump(profdb, profname);
+ mapiprofile_dump(mapi_ctx, profdb, profname);
}
if (attribute) {
- mapiprofile_attribute(profdb, profname, attribute);
+ mapiprofile_attribute(mapi_ctx, profdb, profname, attribute);
}
cleanup:
free((void*)rename);
free((void*)attribute);
+ if (mapi_ctx)
+ MAPIUninitialize(mapi_ctx);
poptFreeContext(pc);
talloc_free(mem_ctx);