94
94
if (!p) return NULL;
95
95
if (!cred) return NULL;
96
96
if (!return_value) return NULL;
97
if (!session->profile->mailbox) return NULL;
98
mem_ctx = talloc_named(NULL, 0, "emsmdb_connect");
99
mem_ctx = talloc_named(parent_mem_ctx, 0, "emsmdb_connect");
100
101
ret = talloc_zero(parent_mem_ctx, struct emsmdb_context);
101
102
ret->rpc_connection = p;
188
189
if (!cred) return NULL;
189
190
if (!return_value) return NULL;
191
tmp_ctx = talloc_named(NULL, 0, "emsmdb_connect_ex");
192
tmp_ctx = talloc_named(mem_ctx, 0, "emsmdb_connect_ex");
193
194
ctx = talloc_zero(mem_ctx, struct emsmdb_context);
194
195
ctx->rpc_connection = p;
680
681
\param session Pointer to the current MAPI session
681
682
\param notifkey The opaque client-generated context data
682
\param ulEventMask Notification flags. Exchange completely ignores
683
this value and it should be set to 0
685
684
\return NTSTATUS_OK on success, otherwise NT status error
687
686
NTSTATUS emsmdb_register_notification(struct mapi_session *session,
688
struct NOTIFKEY *notifkey,
689
uint16_t ulEventMask)
687
struct NOTIFKEY *notifkey)
691
689
struct EcRRegisterPushNotification request;
703
701
emsmdb_ctx = (struct emsmdb_context *)session->emsmdb->ctx;
704
702
notify_ctx = (struct mapi_notify_ctx *)session->notify_ctx;
705
mem_ctx = talloc_named(NULL, 0, "emsmdb_register_notification");
703
mem_ctx = talloc_named(session, 0, "emsmdb_register_notification");
707
705
request.in.handle = &emsmdb_ctx->handle;
708
request.in.ulEventMask = ulEventMask;
706
request.in.iRpc = 0x0;
709
707
request.in.cbContext = notifkey->cb;
710
708
request.in.rgbContext = talloc_array(mem_ctx, uint8_t, request.in.cbContext);
711
709
memcpy(request.in.rgbContext, notifkey->ab, request.in.cbContext);
712
710
request.in.grbitAdviseBits = 0xffffffff;
713
request.in.rgCallbackAddress = talloc_array(mem_ctx, uint8_t, sizeof (struct sockaddr));
711
request.in.rgbCallbackAddress = talloc_array(mem_ctx, uint8_t, sizeof (struct sockaddr));
714
712
/* cp address family and length */
715
request.in.rgCallbackAddress[0] = (notify_ctx->addr->sa_family & 0xFF);
716
request.in.rgCallbackAddress[1] = (notify_ctx->addr->sa_family & 0xFF00) >> 8;
717
memcpy(&request.in.rgCallbackAddress[2], notify_ctx->addr->sa_data, 14);
713
request.in.rgbCallbackAddress[0] = (notify_ctx->addr->sa_family & 0xFF);
714
request.in.rgbCallbackAddress[1] = (notify_ctx->addr->sa_family & 0xFF00) >> 8;
715
memcpy(&request.in.rgbCallbackAddress[2], notify_ctx->addr->sa_data, 14);
718
716
request.in.cbCallbackAddress = sizeof (struct sockaddr);
720
718
request.out.handle = &handle;
723
721
status = dcerpc_EcRRegisterPushNotification_r(emsmdb_ctx->rpc_connection->binding_handle, emsmdb_ctx->mem_ctx, &request);
724
722
retval = request.out.result;
725
723
if (!NT_STATUS_IS_OK(status) || retval) {
726
talloc_free(mem_ctx);
724
status = NT_STATUS_RPC_CALL_FAILED;
730
727
talloc_free(mem_ctx);
787
784
\details Retrieves a property value from a DATA blob
789
786
\param mem_ctx pointer to the memory context
790
\param lp_ctx pointer to the loadparm context
791
787
\param offset pointer on pointer to the current offset
792
788
\param tag the property tag which value is to be retrieved
793
789
\param data pointer to the data
795
791
\return pointer on constant generic data on success, otherwise NULL
797
793
const void *pull_emsmdb_property(TALLOC_CTX *mem_ctx,
798
struct loadparm_context *lp_ctx,
799
794
uint32_t *offset,
800
795
enum MAPITAGS tag,
814
809
struct Binary_r *sbin = NULL;
815
810
struct mapi_SLPSTRArray pt_slpstr;
816
811
struct StringArray_r *slpstr = NULL;
812
struct mapi_SLPSTRArrayW pt_slpstrw;
813
struct StringArrayW_r *slpstrw = NULL;
817
814
struct mapi_MV_LONG_STRUCT pt_MVl;
818
815
struct LongArray_r *MVl = NULL;
819
816
struct mapi_SBinaryArray pt_MVbin;
914
911
talloc_free(ndr);
915
912
return (const void *) slpstr;
914
ndr_pull_mapi_SLPSTRArrayW(ndr, NDR_SCALARS, &pt_slpstrw);
915
*offset = ndr->offset;
916
slpstrw = talloc_zero(mem_ctx, struct StringArrayW_r);
917
slpstrw->cValues = pt_slpstrw.cValues;
918
slpstrw->lppszW = talloc_array(mem_ctx, const char *, pt_slpstrw.cValues);
919
for (i = 0; i < slpstrw->cValues; i++) {
920
slpstrw->lppszW[i] = talloc_strdup(mem_ctx, pt_slpstrw.strings[i].lppszW);
923
return (const void *) slpstrw;
916
924
case PT_MV_BINARY:
917
925
ndr_pull_mapi_SBinaryArray(ndr, NDR_SCALARS, &pt_MVbin);
918
926
*offset = ndr->offset;
937
945
\details Get a SPropValue array from a DATA blob
939
947
\param mem_ctx pointer to the memory context
940
\param lp_ctx pointer to the loadparm context
941
948
\param content pointer to the DATA blob content
942
949
\param tags pointer to a list of property tags to lookup
943
950
\param propvals pointer on pointer to the returned SPropValues
947
954
\return MAPI_E_SUCCESS on success
949
956
enum MAPISTATUS emsmdb_get_SPropValue(TALLOC_CTX *mem_ctx,
950
struct loadparm_context *lp_ctx,
951
957
DATA_BLOB *content,
952
958
struct SPropTagArray *tags,
953
959
struct SPropValue **propvals,
978
984
offset += sizeof (uint8_t);
981
data = pull_emsmdb_property(mem_ctx, lp_ctx, &offset, tags->aulPropTag[i_tag], content);
987
data = pull_emsmdb_property(mem_ctx, &offset, tags->aulPropTag[i_tag], content);
983
989
data = talloc_steal(*propvals, data);
984
990
p_propval = &((*propvals)[i_propval]);
1001
1007
\details Get a SRowSet from a DATA blob
1003
1009
\param mem_ctx pointer on the memory context
1004
\param lp_ctx pointer on the loadparm context
1005
1010
\param rowset pointer on the returned SRowSe
1006
1011
\param proptags pointer on a list of property tags to lookup
1007
1012
\param content pointer on the DATA blob content
1012
1017
FlaggedPropertyValueWithTypeSpecified variants
1014
1019
_PUBLIC_ void emsmdb_get_SRowSet(TALLOC_CTX *mem_ctx,
1015
struct loadparm_context *lp_ctx,
1016
1020
struct SRowSet *rowset,
1017
1021
struct SPropTagArray *proptags,
1018
1022
DATA_BLOB *content)
1072
1076
if (havePropertyValue) {
1073
1077
lpProps[prop].dwAlignPad = 0x0;
1074
data = pull_emsmdb_property(mem_ctx, lp_ctx, &offset, lpProps[prop].ulPropTag, content);
1078
data = pull_emsmdb_property(mem_ctx, &offset, lpProps[prop].ulPropTag, content);
1075
1079
talloc_steal(lpProps, data);
1076
1080
set_SPropValue(&lpProps[prop], data);
1077
1081
free_emsmdb_property(&lpProps[prop], (void *) data);
1089
1093
\details Get a SRow from a DATA blob
1091
1095
\param mem_ctx pointer on the memory context
1092
\param lp_ctx pointer on the loadparm context
1093
1096
\param aRow pointer on the returned SRow
1094
1097
\param proptags pointer on a list of property tags to lookup
1095
1098
\param propcount number of SPropValue entries in aRow
1102
1105
\note TODO: We shouldn't have any alignment pad here
1104
1107
void emsmdb_get_SRow(TALLOC_CTX *mem_ctx,
1105
struct loadparm_context *lp_ctx,
1106
1108
struct SRow *aRow,
1107
1109
struct SPropTagArray *proptags,
1108
1110
uint16_t propcount,
1131
1133
offset += align;
1134
data = pull_emsmdb_property(mem_ctx, lp_ctx, &offset, aulPropTag, content);
1136
data = pull_emsmdb_property(mem_ctx, &offset, aulPropTag, content);
1135
1137
talloc_steal(aRow->lpProps, data);
1136
1138
aRow->lpProps[i].ulPropTag = aulPropTag;
1137
1139
aRow->lpProps[i].dwAlignPad = 0x0;