From 9fee41911f8d8b44327231d589f009e774d6525b Mon Sep 17 00:00:00 2001 From: wsourdeau Date: Thu, 10 Mar 2011 21:25:37 +0000 Subject: [PATCH] moved and renamed "dcesrv_uuid_matches" from nspi module to libmapiproxy as "mpm_uuid_cmp" git-svn-id: https://svn.openchange.org/openchange@2733 71d39326-ef09-db11-b2a4-00e04c779ad1 --- .../libmapiproxy/dcesrv_mapiproxy_session.c | 23 ++++++++++++++++++ .../mapiproxy/libmapiproxy/libmapiproxy.h | 1 + .../default/nspi/dcesrv_exchange_nsp.c | 24 +------------------ 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/branches/sogo/mapiproxy/libmapiproxy/dcesrv_mapiproxy_session.c b/branches/sogo/mapiproxy/libmapiproxy/dcesrv_mapiproxy_session.c index ca44d7d4..ba264483 100644 --- a/branches/sogo/mapiproxy/libmapiproxy/dcesrv_mapiproxy_session.c +++ b/branches/sogo/mapiproxy/libmapiproxy/dcesrv_mapiproxy_session.c @@ -215,3 +215,26 @@ bool mpm_session_cmp(struct mpm_session *session, return mpm_session_cmp_sub(session, dce_call->conn->server_id, dce_call->context->context_id); } + +/** + \details Helper to compare two session unique identifiers + + \param uuid1 a uuid + \param uuid2 another uuid + + \return true on success, otherwise false + */ +bool mpm_uuid_cmp(const struct GUID *uuid1, const struct GUID *uuid2) +{ + bool rc; + + rc = (uuid1 == uuid2 + || ((uuid1 != NULL) && (uuid2 != NULL) + && (uuid1->time_low == uuid2->time_low) + && (uuid1->time_mid == uuid2->time_mid) + && (uuid1->time_hi_and_version == uuid2->time_hi_and_version) + && (memcmp(uuid1->clock_seq, uuid2->clock_seq, 2) == 0) + && (memcmp(uuid1->node, uuid2->node, 6) == 0))); + + return rc; +} diff --git a/branches/sogo/mapiproxy/libmapiproxy/libmapiproxy.h b/branches/sogo/mapiproxy/libmapiproxy/libmapiproxy.h index 99874d3f..27ac0758 100644 --- a/branches/sogo/mapiproxy/libmapiproxy/libmapiproxy.h +++ b/branches/sogo/mapiproxy/libmapiproxy/libmapiproxy.h @@ -198,6 +198,7 @@ bool mpm_session_set_private_data(struct mpm_session *, void *); bool mpm_session_release(struct mpm_session *); bool mpm_session_cmp_sub(struct mpm_session *, struct server_id, uint32_t); bool mpm_session_cmp(struct mpm_session *, struct dcesrv_call_state *); +bool mpm_uuid_cmp(const struct GUID *, const struct GUID *); /* definitions from openchangedb.c */ enum MAPISTATUS openchangedb_get_new_folderID(void *, uint64_t *); diff --git a/branches/sogo/mapiproxy/servers/default/nspi/dcesrv_exchange_nsp.c b/branches/sogo/mapiproxy/servers/default/nspi/dcesrv_exchange_nsp.c index a936ddcb..6f0ec1aa 100644 --- a/branches/sogo/mapiproxy/servers/default/nspi/dcesrv_exchange_nsp.c +++ b/branches/sogo/mapiproxy/servers/default/nspi/dcesrv_exchange_nsp.c @@ -31,34 +31,12 @@ static struct exchange_nsp_session *nsp_session = NULL; static TDB_CONTEXT *emsabp_tdb_ctx = NULL; -static bool dcesrv_uuid_matches(const struct GUID *uuid1, const struct GUID *uuid2) -{ - bool rc; - /* void *mem_ctx; */ - - rc = (uuid1 == uuid2 - || ((uuid1 != NULL) && (uuid2 != NULL) - && (uuid1->time_low == uuid2->time_low) - && (uuid1->time_mid == uuid2->time_mid) - && (uuid1->time_hi_and_version == uuid2->time_hi_and_version) - && (strncmp((const char *) uuid1->clock_seq, (const char *) uuid2->clock_seq, 2) == 0) - && (strncmp((const char *) uuid1->node, (const char *) uuid2->node, 6) == 0))); - - /* mem_ctx = talloc_zero_size(NULL, 0); */ - /* DEBUG(5, ("dcesrv_uuid_matches: uuids %s and %s %s\n", */ - /* GUID_string(mem_ctx, uuid1), GUID_string(mem_ctx, uuid2), */ - /* rc ? "match" : "do not match")); */ - /* talloc_free(mem_ctx); */ - - return rc; -} - static struct exchange_nsp_session *dcesrv_find_nsp_session(struct GUID *uuid) { struct exchange_nsp_session *session, *found_session = NULL; for (session = nsp_session; !found_session && session; session = session->next) { - if (dcesrv_uuid_matches(uuid, &session->uuid)) { + if (mpm_uuid_cmp(uuid, &session->uuid)) { found_session = session; } } -- 2.34.1