mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
s4:torture: Remove test for deprecated WINBINDD_SHOW_SEQUENCE
torture_winbind_struct_show_sequence() is failing if run as: make -j8 test TESTS="samba4.rpc.lsa.trusted.*ad_dc samba4.winbind.struct.ad_dc" The reason is that the test constructs two lists of domains and assumes that the list contain same domains in the same order. However: - the list based on DO_STRUCT_REQ_REP(WINBINDD_SHOW_SEQUENCE, &req, &rep) contains 51 domains - the list based on DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep) contains 39 domains and we got: failure: show_sequence [ ../../source4/torture/winbind/struct_based.c:824: domlist[i].netbios_name was TORTURE201, expected TORTURE200: inconsistent order of domain lists ] Both list are based on full domain list, however the smaller one filters out domain without trust_type in winbindd_list_trusted_domains(): trust_type = get_trust_type_string(talloc_tos(), d, domain); if (trust_type == NULL) { continue; } Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
2e8009b4ca
commit
e97fbcc4b1
@ -736,162 +736,6 @@ 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 get_sequence_numbers(struct torture_context *torture,
|
||||
struct torture_domain_sequence **seqs)
|
||||
{
|
||||
struct winbindd_request req;
|
||||
struct winbindd_response rep;
|
||||
const char *extra_data;
|
||||
char line[256];
|
||||
uint32_t count = 0;
|
||||
struct torture_domain_sequence *s = NULL;
|
||||
|
||||
ZERO_STRUCT(req);
|
||||
ZERO_STRUCT(rep);
|
||||
|
||||
DO_STRUCT_REQ_REP(WINBINDD_SHOW_SEQUENCE, &req, &rep);
|
||||
|
||||
extra_data = (char *)rep.extra_data.data;
|
||||
torture_assert(torture, extra_data, "NULL sequence list");
|
||||
|
||||
while (next_token(&extra_data, line, "\n", sizeof(line))) {
|
||||
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++;
|
||||
}
|
||||
SAFE_FREE(rep.extra_data.data);
|
||||
|
||||
torture_assert(torture, count >= 2, "The list of domain sequence "
|
||||
"numbers should contain 2 entries");
|
||||
|
||||
*seqs = s;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool torture_winbind_struct_show_sequence(struct torture_context *torture)
|
||||
{
|
||||
bool ok;
|
||||
uint32_t i;
|
||||
struct torture_trust_domain *domlist = NULL;
|
||||
struct torture_domain_sequence *s = NULL;
|
||||
|
||||
torture_comment(torture, "Running WINBINDD_SHOW_SEQUENCE (struct based)\n");
|
||||
|
||||
ok = get_sequence_numbers(torture, &s);
|
||||
torture_assert(torture, ok, "failed to get list of sequence numbers");
|
||||
|
||||
ok = get_trusted_domains(torture, &domlist);
|
||||
torture_assert(torture, ok, "failed to get trust list");
|
||||
|
||||
for (i=0; domlist[i].netbios_name; i++) {
|
||||
struct winbindd_request req;
|
||||
struct winbindd_response rep;
|
||||
uint32_t seq;
|
||||
|
||||
torture_assert(torture, s[i].netbios_name,
|
||||
"more domains received in second run");
|
||||
torture_assert_str_equal(torture, domlist[i].netbios_name,
|
||||
s[i].netbios_name,
|
||||
"inconsistent order of domain lists");
|
||||
|
||||
ZERO_STRUCT(req);
|
||||
ZERO_STRUCT(rep);
|
||||
fstrcpy(req.domain_name, domlist[i].netbios_name);
|
||||
|
||||
ok = true;
|
||||
DO_STRUCT_REQ_REP_EXT(WINBINDD_SHOW_SEQUENCE, &req, &rep,
|
||||
NSS_STATUS_SUCCESS,
|
||||
false, ok = false,
|
||||
"WINBINDD_SHOW_SEQUENCE");
|
||||
if (ok == false) {
|
||||
torture_warning(torture,
|
||||
"WINBINDD_SHOW_SEQUENCE on "
|
||||
"domain %s failed\n",
|
||||
req.domain_name);
|
||||
|
||||
/*
|
||||
* Only fail for the first two domain that we
|
||||
* check specially below, otherwise we fail on
|
||||
* trusts generated by the LSA torture test
|
||||
* that do not really exist.
|
||||
*/
|
||||
if (i > 1) {
|
||||
/*
|
||||
* Do not confirm the sequence numbers
|
||||
* below
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
torture_comment(torture,
|
||||
"Full trust list for "
|
||||
"WINBINDD_SHOW_SEQUENCE "
|
||||
"test was:\n");
|
||||
for (i=0; domlist[i].netbios_name; i++) {
|
||||
torture_comment(torture,
|
||||
"%s\n",
|
||||
domlist[i].netbios_name);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
seq = rep.data.sequence_number;
|
||||
|
||||
if (i == 0) {
|
||||
torture_assert(torture, (seq != (uint32_t)-1),
|
||||
"BUILTIN domain disconnected");
|
||||
} else if (i == 1) {
|
||||
torture_assert(torture, (seq != (uint32_t)-1),
|
||||
"local domain disconnected");
|
||||
}
|
||||
|
||||
|
||||
if (seq == (uint32_t)-1) {
|
||||
torture_comment(torture, " * %s : DISCONNECTED\n",
|
||||
req.domain_name);
|
||||
} else {
|
||||
torture_comment(torture, " * %s : %d\n",
|
||||
req.domain_name, seq);
|
||||
}
|
||||
torture_assert(torture, (seq >= s[i].seq),
|
||||
"illegal sequence number encountered");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool torture_winbind_struct_setpwent(struct torture_context *torture)
|
||||
{
|
||||
struct winbindd_request req;
|
||||
@ -1174,7 +1018,6 @@ struct torture_suite *torture_winbind_struct_init(TALLOC_CTX *ctx)
|
||||
torture_suite_add_simple_test(suite, "dsgetdcname", torture_winbind_struct_dsgetdcname);
|
||||
torture_suite_add_simple_test(suite, "list_users", torture_winbind_struct_list_users);
|
||||
torture_suite_add_simple_test(suite, "list_groups", torture_winbind_struct_list_groups);
|
||||
torture_suite_add_simple_test(suite, "show_sequence", torture_winbind_struct_show_sequence);
|
||||
torture_suite_add_simple_test(suite, "setpwent", torture_winbind_struct_setpwent);
|
||||
torture_suite_add_simple_test(suite, "getpwent", torture_winbind_struct_getpwent);
|
||||
torture_suite_add_simple_test(suite, "endpwent", torture_winbind_struct_endpwent);
|
||||
|
Loading…
Reference in New Issue
Block a user