On Sunday 20 December 2009 01:00:53 Julien Kerihuel wrote:
> >     * OXCSTOR                            : OXCSTOR-GETSTORESTATE
> 
> [MS-OXCSTOR]: page 57
> <11> Section 2.2.1.5: Exchange 2010 does not support RopGetStoreState,
> but Exchange 2003 and Exchange 2007 do support it.
> 
> This explains the failure for this one. We need to add a Exchange
> detection mechanism and API for our mapitest unit tests.
We should be able to do this based on the server version, which is in
mt->info. However I think it was broken for some time (best guess - r729).

I have played around with this, and have a patch for testing - see attached.

Server versioning is given in MS-OXRPC, section 3.1.9, or just look at the 
mapitest_print.c part of the patch.

I couldn't find a list of versions, but best guess is that the low byte of
mt->info.rgwServerVersion[0] is the service pack, and the high byte is the 
feature version:
6 is Exchange 2003
8 is Exchange 2007
0xD (14) is Exchange 2010

So there are two choices - we can just disable the test using some flags in the 
suite / setup part, or we can add a special condition for that particular test 
(so it just returns a pass). The first would probably be more "honest", in that 
we're saying that the test isn't applicable, but messier to implement.

Brad
Index: libmapi/emsmdb.c
===================================================================
--- libmapi/emsmdb.c	(revision 1621)
+++ libmapi/emsmdb.c	(working copy)
@@ -139,6 +139,10 @@
 	ret->info.szDisplayName = talloc_strdup(parent_mem_ctx, r.out.szDisplayName);
 	ret->info.szDNPrefix = talloc_strdup(parent_mem_ctx, r.out.szDNPrefix);
 
+	ret->info.rgwServerVersion[0] = r.out.rgwServerVersion[0];
+	ret->info.rgwServerVersion[1] = r.out.rgwServerVersion[1];
+	ret->info.rgwServerVersion[2] = r.out.rgwServerVersion[2];
+
 	ret->cred = cred;
 	ret->max_data = 0xFFF0;
 	ret->setup = false;
Index: utils/mapitest/mapitest_print.c
===================================================================
--- utils/mapitest/mapitest_print.c	(revision 1621)
+++ utils/mapitest/mapitest_print.c	(working copy)
@@ -273,7 +273,40 @@
 	mapitest_deindent();
 }
 
+/**
+  \details Print out a normalized version number for a client or server.
+  
+  \param mt pointer to the top level mapitest structure
+  \param label label for the version (e.g. "Store Version" or "Client Version")
+  \param word0 highest order word for the version
+  \param word1 middle word for the version
+  \param word2 low word for the version
+*/
+static void mapitest_print_version_normalised(struct mapitest *mt, const char* label,
+					      const uint16_t word0, const uint16_t word1, const uint16_t word2)
+{
+	/* See MS-OXRPC Section 3.1.9 to understand this */
+	uint16_t normalisedword0;
+	uint16_t normalisedword1;
+	uint16_t normalisedword2;
+	uint16_t normalisedword3;
 
+	if (word1 & 0x8000) {
+		/* new format */
+		normalisedword0 = (word0 & 0xFF00) >> 8;
+		normalisedword1 = (word0 & 0x00FF);
+		normalisedword2 = (word1 & 0x7FFF);
+		normalisedword3 = word2;
+	} else {
+		normalisedword0 = word0;
+		normalisedword1 = 0;
+		normalisedword2 = word1;
+		normalisedword3 = word2;
+	}
+	mapitest_print(mt, MT_HDR_FMT_VER_NORM, label, normalisedword0,
+		       normalisedword1, normalisedword2, normalisedword3);
+}
+
 /**
    \details Print a report of the Exchange server and account information
 
@@ -288,10 +321,10 @@
 	mapitest_print_newline(mt, 1);
 	mapitest_print(mt, MT_HDR_FMT_SECTION, "Exchange Server");
 	mapitest_indent();
-	mapitest_print(mt, MT_HDR_FMT_STORE_VER, "Store version",
-		       mt->info.rgwServerVersion[0],
-		       mt->info.rgwServerVersion[1],
-		       mt->info.rgwServerVersion[2]);
+	mapitest_print_version_normalised(mt, "Store Version",
+					  mt->info.rgwServerVersion[0],
+					  mt->info.rgwServerVersion[1],
+					  mt->info.rgwServerVersion[2]);
 	mapitest_print(mt, MT_HDR_FMT_SUBSECTION, "Username",
 		       (mt->confidential == true) ? MT_CONFIDENTIAL : mt->info.szDisplayName);
 	mapitest_print(mt, MT_HDR_FMT_SUBSECTION, "Organization",
Index: utils/mapitest/mapitest.h
===================================================================
--- utils/mapitest/mapitest.h	(revision 1621)
+++ utils/mapitest/mapitest.h	(working copy)
@@ -160,7 +160,7 @@
 #define	MT_HDR_FMT_DATE		"[*] %-25s: %-20s"
 #define	MT_HDR_FMT_SECTION	"[*] %-25s:\n"
 #define	MT_HDR_FMT_SUBSECTION	"%-21s: %-10s\n"
-#define	MT_HDR_FMT_STORE_VER	"%-21s: %d.%d.%d\n"
+#define	MT_HDR_FMT_VER_NORM	"%-21s: %02d.%02d.%04d.%04d\n"
 
 #define	MT_DIRNAME_TOP		"[MT] Top of Mailbox"
 #define	MT_DIRNAME_APPOINTMENT	"[MT] Calendar"
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel

Reply via email to