svn commit: samba r25443 - in branches/SAMBA_4_0/source/torture/winbind: .

obnox at samba.org obnox at samba.org
Mon Oct 1 15:45:03 GMT 2007


Author: obnox
Date: 2007-10-01 15:45:01 +0000 (Mon, 01 Oct 2007)
New Revision: 25443

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25443

Log:
Enhance the WINBINDD-STRUCT-SHOW_SEQUENCE test:
Compare the lists of sequence numbers obtained by
(a) calling SHOW_SEQUENCE without domain argument and
(b) walking the list of trusted domains.
output the sequence numbers of the individual domains upon success.

Michael


Modified:
   branches/SAMBA_4_0/source/torture/winbind/struct_based.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/winbind/struct_based.c
===================================================================
--- branches/SAMBA_4_0/source/torture/winbind/struct_based.c	2007-10-01 15:37:10 UTC (rev 25442)
+++ branches/SAMBA_4_0/source/torture/winbind/struct_based.c	2007-10-01 15:45:01 UTC (rev 25443)
@@ -585,15 +585,23 @@
 	return true;
 }
 
+struct torture_domain_sequence {
+	const char *netbios_name;
+	uint32_t seq;
+};
+
 static bool torture_winbind_struct_show_sequence(struct torture_context *torture)
 {
 	struct winbindd_request req;
 	struct winbindd_response rep;
 	bool ok;
+	const char *extra_data;
+	fstring line;
+	uint32_t i;
+	uint32_t count = 0;
 	struct torture_trust_domain *domlist = NULL;
-	int i;
+	struct torture_domain_sequence *s = NULL;
 
-
 	torture_comment(torture, "Running WINBINDD_SHOW_SEQUENCE (struct based)\n");
 
 	torture_comment(torture, " - Running WINBINDD_SHOW_SEQUENCE without domain:\n");
@@ -603,8 +611,39 @@
 
 	DO_STRUCT_REQ_REP(WINBINDD_SHOW_SEQUENCE, &req, &rep);
 
-	if (rep.extra_data.data) {
-		torture_comment(torture, "%s", (char *)rep.extra_data.data);
+	extra_data = (char *)rep.extra_data.data;
+	torture_assert(torture, extra_data, "NULL sequence list");
+
+	torture_comment(torture, "%s", extra_data);
+
+	while (next_token(&extra_data, line, "\n", sizeof(fstring))) {
+		char *p, *lp;
+		uint32_t seq;
+
+		s = talloc_realloc(torture, s, struct torture_domain_sequence,
+				   count + 2);
+		ZERO_STRUCT(s[count+1]);
+
+		lp = line;
+		p = strchr(lp, ' ');
+		torture_assert(torture, p, "invalid line format");
+		*p = 0;
+		s[count].netbios_name = talloc_strdup(s, lp);
+
+		lp = p+1;
+		torture_assert(torture, strncmp(lp, ": ", 2) == 0, "invalid line format");
+		lp += 2;
+		if (strcmp(lp, "DISCONNECTED") == 0) {
+			seq = (uint32_t)-1;
+		} else {
+			seq = (uint32_t)strtol(lp, &p, 10);
+			torture_assert(torture, (*p == '\0'), "invalid line format");
+			torture_assert(torture, (seq != (uint32_t)-1),
+				       "sequence number -1 encountered");
+		}
+		s[count].seq = seq;
+
+		count++;
 	}
 
 	torture_comment(torture, " - getting list of trusted domains\n");
@@ -612,15 +651,32 @@
 	torture_assert(torture, ok, "failed to get trust list");
 
 	for (i=0; domlist[i].netbios_name; i++) {
+		uint32_t seq;
+
+		ok = (s[i].netbios_name != NULL);
+		torture_assert(torture, ok, "more domains recieved in second run");
+		ok = (strcmp(domlist[i].netbios_name, s[i].netbios_name) == 0);
+		torture_assert(torture, ok, "inconsistent order of domain lists");
+
 		ZERO_STRUCT(req);
 		ZERO_STRUCT(rep);
+
 		fstrcpy(req.domain_name, domlist[i].netbios_name);
+
 		torture_comment(torture, " - Running WINBINDD_SHOW_SEQUENCE "
 				"for domain %s:\n", req.domain_name);
+
 		DO_STRUCT_REQ_REP(WINBINDD_SHOW_SEQUENCE, &req, &rep);
-		if (rep.extra_data.data) {
-			torture_comment(torture, "%s", (char *)rep.extra_data.data);
+		seq = rep.data.sequence_number;
+
+		torture_comment(torture, "%s : ", req.domain_name);
+		if (seq == (uint32_t)-1) {
+			torture_comment(torture, "DISCONNECTED\n");
+		} else {
+			torture_comment(torture, "%d\n", seq);
 		}
+		torture_assert(torture, (seq >= s[i].seq),
+			       "illegal sequence number encountered");
 	}
 
 	return true;



More information about the samba-cvs mailing list