dcesrv_exchange_nsp.h File Reference
#include "libmapi/libmapi.h"
#include "libmapi/libmapi_private.h"
#include "mapiproxy/libmapiproxy/libmapiproxy.h"
#include <tevent.h>
#include <fcntl.h>
#include <util/debug.h>

Data Structures

struct  emsabp_context
 
struct  emsabp_MId
 
struct  EphemeralEntryID
 EphemeralEntryID structure. More...
 
struct  exchange_nsp_session
 
struct  PermanentEntryID
 PermanentEntryID structure. More...
 

Macros

#define __BEGIN_DECLS
 
#define __END_DECLS
 
#define AB_RECIPIENTS   0x1
 NSPI PR_CONTAINER_FLAGS values. More...
 
#define AB_SUBCONTAINERS   0x2
 
#define AB_UNMODIFIABLE   0x8
 
#define DCESRV_NSP_RETURN(r, c, ctx)   { r->out.result = c; return; if (ctx) talloc_free(ctx); }
 
#define EMSABP_ADDRTYPE   "EX"
 
#define EMSABP_DN   "/guid=%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X"
 
#define EMSABP_TDB_DATA_REC   "MId_index"
 
#define EMSABP_TDB_MID_START   0x1b28
 
#define EMSABP_TDB_TMP_MID_START   0x5000
 

Functions

enum MAPISTATUS emsabp_ab_container_by_id (TALLOC_CTX *, struct emsabp_context *, uint32_t, struct ldb_message **)
 
enum MAPISTATUS emsabp_ab_container_enum (TALLOC_CTX *, struct emsabp_context *, uint32_t, struct ldb_result **)
 
bool emsabp_destructor (void *)
 
enum MAPISTATUS emsabp_EphemeralEntryID_to_Binary_r (TALLOC_CTX *, struct EphemeralEntryID *, struct Binary_r *)
 
enum MAPISTATUS emsabp_fetch_attrs (TALLOC_CTX *, struct emsabp_context *, struct PropertyRow_r *, uint32_t, uint32_t, struct SPropTagArray *)
 
enum MAPISTATUS emsabp_fetch_attrs_from_msg (TALLOC_CTX *, struct emsabp_context *, struct PropertyRow_r *, struct ldb_message *, uint32_t, uint32_t, struct SPropTagArray *)
 
enum MAPISTATUS emsabp_get_account_info (TALLOC_CTX *, struct emsabp_context *, const char *, struct ldb_message **)
 
enum MAPISTATUS emsabp_get_CreationTemplatesTable (TALLOC_CTX *, struct emsabp_context *, uint32_t, struct PropertyRowSet_r **)
 
enum MAPISTATUS emsabp_get_HierarchyTable (TALLOC_CTX *, struct emsabp_context *, uint32_t, struct PropertyRowSet_r **)
 
struct emsabp_contextemsabp_init (struct loadparm_context *, TDB_CONTEXT *)
 
enum MAPISTATUS emsabp_PermanentEntryID_to_Binary_r (TALLOC_CTX *, struct PermanentEntryID *, struct Binary_r *)
 
const char * emsabp_property_get_attribute (uint32_t)
 
const char * emsabp_property_get_ref_attr (uint32_t)
 
uint32_t emsabp_property_get_ulPropTag (const char *)
 
int emsabp_property_is_ref (uint32_t)
 
void * emsabp_query (TALLOC_CTX *, struct emsabp_context *, struct ldb_message *, uint32_t, uint32_t, uint32_t)
 
enum MAPISTATUS emsabp_search (TALLOC_CTX *, struct emsabp_context *, struct PropertyTagArray_r *, struct Restriction_r *, struct STAT *, uint32_t)
 
enum MAPISTATUS emsabp_search_dn (struct emsabp_context *, const char *, struct ldb_message **)
 
enum MAPISTATUS emsabp_search_legacyExchangeDN (struct emsabp_context *, const char *, struct ldb_message **, bool *)
 
enum MAPISTATUS emsabp_set_EphemeralEntryID (struct emsabp_context *, uint32_t, uint32_t, struct EphemeralEntryID *)
 
enum MAPISTATUS emsabp_set_PermanentEntryID (struct emsabp_context *, uint32_t, struct ldb_message *, struct PermanentEntryID *)
 
enum MAPISTATUS emsabp_table_fetch_attrs (TALLOC_CTX *, struct emsabp_context *, struct PropertyRow_r *, uint32_t, struct PermanentEntryID *, struct PermanentEntryID *, struct ldb_message *, bool)
 
enum MAPISTATUS emsabp_tdb_close (TDB_CONTEXT *)
 
enum MAPISTATUS emsabp_tdb_fetch (TDB_CONTEXT *, const char *, TDB_DATA *)
 
enum MAPISTATUS emsabp_tdb_fetch_dn_from_MId (TALLOC_CTX *, TDB_CONTEXT *, uint32_t, char **)
 
enum MAPISTATUS emsabp_tdb_fetch_MId (TDB_CONTEXT *, const char *, uint32_t *)
 
TDB_CONTEXT * emsabp_tdb_init (TALLOC_CTX *, struct loadparm_context *)
 
TDB_CONTEXT * emsabp_tdb_init_tmp (TALLOC_CTX *)
 
enum MAPISTATUS emsabp_tdb_insert (TDB_CONTEXT *, const char *)
 
bool emsabp_tdb_lookup_MId (TDB_CONTEXT *, uint32_t)
 
bool emsabp_verify_codepage (struct emsabp_context *, uint32_t)
 
bool emsabp_verify_lcid (struct emsabp_context *, uint32_t)
 
bool emsabp_verify_user (struct dcesrv_call_state *, struct emsabp_context *)
 
__BEGIN_DECLS NTSTATUS samba_init_module (void)
 
struct ldb_context * samdb_connect (TALLOC_CTX *, struct tevent_context *, struct loadparm_context *, struct auth_session_info *, int)
 
struct GUID * samdb_ntds_objectGUID (struct ldb_context *)
 

Macro Definition Documentation

#define __BEGIN_DECLS
#define __END_DECLS
#define AB_RECIPIENTS   0x1

NSPI PR_CONTAINER_FLAGS values.

Referenced by emsabp_table_fetch_attrs().

#define AB_SUBCONTAINERS   0x2
#define AB_UNMODIFIABLE   0x8
#define EMSABP_ADDRTYPE   "EX"

Referenced by emsabp_query().

#define EMSABP_DN   "/guid=%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X"
#define EMSABP_TDB_DATA_REC   "MId_index"
#define EMSABP_TDB_MID_START   0x1b28

Referenced by emsabp_tdb_init().

#define EMSABP_TDB_TMP_MID_START   0x5000

Referenced by emsabp_tdb_init_tmp().

Function Documentation

enum MAPISTATUS emsabp_ab_container_by_id ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
uint32_t  ContainerID,
struct ldb_message **  ldb_msg 
)

Fetch Address Book container record for given ContainerID

Parameters
mem_ctxmemory context for allocation
emsabp_ctxpointer to the EMSABP context
ContainerIDid of the container to fetch
ldb_msgpointer on pointer to the LDB message returned by the function
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_ERROR

References emsabp_search_dn(), emsabp_tdb_fetch_dn_from_MId(), emsabp_context::samdb_ctx, and emsabp_context::tdb_ctx.

Referenced by dcesrv_NspiResolveNames(), dcesrv_NspiResolveNamesW(), and emsabp_ab_container_enum().

enum MAPISTATUS emsabp_ab_container_enum ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
uint32_t  ContainerID,
struct ldb_result **  ldb_resp 
)

Enumerate AB container entries

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
ContainerIDid of the container to fetch
ldb_respointer on pointer to the LDB result returned by the function
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References emsabp_ab_container_by_id(), and emsabp_context::samdb_ctx.

Referenced by dcesrv_NspiQueryRows().

bool emsabp_destructor ( void *  )
enum MAPISTATUS emsabp_EphemeralEntryID_to_Binary_r ( TALLOC_CTX *  mem_ctx,
struct EphemeralEntryID ephEntryID,
struct Binary_r *  bin 
)

Map an EphemeralEntryID structure into a Binary_r structure

Parameters
mem_ctxpointer to the memory context
ephEntryIDpointer to the Ephemeral EntryID structure
binpointer to the Binary_r structure the server will return
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_INVALID_PARAMETER

References EphemeralEntryID::DisplayType, EphemeralEntryID::ID_type, EphemeralEntryID::MId, EphemeralEntryID::ProviderUID, EphemeralEntryID::R1, EphemeralEntryID::R2, EphemeralEntryID::R3, and EphemeralEntryID::R4.

Referenced by emsabp_query().

enum MAPISTATUS emsabp_fetch_attrs ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
struct PropertyRow_r *  aRow,
uint32_t  MId,
uint32_t  dwFlags,
struct SPropTagArray *  pPropTags 
)

Builds the SRow array entry for the specified MId.

The function retrieves the DN associated to the specified MId within its on-memory TDB database. It next fetches the LDB record matching the DN and finally retrieve the requested properties for this record.

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
aRowpointer to the SRow structure where results will be stored
MIdMId to fetch properties for
dwFlagsbit flags specifying whether or not the server must return the values of the property PidTagEntryId in the Ephemeral or Permanent Entry ID format
pPropTagspointer to the property tags array
Note
We currently assume records are users.ldb
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References emsabp_query(), emsabp_tdb_fetch_dn_from_MId(), emsabp_context::mem_ctx, emsabp_context::samdb_ctx, emsabp_context::tdb_ctx, and emsabp_context::ttdb_ctx.

Referenced by dcesrv_NspiGetMatches(), dcesrv_NspiGetProps(), dcesrv_NspiQueryRows(), and dcesrv_NspiSeekEntries().

enum MAPISTATUS emsabp_fetch_attrs_from_msg ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
struct PropertyRow_r *  aRow,
struct ldb_message *  ldb_msg,
uint32_t  MId,
uint32_t  dwFlags,
struct SPropTagArray *  pPropTags 
)

Build the SRow array entry for the specified ldb_message.

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
aRowpointer to the SRow structure where results will be stored
ldb_msgldb_message record to fetch results from
MIdMId of the entry to fetch (may be 0)
dwFlagsinput call flags (default to 0)
pPropTagspointer to the property tags array
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References emsabp_query(), emsabp_tdb_fetch_MId(), emsabp_tdb_insert(), and emsabp_context::ttdb_ctx.

Referenced by dcesrv_NspiQueryRows(), dcesrv_NspiResolveNames(), and dcesrv_NspiResolveNamesW().

enum MAPISTATUS emsabp_get_account_info ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
const char *  username,
struct ldb_message **  ldb_msg 
)

Get AD record for Mail-enabled account

Parameters
mem_ctxpointer to the session context
emsabp_ctxpointer to the EMSABP context
usernameUser common name
ldb_msgPointer on pointer to ldb_message to return result to
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_ENOUGH_RESOURCES, MAPI_E_NOT_FOUND or MAPI_E_CORRUPT_STORE

References emsabp_context::samdb_ctx.

Referenced by emsabp_verify_user().

enum MAPISTATUS emsabp_get_CreationTemplatesTable ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
uint32_t  dwFlags,
struct PropertyRowSet_r **  SRowSet 
)

Retrieve and build the CreationTemplates Table requested by GetSpecialTable NSPI call

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
dwFlagsflags controlling whether strings should be UNICODE or not
SRowSetpointer on pointer to the output SRowSet array
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_CORRUPT_STORE

Referenced by dcesrv_NspiGetSpecialTable().

enum MAPISTATUS emsabp_get_HierarchyTable ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
uint32_t  dwFlags,
struct PropertyRowSet_r **  SRowSet 
)

Retrieve and build the HierarchyTable requested by GetSpecialTable NSPI call

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
dwFlagsflags controlling whether strings should be UNICODE or not
SRowSetpointer on pointer to the output SRowSet array
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_CORRUPT_STORE

References PermanentEntryID::dn, emsabp_set_PermanentEntryID(), emsabp_table_fetch_attrs(), emsabp_context::mem_ctx, and emsabp_context::samdb_ctx.

Referenced by dcesrv_NspiGetSpecialTable().

struct emsabp_context* emsabp_init ( struct loadparm_context *  lp_ctx,
TDB_CONTEXT *  tdb_ctx 
)

Initialize the EMSABP context and open connections to Samba databases.

Parameters
lp_ctxpointer to the loadparm context
tdb_ctxpointer to the EMSABP TDB context
Returns
Allocated emsabp_context on success, otherwise NULL

References emsabp_tdb_init_tmp(), emsabp_context::lp_ctx, emsabp_context::mem_ctx, samdb_connect(), emsabp_context::samdb_ctx, emsabp_context::tdb_ctx, and emsabp_context::ttdb_ctx.

Referenced by dcesrv_NspiBind().

enum MAPISTATUS emsabp_PermanentEntryID_to_Binary_r ( TALLOC_CTX *  mem_ctx,
struct PermanentEntryID permEntryID,
struct Binary_r *  bin 
)

Map a PermanentEntryID structure into a Binary_r structure (for PR_ENTRYID and PR_EMS_AB_PARENT_ENTRYID properties)

Parameters
mem_ctxpointer to the memory context
permEntryIDpointer to the Permanent EntryID structure
binpointer to the Binary_r structure the server will return
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_INVALID_PARAMETER

References PermanentEntryID::DisplayType, PermanentEntryID::dn, PermanentEntryID::ID_type, PermanentEntryID::ProviderUID, PermanentEntryID::R1, PermanentEntryID::R2, PermanentEntryID::R3, and PermanentEntryID::R4.

Referenced by emsabp_query(), and emsabp_table_fetch_attrs().

const char* emsabp_property_get_attribute ( uint32_t  ulPropTag)

Return the AD attribute name associated to a property tag

Parameters
ulPropTagthe property tag to lookup
Returns
valid pointer to the attribute name on success, otherwise NULL

Referenced by emsabp_query(), and emsabp_search().

const char* emsabp_property_get_ref_attr ( uint32_t  ulPropTag)

Returns the reference attr for a given attribute

Parameters
ulPropTagproperty tag to lookup
Returns
pointer to a valid reference attribute on success, otherwise NULL

Referenced by emsabp_query().

uint32_t emsabp_property_get_ulPropTag ( const char *  attribute)

Return the property tag associated to AD attribute name

Parameters
attributethe AD attribute name to lookup
Returns
property tag value on success, otherwise PT_ERROR
int emsabp_property_is_ref ( uint32_t  ulPropTag)

Returns whether the given attribute's value references another AD record

Parameters
ulPropTagthe property tag to lookup
Returns
1 if the attribute is a reference, 0 if not and -1 if an error occurred.

Referenced by emsabp_query().

void* emsabp_query ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
struct ldb_message *  msg,
uint32_t  ulPropTag,
uint32_t  MId,
uint32_t  dwFlags 
)

Find the attribute matching the specified property tag and return the associated data.

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
msgpointer to the LDB message
ulPropTagthe property tag to lookup
MIdMinimal Entry ID associated to the current message
dwFlagsbit flags specifying whether or not the server must return the values of the property PidTagEntryId in the Ephemeral or Permanent Entry ID format
Note
This implementation is at the moment limited to MAILUSER, which means we arbitrary set PR_OBJECT_TYPE and PR_DISPLAY_TYPE while we should have a generic method to fill these properties.
Returns
Valid generic pointer on success, otherwise NULL

References EMSABP_ADDRTYPE, emsabp_EphemeralEntryID_to_Binary_r(), emsabp_PermanentEntryID_to_Binary_r(), emsabp_property_get_attribute(), emsabp_property_get_ref_attr(), emsabp_property_is_ref(), emsabp_search_dn(), emsabp_set_EphemeralEntryID(), and emsabp_set_PermanentEntryID().

Referenced by emsabp_fetch_attrs(), and emsabp_fetch_attrs_from_msg().

enum MAPISTATUS emsabp_search ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
struct PropertyTagArray_r *  MIds,
struct Restriction_r *  restriction,
struct STAT *  pStat,
uint32_t  limit 
)

Search Active Directory given input search criterias. The function associates for each records returned by the search a unique session Minimal Entry ID and a LDB message.

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
MIdspointer to the list of MIds the function returns
restrictionpointer to restriction rules to apply to the search
pStatpointer the STAT structure associated to the search
limitthe limit number of results the function can return
Note
SortTypePhoneticDisplayName sort type is currently not supported.
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References emsabp_property_get_attribute(), emsabp_tdb_fetch_MId(), emsabp_tdb_insert(), emsabp_tdb_lookup_MId(), emsabp_context::samdb_ctx, emsabp_context::tdb_ctx, and emsabp_context::ttdb_ctx.

Referenced by dcesrv_NspiGetMatches(), dcesrv_NspiSeekEntries(), and dcesrv_NspiUpdateStat().

enum MAPISTATUS emsabp_search_dn ( struct emsabp_context emsabp_ctx,
const char *  dn,
struct ldb_message **  ldb_res 
)

Search for a given DN within AD and return the associated LDB message.

Parameters
emsabp_ctxpointer to the EMSABP context
dnpointer to the DN string to search for
ldb_respointer on pointer to the LDB message returned by the function
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References emsabp_context::mem_ctx, and emsabp_context::samdb_ctx.

Referenced by emsabp_ab_container_by_id(), and emsabp_query().

enum MAPISTATUS emsabp_search_legacyExchangeDN ( struct emsabp_context emsabp_ctx,
const char *  legacyDN,
struct ldb_message **  ldb_res,
bool *  pbUseConfPartition 
)

Search for a given AD record given its legacyDN parameter and return the associated LDB message.

Parameters
emsabp_ctxpointer to the EMSABP context
legacyDNpointer to the legacyDN attribute value to lookup
ldb_respointer on pointer to the LDB message returned by the function
pbUseConfPartitionpointer on boolean specifying whether the legacyExchangeDN was retrieved from the Configuration parition or not
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References emsabp_context::mem_ctx, and emsabp_context::samdb_ctx.

Referenced by dcesrv_NspiDNToMId().

enum MAPISTATUS emsabp_set_EphemeralEntryID ( struct emsabp_context emsabp_ctx,
uint32_t  DisplayType,
uint32_t  MId,
struct EphemeralEntryID ephEntryID 
)

Build an EphemeralEntryID structure

Parameters
emsabp_ctxpointer to the EMSABP context
DisplayTypethe AB object display type
MIdthe MId value
ephEntryIDpointer to the EphemeralEntryID returned by the function
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_ENOUGH_RESOURCES or MAPI_E_CORRUPT_STORE

References EphemeralEntryID::DisplayType, EphemeralEntryID::ID_type, EphemeralEntryID::MId, EphemeralEntryID::ProviderUID, EphemeralEntryID::R1, EphemeralEntryID::R2, EphemeralEntryID::R3, EphemeralEntryID::R4, emsabp_context::samdb_ctx, and samdb_ntds_objectGUID().

Referenced by emsabp_query().

enum MAPISTATUS emsabp_set_PermanentEntryID ( struct emsabp_context emsabp_ctx,
uint32_t  DisplayType,
struct ldb_message *  msg,
struct PermanentEntryID permEntryID 
)

Build a PermanentEntryID structure

Parameters
emsabp_ctxpointer to the EMSABP context
DisplayTypethe AB object display type
msgpointer to the LDB message
permEntryIDpointer to the PermanentEntryID returned by the function
Note
This function only covers DT_CONTAINER AddressBook objects. It should be extended in the future to support more containers.
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_ENOUGH_RESOURCES or MAPI_E_CORRUPT_STORE

References PermanentEntryID::DisplayType, PermanentEntryID::dn, EMSABP_DN, GUID_NSPI, PermanentEntryID::ID_type, emsabp_context::mem_ctx, PermanentEntryID::ProviderUID, PermanentEntryID::R1, PermanentEntryID::R2, PermanentEntryID::R3, and PermanentEntryID::R4.

Referenced by emsabp_get_HierarchyTable(), and emsabp_query().

enum MAPISTATUS emsabp_table_fetch_attrs ( TALLOC_CTX *  mem_ctx,
struct emsabp_context emsabp_ctx,
struct PropertyRow_r *  aRow,
uint32_t  dwFlags,
struct PermanentEntryID permEntryID,
struct PermanentEntryID parentPermEntryID,
struct ldb_message *  msg,
bool  child 
)

Builds the SRow array entry for the specified table record.

Parameters
mem_ctxpointer to the memory context
emsabp_ctxpointer to the EMSABP context
aRowpointer to the SRow structure where results will be stored
dwFlagsflags controlling whether strings should be unicode encoded or not
permEntryIDpointer to the current record Permanent EntryID
parentPermEntryIDpointer to the parent record Permanent EntryID
msgpointer to the LDB message for current record
childboolean value specifying whether current record is root or child within containers hierarchy
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References AB_RECIPIENTS, AB_SUBCONTAINERS, AB_UNMODIFIABLE, emsabp_PermanentEntryID_to_Binary_r(), emsabp_tdb_fetch_MId(), emsabp_tdb_insert(), and emsabp_context::tdb_ctx.

Referenced by emsabp_get_HierarchyTable().

enum MAPISTATUS emsabp_tdb_close ( TDB_CONTEXT *  tdb_ctx)

Close EMSABP TDB database

Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_INVALID_PARAMETER
enum MAPISTATUS emsabp_tdb_fetch ( TDB_CONTEXT *  tdb_ctx,
const char *  keyname,
TDB_DATA *  result 
)

Fetch an element within a TDB database given its key

Parameters
tdb_ctxpointer to the EMSABP TDB context
keynamepointer to the TDB key to fetch
resultpointer on TDB results
Returns
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_FOUND

Referenced by emsabp_tdb_init(), and emsabp_tdb_insert().

enum MAPISTATUS emsabp_tdb_fetch_dn_from_MId ( TALLOC_CTX *  mem_ctx,
TDB_CONTEXT *  tdb_ctx,
uint32_t  MId,
char **  dn 
)

Traverse the EMSABP TDB and fetch the DN associated with the MId

Parameters
mem_ctxpointer to the memory context
tdb_ctxpointer to the EMSABP TDB context
MIdMID to search
dnpointer on pointer to the dn to return
Returns
MAPI_E_SUCCESS on success, otherwise false

References emsabp_MId::dn, emsabp_tdb_traverse_MId_DN(), and emsabp_MId::MId.

Referenced by emsabp_ab_container_by_id(), and emsabp_fetch_attrs().

enum MAPISTATUS emsabp_tdb_fetch_MId ( TDB_CONTEXT *  tdb_ctx,
const char *  keyname,
uint32_t *  MId 
)

Retrieve the Minimal EntryID associated to a given DN

Parameters
tdb_ctxpointer to the EMSABP TDB context
keynamepointer to the TDB key to search for
MIdpointer on the integer the function returns
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

Referenced by dcesrv_NspiDNToMId(), emsabp_fetch_attrs_from_msg(), emsabp_search(), and emsabp_table_fetch_attrs().

TDB_CONTEXT* emsabp_tdb_init ( TALLOC_CTX *  mem_ctx,
struct loadparm_context *  lp_ctx 
)

Open EMSABP TDB database

Parameters
mem_ctxpointer to the memory context
lp_ctxpointer to the loadparm context
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References EMSABP_TDB_DATA_REC, emsabp_tdb_fetch(), EMSABP_TDB_MID_START, and mapiproxy_server_emsabp_tdb_init().

Referenced by dcesrv_exchange_nsp_init().

TDB_CONTEXT* emsabp_tdb_init_tmp ( TALLOC_CTX *  mem_ctx)

Initialize a temporary (on-memory) TDB database. This database is used to store temporary MId used within a session lifetime.

Parameters
mem_ctxpointer to the memory context
Returns
Allocated TDB context on success, otherwise NULL

References EMSABP_TDB_DATA_REC, and EMSABP_TDB_TMP_MID_START.

Referenced by emsabp_init().

enum MAPISTATUS emsabp_tdb_insert ( TDB_CONTEXT *  tdb_ctx,
const char *  keyname 
)

Insert an element into TDB database

Parameters
tdb_ctxpointer to the EMSABP TDB context
keynamepointer to the TDB key name string
Returns
MAPI_E_SUCCESS on success, otherwise MAPI error

References EMSABP_TDB_DATA_REC, and emsabp_tdb_fetch().

Referenced by dcesrv_NspiDNToMId(), emsabp_fetch_attrs_from_msg(), emsabp_search(), and emsabp_table_fetch_attrs().

bool emsabp_tdb_lookup_MId ( TDB_CONTEXT *  tdb_ctx,
uint32_t  MId 
)

Traverse the EMSABP TDB database and look for the input MId

Parameters
tdb_ctxpointer to the EMSABP TDB context
MIdMID to lookup
Returns
true on success, otherwise false

References emsabp_tdb_traverse_MId().

Referenced by dcesrv_NspiGetProps(), dcesrv_NspiQueryRows(), dcesrv_NspiSeekEntries(), dcesrv_NspiUpdateStat(), and emsabp_search().

bool emsabp_verify_codepage ( struct emsabp_context emsabp_ctx,
uint32_t  CodePage 
)

Check if the provided codepage is correct

Parameters
emsabp_ctxpointer to the EMSABP context
CodePagethe codepage identifier
Note
The prototype is currently incorrect, but we are looking for a better way to check codepage, maybe within AD. At the moment this function is just a wrapper over libmapi valid_codepage function.
Returns
true on success, otherwise false

Referenced by dcesrv_NspiBind().

bool emsabp_verify_lcid ( struct emsabp_context ,
uint32_t   
)
bool emsabp_verify_user ( struct dcesrv_call_state *  dce_call,
struct emsabp_context emsabp_ctx 
)

Check if the authenticated user belongs to the Exchange organization

Parameters
dce_callpointer to the session context
emsabp_ctxpointer to the EMSABP context
Returns
true on success, otherwise false

References emsabp_context::account_name, emsabp_get_account_info(), and emsabp_context::mem_ctx.

Referenced by dcesrv_NspiBind().

__BEGIN_DECLS NTSTATUS samba_init_module ( void  )

Register mapiproxy dynamic shared object modules

This function registers mapiproxy modules located

Entry point of mapiproxy dynamic shared object.

This function first registers exchange endpoints and ndr tables, then attempts to register the mapiproxy interface.

Returns
NT_STATUS_OK on success, otherwise NT_STATUS_UNSUCCESSFUL;

Entry point for the pack mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the cache mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the downgrade mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Register mapiproxy dynamic shared object modules

This function registers mapiproxy modules located

Entry point of mapiproxy dynamic shared object.

This function first registers exchange endpoints and ndr tables, then attempts to register the mapiproxy interface.

Returns
NT_STATUS_OK on success, otherwise NT_STATUS_UNSUCCESSFUL;

Entry point for the pack mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the cache mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the downgrade mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the pack mapiproxy module

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the default OpenChange EMSMDB server

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the default OpenChange NSPI server

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error

Entry point for the default OpenChange RFR server

Returns
NT_STATUS_OK on success, otherwise NTSTATUS error
struct ldb_context* samdb_connect ( TALLOC_CTX *  ,
struct tevent_context *  ,
struct loadparm_context *  ,
struct auth_session_info *  ,
int   
)
struct GUID* samdb_ntds_objectGUID ( struct ldb_context *  )

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/