OpenChange NSPI Server implementation. More...
#include "mapiproxy/dcesrv_mapiproxy.h"
#include "mapiproxy/libmapiproxy/fault_util.h"
#include "dcesrv_exchange_nsp.h"
Functions | |
static void | dcesrv_do_NspiQueryRows (TALLOC_CTX *mem_ctx, struct NspiQueryRows *r, struct emsabp_context *emsabp_ctx, struct PropertyTagArray_r *mids, bool updateStat) |
static void | dcesrv_do_NspiResolveNamesW (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiResolveNamesW *r) |
static void | dcesrv_do_NspiUpdateStat (struct NspiUpdateStat *r, struct PropertyTagArray_r *mids) |
static NTSTATUS | dcesrv_exchange_nsp_dispatch (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, struct mapiproxy *mapiproxy) |
static NTSTATUS | dcesrv_exchange_nsp_init (struct dcesrv_context *dce_ctx) |
static NTSTATUS | dcesrv_exchange_nsp_unbind (struct server_id server_id, uint32_t context_id) |
static struct emsabp_context * | dcesrv_find_emsabp_context (struct GUID *uuid) |
static struct exchange_nsp_session * | dcesrv_find_nsp_session (struct GUID *uuid) |
static void | dcesrv_make_ptyp_error_property_row (TALLOC_CTX *mem_ctx, struct SPropTagArray *pPropTags, struct PropertyRow_r *aRow) |
Make PropertyRow record with empty value and PT_ERROR flag for PropTag. | |
static void | dcesrv_NspiBind (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiBind *r) |
static void | dcesrv_NspiCompareMIds (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiCompareMIds *r) |
static void | dcesrv_NspiDeleteEntries (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiDeleteEntries *r) |
static void | dcesrv_NspiDNToMId (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiDNToMId *r) |
static void | dcesrv_NspiGetIDsFromNames (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetIDsFromNames *r) |
static void | dcesrv_NspiGetMatches (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetMatches *r) |
static void | dcesrv_NspiGetNamesFromIDs (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetNamesFromIDs *r) |
static void | dcesrv_NspiGetPropList (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetPropList *r) |
static void | dcesrv_NspiGetProps (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetProps *r) |
static void | dcesrv_NspiGetSpecialTable (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetSpecialTable *r) |
static void | dcesrv_NspiGetTemplateInfo (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiGetTemplateInfo *r) |
static void | dcesrv_NspiModLinkAtt (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiModLinkAtt *r) |
static void | dcesrv_NspiModProps (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiModProps *r) |
static void | dcesrv_NspiQueryColumns (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiQueryColumns *r) |
static void | dcesrv_NspiQueryRows (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiQueryRows *r) |
static void | dcesrv_NspiResolveNames (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiResolveNames *r) |
static void | dcesrv_NspiResolveNamesW (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiResolveNamesW *r) |
static void | dcesrv_NspiResortRestriction (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiResortRestriction *r) |
static void | dcesrv_NspiSeekEntries (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiSeekEntries *r) |
static void | dcesrv_NspiUnbind (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiUnbind *r) |
static void | dcesrv_NspiUpdateStat (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct NspiUpdateStat *r) |
static void | position_in_table (struct STAT *pStat, struct PropertyTagArray_r *mids, uint32_t *out_row, uint32_t *out_last_row) |
NTSTATUS | samba_init_module (void) |
Variables | |
static TDB_CONTEXT * | emsabp_tdb_ctx = NULL |
static struct exchange_nsp_session * | nsp_session = NULL |
OpenChange NSPI Server implementation.
|
static |
This method does the main work of NspiQueryRows. It is separated from dcesrv_NspiQueryRows to be called from NspiSeekEntries to get the rows. Aslo is called from NspiQueryRows itself to avoid duplication.
mem_ctx | pointer to the memory context | |
[in,out] | r | pointer to the NspiQueryRows request data |
emsabp_ctx | pointer to the emsabp context | |
mids | pointer to struct PropertyTagArray_r which contains the table as MIDs array | |
updateStat | update the out stat struct inside the NspiQueryRows request data. The update is not necessary when called from NspiSeekEntries |
References dcesrv_do_NspiUpdateStat(), dcesrv_make_ptyp_error_property_row(), DCESRV_NSP_RETURN, emsabp_ab_container_enum(), emsabp_fetch_attrs(), emsabp_fetch_attrs_from_msg(), emsabp_tdb_lookup_MId(), position_in_table(), and emsabp_context::tdb_ctx.
Referenced by dcesrv_NspiQueryRows(), and dcesrv_NspiSeekEntries().
|
static |
common code called by NspiResolveNames and NspiResolveNamesW functions NspiResolveNames should before copy the values of its struct NspiResolveNames to a NspiResolveNamesW struct since const char* is used to both 8-bits and Unicode strings it could be done without problems.
The ANR implementation in this function does a search of fields values beginning with the search string. A possible enhancement would be to trim superfluous spaces and/or split the search string by spaces so the order of the elements would not be important.
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiResolveNamesW request data |
References dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_ab_fetch_filter(), emsabp_fetch_attrs_from_msg(), emsabp_tdb_lookup_MId(), emsabp_context::samdb_ctx, and emsabp_context::tdb_ctx.
Referenced by dcesrv_NspiResolveNames(), and dcesrv_NspiResolveNamesW().
|
static |
This method does the main work of NspiUpdateStat. It is separated from dcesrv_NspiUpdateStat to be called from NspiQueryRows to update correctly the pStat struct. Also is called from NspiUpdateStat to avoid repeating code.
[in,out] | r | pointer to the NspiUpdateStat request data |
mids | pointer to struct PropertyTagArray_r which contains the table as MIDs array |
References DCESRV_NSP_RETURN, and position_in_table().
Referenced by dcesrv_do_NspiQueryRows(), and dcesrv_NspiUpdateStat().
|
static |
Dispatch incoming NSPI call to the correct OpenChange server function.
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | generic pointer on NSPI data |
mapiproxy | pointer to the mapiproxy structure controlling mapiproxy behavior |
References dcesrv_NspiBind(), dcesrv_NspiCompareMIds(), dcesrv_NspiDeleteEntries(), dcesrv_NspiDNToMId(), dcesrv_NspiGetIDsFromNames(), dcesrv_NspiGetMatches(), dcesrv_NspiGetNamesFromIDs(), dcesrv_NspiGetPropList(), dcesrv_NspiGetProps(), dcesrv_NspiGetSpecialTable(), dcesrv_NspiGetTemplateInfo(), dcesrv_NspiModLinkAtt(), dcesrv_NspiModProps(), dcesrv_NspiQueryColumns(), dcesrv_NspiQueryRows(), dcesrv_NspiResolveNames(), dcesrv_NspiResolveNamesW(), dcesrv_NspiResortRestriction(), dcesrv_NspiSeekEntries(), dcesrv_NspiUnbind(), and dcesrv_NspiUpdateStat().
Referenced by samba_init_module().
|
static |
Initialize the NSPI OpenChange server
dce_ctx | pointer to the server context |
References emsabp_tdb_ctx, emsabp_tdb_init(), nsp_session, and OC_PANIC.
Referenced by samba_init_module().
|
static |
Terminates the NSPI connection and release the associated session and context if still available. This case occurs when the client doesn't call NspiUnbind but quit unexpectedly.
server_id | reference to the server identifier structure |
context_id | the connection context identifier |
Referenced by samba_init_module().
|
static |
References dcesrv_find_nsp_session(), mpm_session::private_data, and exchange_nsp_session::session.
Referenced by dcesrv_do_NspiResolveNamesW(), dcesrv_NspiDNToMId(), dcesrv_NspiGetMatches(), dcesrv_NspiGetProps(), dcesrv_NspiGetSpecialTable(), dcesrv_NspiQueryRows(), dcesrv_NspiSeekEntries(), and dcesrv_NspiUpdateStat().
|
static |
References nsp_session, exchange_nsp_session::session, and exchange_nsp_session::uuid.
Referenced by dcesrv_find_emsabp_context(), dcesrv_NspiBind(), and dcesrv_NspiUnbind().
|
static |
Make PropertyRow record with empty value and PT_ERROR flag for PropTag.
We should return such rows when client requests an MId we can't find.
References emsabp_context::mem_ctx.
Referenced by dcesrv_do_NspiQueryRows(), and dcesrv_NspiGetProps().
|
static |
exchange_nsp NspiBind (0x0) function, Initiates a NSPI session with the client.
This function checks if the user is an Exchange user and input parameters like codepage are valid. If it passes the tests, the function initializes an emsabp context and returns to the client a valid policy_handle and expected reply parameters.
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiBind call structure |
References dcesrv_find_nsp_session(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_destructor(), emsabp_enable_debug(), emsabp_init(), emsabp_tdb_ctx, emsabp_verify_codepage(), emsabp_verify_user(), EXCHANGE_HANDLE_NSP, mpm_session_increment_ref_count(), mpm_session_init(), mpm_session_set_destructor(), mpm_session_set_private_data(), nsp_session, OC_PANIC, emsabp_context::samdb_ctx, samdb_ntds_objectGUID(), exchange_nsp_session::session, and exchange_nsp_session::uuid.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiCompareMIds (0xA) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiCompareMIds request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiDeleteEntries (0xF) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiDeleteEntries request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiDNToMId (0x7) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiDNToMId request data |
References dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_search_legacyExchangeDN(), emsabp_tdb_fetch_MId(), emsabp_tdb_insert(), emsabp_context::tdb_ctx, and emsabp_context::ttdb_ctx.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetIDsFromNames (0x12) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetIDsFromNames request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetMatches (0x5) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetMatches request data |
References dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_fetch_attrs(), and emsabp_search().
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetNamesFromIDs (0x11) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetNamesFromIDs request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetPropList (0x8) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetPropList request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetProps (0x9) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetProps request data |
References dcesrv_find_emsabp_context(), dcesrv_make_ptyp_error_property_row(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_fetch_attrs(), emsabp_tdb_lookup_MId(), and emsabp_context::tdb_ctx.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetSpecialTable (0xC) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetSpecialTable request data |
References dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_get_CreationTemplatesTable(), emsabp_get_HierarchyTable(), and emsabp_context::mem_ctx.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiGetTemplateInfo (0xD) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiGetTemplateInfo request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiModLinkAtt (0xE) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiModLinkAtt request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiModProps (0xB) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiModProps request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiQueryColumns (0x10) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiQueryColumns request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiQueryRows (0x3) function
dce_call | pointer to the session context | |
mem_ctx | pointer to the memory context | |
[in,out] | r | pointer to the NspiQueryRows request data |
References dcesrv_do_NspiQueryRows(), dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, and emsabp_search().
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiResolveNames (0x13) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiResolveNames request data |
References dcesrv_do_NspiResolveNamesW().
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiResolveNamesW (0x14) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiResolveNamesW request data |
References dcesrv_do_NspiResolveNamesW().
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiResortRestriction (0x6) function
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiResortRestriction request data |
References DCESRV_NSP_RETURN.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiSeekEntries (0x4) function
dce_call | pointer to the session context | |
mem_ctx | pointer to the memory context | |
[in,out] | r | pointer to the NspiSeekEntries request data |
References dcesrv_do_NspiQueryRows(), dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_search(), emsabp_tdb_lookup_MId(), and emsabp_context::tdb_ctx.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiUnbind (0x1) function, Terminates a NSPI session with the client
dce_call | pointer to the session context |
mem_ctx | pointer to the memory context |
r | pointer to the NspiUnbind call structure |
References dcesrv_find_nsp_session(), DCESRV_NSP_RETURN, mpm_session_release(), nsp_session, and exchange_nsp_session::session.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
exchange_nsp NspiUpdateStat (0x2) function
dce_call | pointer to the session context | |
mem_ctx | pointer to the memory context | |
[in,out] | r | pointer to the NspiUpdateStat request data |
References dcesrv_do_NspiUpdateStat(), dcesrv_find_emsabp_context(), DCESRV_NSP_RETURN, DCESRV_NSP_RETURN_IF, emsabp_search(), emsabp_tdb_lookup_MId(), and emsabp_context::tdb_ctx.
Referenced by dcesrv_exchange_nsp_dispatch().
|
static |
Get the current position and the last row position as defined by the pStat argument. In the case of an empty table it return 0 for both positions. The caller can discriminate between empty tables and one-row tables looking at the cValues of the PropertyTagArray_r
pStat | pointer to struct STAT which will be used to get the positions | |
mids | pointer to struct PropertyTagArray_r which contains the table as MIDs array | |
[out] | out_row | pointer to the uint32_t which will cotaint the current row |
[out] | out_last_row | pointer to the uint32_t which will cotaint the last row in table |
Referenced by dcesrv_do_NspiQueryRows(), and dcesrv_do_NspiUpdateStat().
NTSTATUS samba_init_module | ( | void | ) |
Entry point for the default OpenChange NSPI server
References dcesrv_exchange_nsp_dispatch(), dcesrv_exchange_nsp_init(), dcesrv_exchange_nsp_unbind(), mapiproxy_module::description, mapiproxy_module::dispatch, mapiproxy_module::endpoint, mapiproxy_module::init, MAPIPROXY_DEFAULT, mapiproxy_server_register(), mapiproxy_module::name, mapiproxy_module::ndr_pull, mapiproxy_module::pull, mapiproxy_module::push, mapiproxy_module::status, and mapiproxy_module::unbind.
|
static |
|
static |
Referenced by dcesrv_exchange_nsp_init(), dcesrv_find_nsp_session(), dcesrv_NspiBind(), and dcesrv_NspiUnbind().
![]() ![]() ![]() |
This content is licensed under the Creative Commons Attribution ShareAlike License v. 3.0: http://creativecommons.org/licenses/by-sa/3.0/ |