summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-10-01 15:45:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:34 -0500
commit3f466b1aab78876852563e258bc690c7228950e2 (patch)
tree885f6a34c645ad841f41c9b839854294d8b40f2e
parentca61e8668c4397f053e8f8e7de7ab15cd42fe2b7 (diff)
downloadsamba-3f466b1aab78876852563e258bc690c7228950e2.tar.gz
samba-3f466b1aab78876852563e258bc690c7228950e2.tar.bz2
samba-3f466b1aab78876852563e258bc690c7228950e2.zip
r25443: 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 (This used to be commit 21db6eb43c796da7607260d783221c5ee42f1f41)
-rw-r--r--source4/torture/winbind/struct_based.c68
1 files changed, 62 insertions, 6 deletions
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index 0d30c2f072..0b9391bcd8 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -585,14 +585,22 @@ static bool torture_winbind_struct_list_groups(struct torture_context *torture)
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");
@@ -603,8 +611,39 @@ static bool torture_winbind_struct_show_sequence(struct torture_context *torture
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 @@ static bool torture_winbind_struct_show_sequence(struct torture_context *torture
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;