mapiproxy/libmapiproxy/openchangedb.c File Reference

OpenChange Dispatcher database routines. More...

#include <inttypes.h>
#include "mapiproxy/dcesrv_mapiproxy.h"
#include "mapiproxy/libmapiproxy/libmapiproxy.h"
#include "libmapi/libmapi.h"
#include "libmapi/libmapi_private.h"

Defines

#define __STDC_FORMAT_MACROS   1

Functions

_PUBLIC_ enum MAPISTATUS openchangedb_get_distinguishedName (TALLOC_CTX *parent_ctx, void *_ldb_ctx, uint64_t fid, char **distinguishedName)
_PUBLIC_ enum MAPISTATUS openchangedb_get_fid_by_name (void *_ldb_ctx, uint64_t parent_fid, const char *foldername, uint64_t *fid)
_PUBLIC_ enum MAPISTATUS openchangedb_get_folder_count (void *_ldb_ctx, uint64_t fid, uint32_t *RowCount)
_PUBLIC_ enum MAPISTATUS openchangedb_get_folder_property (TALLOC_CTX *parent_ctx, void *_ldb_ctx, char *recipient, uint32_t proptag, uint64_t fid, void **data)
static void * openchangedb_get_folder_property_data (TALLOC_CTX *mem_ctx, struct ldb_result *res, uint32_t pos, uint32_t proptag, const char *PidTagAttr)
static void * openchangedb_get_folder_special_property (TALLOC_CTX *mem_ctx, void *ldb_ctx, char *recipient, struct ldb_result *res, uint32_t proptag, const char *PidTagAttr)
_PUBLIC_ enum MAPISTATUS openchangedb_get_MailboxGuid (void *_ldb_ctx, char *recipient, struct GUID *MailboxGUID)
_PUBLIC_ enum MAPISTATUS openchangedb_get_MailboxReplica (void *_ldb_ctx, char *recipient, uint16_t *ReplID, struct GUID *ReplGUID)
_PUBLIC_ enum MAPISTATUS openchangedb_get_mapistoreURI (TALLOC_CTX *parent_ctx, void *_ldb_ctx, uint64_t fid, char **mapistoreURL, bool mailboxstore)
_PUBLIC_ enum MAPISTATUS openchangedb_get_new_folderID (void *_ldb_ctx, uint64_t *fid)
_PUBLIC_ enum MAPISTATUS openchangedb_get_PublicFolderID (void *_ldb_ctx, uint32_t SystemIdx, uint64_t *FolderId)
_PUBLIC_ enum MAPISTATUS openchangedb_get_PublicFolderReplica (void *_ldb_ctx, uint16_t *ReplID, struct GUID *ReplGUID)
_PUBLIC_ enum MAPISTATUS openchangedb_get_ReceiveFolder (TALLOC_CTX *parent_ctx, void *_ldb_ctx, const char *recipient, const char *MessageClass, uint64_t *fid, const char **ExplicitMessageClass)
_PUBLIC_ enum MAPISTATUS openchangedb_get_SystemFolderID (void *_ldb_ctx, char *recipient, uint32_t SystemIdx, uint64_t *FolderId)
_PUBLIC_ enum MAPISTATUS openchangedb_get_table_property (TALLOC_CTX *parent_ctx, void *_ldb_ctx, char *recipient, char *ldb_filter, uint32_t proptag, uint32_t pos, void **data)
_PUBLIC_ enum MAPISTATUS openchangedb_lookup_folder_property (void *_ldb_ctx, uint32_t proptag, uint64_t fid)
_PUBLIC_ enum MAPISTATUS openchangedb_set_ReceiveFolder (TALLOC_CTX *parent_ctx, void *_ldb_ctx, const char *recipient, const char *MessageClass, uint64_t fid)

Detailed Description

OpenChange Dispatcher database routines.


Define Documentation

#define __STDC_FORMAT_MACROS   1

Function Documentation

_PUBLIC_ enum MAPISTATUS openchangedb_get_distinguishedName ( TALLOC_CTX *  parent_ctx,
void *  _ldb_ctx,
uint64_t  fid,
char **  distinguishedName 
)

Retrieve the distinguishedName associated to a mailbox system folder.

Parameters:
parent_ctxpointer to the parent memory context
_ldb_ctxpointer to the openchange LDB context
fidthe Folder identifier to search for
distinguishedNamepointer on pointer to the distinguishedName string the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

Referenced by openchangedb_set_ReceiveFolder(), EcDoRpc_RopCreateSystemSpecialFolder(), EcDoRpc_RopCreateGenericFolder(), and DoDeleteSystemFolder().

_PUBLIC_ enum MAPISTATUS openchangedb_get_fid_by_name ( void *  _ldb_ctx,
uint64_t  parent_fid,
const char *  foldername,
uint64_t *  fid 
)

Retrieve the folder ID associated with a given folder name

This function looks up the specified foldername (as a PidTagDisplayName) and returns the associated folder ID. Note that folder names are only unique in the context of a parent folder, so the parent folder needs to be provided.

Parameters:
_ldb_ctxpointer to the openchange LDB context
parent_fidthe folder ID of the parent folder
foldernamethe name to look up
fidthe folder ID for the folder with the specified name (0 if not found)
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

Referenced by EcDoRpc_RopCreateSystemSpecialFolder().

_PUBLIC_ enum MAPISTATUS openchangedb_get_folder_count ( void *  _ldb_ctx,
uint64_t  fid,
uint32_t *  RowCount 
)

Retrieve the number of sub folders for a given fid

Parameters:
_ldb_ctxpointer to the openchange LDB context
fidthe folder identifier to use for the search
RowCountpointer to the returned number of results
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

Referenced by EcDoRpc_RopGetHierarchyTable().

_PUBLIC_ enum MAPISTATUS openchangedb_get_folder_property ( TALLOC_CTX *  parent_ctx,
void *  _ldb_ctx,
char *  recipient,
uint32_t  proptag,
uint64_t  fid,
void **  data 
)

Retrieve a MAPI property value from a folder record

Parameters:
parent_ctxpointer to the memory context
_ldb_ctxpointer to the openchange LDB context
recipientthe mailbox username
proptagthe MAPI property tag to retrieve value for
fidthe record folder identifier
datapointer on pointer to the data the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

References openchangedb_property_get_attribute(), openchangedb_get_folder_special_property(), and openchangedb_get_folder_property_data().

Referenced by RopGetPropertiesSpecific_Mailbox(), and RopGetPropertiesSpecific_SystemSpecialFolder().

static void* openchangedb_get_folder_property_data ( TALLOC_CTX *  mem_ctx,
struct ldb_result *  res,
uint32_t  pos,
uint32_t  proptag,
const char *  PidTagAttr 
) [static]

Retrieve a MAPI property from a OpenChange LDB message

Parameters:
mem_ctxpointer to the memory context
respointer to the LDB results
posthe LDB result index
proptagthe MAPI property tag to lookup
PidTagAttrthe mapped MAPI property name
Returns:
valid data pointer on success, otherwise NULL

Referenced by openchangedb_get_folder_property(), and openchangedb_get_table_property().

static void* openchangedb_get_folder_special_property ( TALLOC_CTX *  mem_ctx,
void *  ldb_ctx,
char *  recipient,
struct ldb_result *  res,
uint32_t  proptag,
const char *  PidTagAttr 
) [static]

Retrieve a special MAPI property from a folder record

Parameters:
mem_ctxpointer to the memory context
ldb_ctxpointer to the OpenChange LDB context
recipientthe mailbox username
respointer to the LDB result
proptagthe MAPI property tag to lookup
PidTagAttrthe mapped MAPI property name
Returns:
pointer to valid data on success, otherwise NULL

References openchangedb_get_MailboxGuid(), openchangedb_get_MailboxReplica(), and entryid_set_folder_EntryID().

Referenced by openchangedb_get_folder_property(), and openchangedb_get_table_property().

_PUBLIC_ enum MAPISTATUS openchangedb_get_MailboxGuid ( void *  _ldb_ctx,
char *  recipient,
struct GUID *  MailboxGUID 
)

Retrieve the mailbox GUID for given recipient from openchange dispatcher database

Parameters:
_ldb_ctxpointer to the OpenChange LDB context
recipientthe mailbox username
MailboxGUIDpointer to the mailbox GUID the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by openchangedb_get_folder_special_property(), and RopLogon_Mailbox().

_PUBLIC_ enum MAPISTATUS openchangedb_get_MailboxReplica ( void *  _ldb_ctx,
char *  recipient,
uint16_t *  ReplID,
struct GUID *  ReplGUID 
)

Retrieve the mailbox replica identifier and GUID for given recipient from openchange dispatcher database

Parameters:
_ldb_ctxpointer to the OpenChange LDB context
recipientthe mailbox username
ReplIDpointer to the replica identifier the function returns
ReplGUIDpointer to the replica GUID the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by openchangedb_get_folder_special_property(), and RopLogon_Mailbox().

_PUBLIC_ enum MAPISTATUS openchangedb_get_mapistoreURI ( TALLOC_CTX *  parent_ctx,
void *  _ldb_ctx,
uint64_t  fid,
char **  mapistoreURL,
bool  mailboxstore 
)

Retrieve the mapistore URI associated to a mailbox system folder.

Parameters:
parent_ctxpointer to the memory context
_ldb_ctxpointer to the openchange LDB context
fidthe Folder identifier to search for
mapistoreURLpointer on pointer to the mapistore URI the function returns
mailboxstoreboolean value which defines whether the record has to be searched within Public folders hierarchy or not
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

Referenced by emsmdbp_object_folder_init().

_PUBLIC_ enum MAPISTATUS openchangedb_get_new_folderID ( void *  _ldb_ctx,
uint64_t *  fid 
)

Return the next available FolderID

Parameters:
_ldb_ctxpointer to the openchange LDB context
fidpointer to the fid value the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by EcDoRpc_RopCreateSystemSpecialFolder(), EcDoRpc_RopCreateGenericFolder(), and EcDoRpc_RopCreateMessage().

_PUBLIC_ enum MAPISTATUS openchangedb_get_PublicFolderID ( void *  _ldb_ctx,
uint32_t  SystemIdx,
uint64_t *  FolderId 
)

Retrieve the public folder FolderID (fid) for a given folder type

Parameters:
_ldb_ctxpointer to the OpenChange LDB context
SystemIdxthe system folder index
FolderIdpointer to the folder identifier the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by emsmdbp_object_mailbox_init(), and RopLogon_PublicFolder().

_PUBLIC_ enum MAPISTATUS openchangedb_get_PublicFolderReplica ( void *  _ldb_ctx,
uint16_t *  ReplID,
struct GUID *  ReplGUID 
)

Retrieve the public folder replica identifier and GUID from the openchange dispatcher database

Parameters:
_ldb_ctxpointer to the OpenChange LDB context
ReplIDpointer to the replica identifier the function returns
ReplGUIDpointer to the replica GUID the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by RopLogon_PublicFolder().

_PUBLIC_ enum MAPISTATUS openchangedb_get_ReceiveFolder ( TALLOC_CTX *  parent_ctx,
void *  _ldb_ctx,
const char *  recipient,
const char *  MessageClass,
uint64_t *  fid,
const char **  ExplicitMessageClass 
)

Retrieve the Explicit message class and Folder identifier associated to the MessageClass search pattern.

Parameters:
parent_ctxpointer to the memory context
_ldb_ctxpointer to the openchange LDB context
recipientpointer to the mailbox's username
MessageClasssubstring to search for
fidpointer to the folder identifier the function returns
ExplicitMessageClasspointer on pointer to the complete message class the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

Referenced by RopGetReceiveFolder().

_PUBLIC_ enum MAPISTATUS openchangedb_get_SystemFolderID ( void *  _ldb_ctx,
char *  recipient,
uint32_t  SystemIdx,
uint64_t *  FolderId 
)

Retrieve the mailbox FolderID for given recipient from openchange dispatcher database

Parameters:
_ldb_ctxpointer to the OpenChange LDB context
recipientthe mailbox username
SystemIdxthe system folder index
FolderIdpointer to the folder identifier the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by emsmdbp_object_mailbox_init(), and RopLogon_Mailbox().

_PUBLIC_ enum MAPISTATUS openchangedb_get_table_property ( TALLOC_CTX *  parent_ctx,
void *  _ldb_ctx,
char *  recipient,
char *  ldb_filter,
uint32_t  proptag,
uint32_t  pos,
void **  data 
)

Retrieve a MAPI property from a table (ldb search results)

Parameters:
parent_ctxpointer to the memory context
_ldb_ctxpointer to the openchange LDB context
recipientthe mailbox username
ldb_filterthe ldb search string
proptagthe MAPI property tag to retrieve value for
posthe record position in search results
datapointer on pointer to the data the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

References openchangedb_property_get_attribute(), openchangedb_get_folder_special_property(), and openchangedb_get_folder_property_data().

Referenced by EcDoRpc_RopQueryRows().

_PUBLIC_ enum MAPISTATUS openchangedb_lookup_folder_property ( void *  _ldb_ctx,
uint32_t  proptag,
uint64_t  fid 
)

Check if a property exists within an openchange dispatcher database record

Parameters:
_ldb_ctxpointer to the openchange LDB context
proptagthe MAPI property tag to lookup
fidthe record folder identifier
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

References openchangedb_property_get_attribute().

Referenced by RopGetPropertiesSpecific_SystemSpecialFolder().

_PUBLIC_ enum MAPISTATUS openchangedb_set_ReceiveFolder ( TALLOC_CTX *  parent_ctx,
void *  _ldb_ctx,
const char *  recipient,
const char *  MessageClass,
uint64_t  fid 
)

Set the receive folder for a specific message class.

Parameters:
parent_ctxpointer to the memory context
_ldb_ctxpointer to the openchange LDB context
recipientpointer to the mailbox's username
MessageClassmessage class (e.g. IPM.whatever) to set
fidfolder identifier for the recipient folder for the message class
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

References openchangedb_get_distinguishedName().

Referenced by RopSetReceiveFolder().


Creative Commons License
Creative Commons Attribution icon Creative Commons Share Alike icon
This content is licensed under the Creative Commons
Attribution ShareAlike License v. 3.0:
http://creativecommons.org/licenses/by-sa/3.0/