Skip to content

Commit 793e461

Browse files
committed
nsp: disable OneOff synthesis for non-existing GAL objects
When the NSPI ResolveNames RPC is called with an SMTP address for which there is no match in the Global Address List, NSP normally reports an "unresolvable" status, and the MAPI client-side addressbook root implementation will subsequently generate a OneOff entryid for the MAPI application with ten properties. (PR_ADDRTYPE, PR_DISPLAY_NAME, PR_DISPLAY_TYPE, PR_EMAIL_ADDRESS, PR_ENTRYID, PR_OBJECT_TYPE, PR_RECORD_KEY, PR_SEARCH_KEY, PR_SEND_INTERNET_ENCODING, PR_SEND_RICH_INFO) Our NSP instead report "resolved" and provided a fake contact with a OneOff entryid itself. This is the primary bug. As a result, the EMSMDB connector presents the contact to the MAPI application with 15 properties. (Above list plus PR_7BIT_DISPLAY_NAME, PR_AB_PROVIDERS, PR_DISPLAY_TYPE, PR_SMTP_ADDRESS, PR_TRANSMITTABLE_DISPLAY_NAME) Our NSP module does not send along PR_SMTP_ADDRESS in the ResolveNames response, which is the second bug. This patch temporarily adds a configuration directive to control the behavior of OneOff synthesis. Ultimately, synthesis should just be deleted completely because it is wrong. References: DESK-359
1 parent 7ef3ea0 commit 793e461

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

exch/nsp/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static DCERPC_ENDPOINT *ep_6001, *ep_6004;
4949
static constexpr cfg_directive nsp_cfg_defaults[] = {
5050
{"cache_interval", "5min", CFG_TIME, "1s", "1d"},
5151
{"hash_table_size", "3000", CFG_SIZE, "1"},
52+
{"nsp_synthesize_oneoff", "0", CFG_BOOL},
5253
{"nsp_trace", "0", CFG_BOOL},
5354
{"session_check", "1", CFG_BOOL},
5455
{"x500_org_name", "Gromox default"},
@@ -66,6 +67,7 @@ static bool exch_nsp_reload(std::shared_ptr<CONFIG_FILE> cfg)
6667
return false;
6768
}
6869
g_nsp_trace = cfg->get_ll("nsp_trace");
70+
g_nsp_synthesize_oneoff = cfg->get_ll("nsp_synthesize_oneoff");
6971
return true;
7072
}
7173

exch/nsp/nsp_interface.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ enum {
6363
TI_SCRIPT = 0x4,
6464
};
6565

66-
unsigned int g_nsp_trace;
66+
unsigned int g_nsp_trace, g_nsp_synthesize_oneoff;
6767
static BOOL g_session_check;
6868
static bool (*verify_cpid)(uint32_t cpid);
6969
static decltype(mysql_adaptor_get_domain_ids) *get_domain_ids;
@@ -2493,6 +2493,8 @@ static uint32_t nsp_interface_fetch_smtp_property(
24932493
break;
24942494
case PR_EMAIL_ADDRESS:
24952495
case PR_EMAIL_ADDRESS_A:
2496+
case PR_SMTP_ADDRESS:
2497+
case PR_SMTP_ADDRESS_A:
24962498
pprop->value.pv = ndr_stack_alloc(
24972499
NDR_STACK_OUT, strlen(paddress) + 1);
24982500
if (NULL == pprop->value.pstr) {
@@ -2658,7 +2660,8 @@ int nsp_interface_resolve_namesw(NSPI_HANDLE handle, uint32_t reserved,
26582660
if (NULL == pnode) {
26592661
if (b_ambiguous) {
26602662
*pproptag = MID_AMBIGUOUS;
2661-
} else if (strncasecmp(pstrs->ppstr[i], "=SMTP:", 6) == 0) {
2663+
} else if (g_nsp_synthesize_oneoff &&
2664+
strncasecmp(pstrs->ppstr[i], "=SMTP:", 6) == 0) {
26622665
prow = common_util_proprowset_enlarge(*pprows);
26632666
if (NULL == prow || NULL ==
26642667
common_util_propertyrow_init(prow)) {

exch/nsp/nsp_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ extern int nsp_interface_resolve_namesw(NSPI_HANDLE, uint32_t reserved, const ST
2828
/* clean NSPI_HANDLE by system, not operation of interface */
2929
void nsp_interface_unbind_rpc_handle(uint64_t hrpc);
3030

31-
extern unsigned int g_nsp_trace;
31+
extern unsigned int g_nsp_trace, g_nsp_synthesize_oneoff;

0 commit comments

Comments
 (0)