2 Unix SMB/CIFS implementation.
3 SMB torture tester - winbind struct based protocol
4 Copyright (C) Stefan Metzmacher 2007
5 Copyright (C) Michael Adam 2007
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "torture/torture.h"
24 #include "torture/winbind/proto.h"
25 #include "nsswitch/winbind_client.h"
26 #include "libcli/security/security.h"
27 #include "librpc/gen_ndr/netlogon.h"
28 #include "param/param.h"
29 #include "auth/ntlm/pam_errors.h"
31 #define DO_STRUCT_REQ_REP_EXT(op,req,rep,expected,strict,warnaction,cmt) do { \
32 NSS_STATUS __got, __expected = (expected); \
33 __got = winbindd_request_response(op, req, rep); \
34 if (__got != __expected) { \
35 const char *__cmt = (cmt); \
37 torture_result(torture, TORTURE_FAIL, \
38 __location__ ": " __STRING(op) \
39 " returned %d, expected %d%s%s", \
41 (__cmt) ? ": " : "", \
42 (__cmt) ? (__cmt) : ""); \
45 torture_warning(torture, \
46 __location__ ": " __STRING(op) \
47 " returned %d, expected %d%s%s", \
49 (__cmt) ? ": " : "", \
50 (__cmt) ? (__cmt) : ""); \
56 #define DO_STRUCT_REQ_REP(op,req,rep) do { \
57 bool __noop = false; \
58 DO_STRUCT_REQ_REP_EXT(op,req,rep,NSS_STATUS_SUCCESS,true,__noop=true,NULL); \
61 static bool torture_winbind_struct_interface_version(struct torture_context *torture)
63 struct winbindd_request req;
64 struct winbindd_response rep;
69 torture_comment(torture, "Running WINBINDD_INTERFACE_VERSION (struct based)\n");
71 DO_STRUCT_REQ_REP(WINBINDD_INTERFACE_VERSION, &req, &rep);
73 torture_assert_int_equal(torture,
74 rep.data.interface_version,
75 WINBIND_INTERFACE_VERSION,
76 "winbind server and client doesn't match");
81 static bool torture_winbind_struct_ping(struct torture_context *torture)
83 struct timeval tv = timeval_current();
84 int timelimit = torture_setting_int(torture, "timelimit", 5);
87 torture_comment(torture,
88 "Running WINBINDD_PING (struct based) for %d seconds\n",
91 while (timeval_elapsed(&tv) < timelimit) {
92 DO_STRUCT_REQ_REP(WINBINDD_PING, NULL, NULL);
96 torture_comment(torture,
97 "%u (%.1f/s) WINBINDD_PING (struct based)\n",
98 total, total / timeval_elapsed(&tv));
104 static char winbind_separator(struct torture_context *torture)
106 struct winbindd_response rep;
110 DO_STRUCT_REQ_REP(WINBINDD_INFO, NULL, &rep);
112 return rep.data.info.winbind_separator;
115 static bool torture_winbind_struct_info(struct torture_context *torture)
117 struct winbindd_response rep;
118 const char *separator;
122 torture_comment(torture, "Running WINBINDD_INFO (struct based)\n");
124 DO_STRUCT_REQ_REP(WINBINDD_INFO, NULL, &rep);
126 separator = torture_setting_string(torture,
127 "winbindd separator",
128 lp_winbind_separator(torture->lp_ctx));
129 torture_assert_int_equal(torture,
130 rep.data.info.winbind_separator,
132 "winbind separator doesn't match");
134 torture_comment(torture, "Samba Version '%s'\n",
135 rep.data.info.samba_version);
140 static bool torture_winbind_struct_priv_pipe_dir(struct torture_context *torture)
142 struct winbindd_response rep;
147 torture_comment(torture, "Running WINBINDD_PRIV_PIPE_DIR (struct based)\n");
149 DO_STRUCT_REQ_REP(WINBINDD_PRIV_PIPE_DIR, NULL, &rep);
151 got_dir = (const char *)rep.extra_data.data;
153 torture_assert(torture, got_dir, "NULL WINBINDD_PRIV_PIPE_DIR\n");
155 SAFE_FREE(rep.extra_data.data);
159 static bool torture_winbind_struct_netbios_name(struct torture_context *torture)
161 struct winbindd_response rep;
162 const char *expected;
166 torture_comment(torture, "Running WINBINDD_NETBIOS_NAME (struct based)\n");
168 DO_STRUCT_REQ_REP(WINBINDD_NETBIOS_NAME, NULL, &rep);
170 expected = torture_setting_string(torture,
171 "winbindd netbios name",
172 lp_netbios_name(torture->lp_ctx));
173 expected = strupper_talloc(torture, expected);
175 torture_assert_str_equal(torture,
176 rep.data.netbios_name, expected,
177 "winbindd's netbios name doesn't match");
182 static bool get_winbind_domain(struct torture_context *torture, char **domain)
184 struct winbindd_response rep;
188 DO_STRUCT_REQ_REP(WINBINDD_DOMAIN_NAME, NULL, &rep);
190 *domain = talloc_strdup(torture, rep.data.domain_name);
191 torture_assert(torture, domain, "talloc error");
196 static bool torture_winbind_struct_domain_name(struct torture_context *torture)
198 const char *expected;
201 torture_comment(torture, "Running WINBINDD_DOMAIN_NAME (struct based)\n");
203 expected = torture_setting_string(torture,
204 "winbindd netbios domain",
205 lp_workgroup(torture->lp_ctx));
207 get_winbind_domain(torture, &domain);
209 torture_assert_str_equal(torture, domain, expected,
210 "winbindd's netbios domain doesn't match");
215 static bool torture_winbind_struct_check_machacc(struct torture_context *torture)
218 bool strict = torture_setting_bool(torture, "strict mode", false);
219 struct winbindd_response rep;
223 torture_comment(torture, "Running WINBINDD_CHECK_MACHACC (struct based)\n");
226 DO_STRUCT_REQ_REP_EXT(WINBINDD_CHECK_MACHACC, NULL, &rep,
227 NSS_STATUS_SUCCESS, strict, ok = false,
228 "WINBINDD_CHECK_MACHACC");
231 torture_assert(torture,
232 strlen(rep.data.auth.nt_status_string)>0,
233 "Failed with empty nt_status_string");
235 torture_warning(torture,"%s:%s:%s:%d\n",
236 nt_errstr(NT_STATUS(rep.data.auth.nt_status)),
237 rep.data.auth.nt_status_string,
238 rep.data.auth.error_string,
239 rep.data.auth.pam_error);
243 torture_assert_ntstatus_ok(torture,
244 NT_STATUS(rep.data.auth.nt_status),
245 "WINBINDD_CHECK_MACHACC ok: nt_status");
247 torture_assert_str_equal(torture,
248 rep.data.auth.nt_status_string,
249 nt_errstr(NT_STATUS_OK),
250 "WINBINDD_CHECK_MACHACC ok:nt_status_string");
252 torture_assert_str_equal(torture,
253 rep.data.auth.error_string,
254 get_friendly_nt_error_msg(NT_STATUS_OK),
255 "WINBINDD_CHECK_MACHACC ok: error_string");
257 torture_assert_int_equal(torture,
258 rep.data.auth.pam_error,
259 nt_status_to_pam(NT_STATUS_OK),
260 "WINBINDD_CHECK_MACHACC ok: pam_error");
265 struct torture_trust_domain {
266 const char *netbios_name;
267 const char *dns_name;
271 static bool get_trusted_domains(struct torture_context *torture,
272 struct torture_trust_domain **_d)
274 struct winbindd_request req;
275 struct winbindd_response rep;
276 struct torture_trust_domain *d = NULL;
279 const char *extra_data;
284 DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep);
286 extra_data = (char *)rep.extra_data.data;
291 torture_assert(torture, extra_data, "NULL trust list");
293 while (next_token(&extra_data, line, "\n", sizeof(fstring))) {
296 d = talloc_realloc(torture, d,
297 struct torture_trust_domain,
299 ZERO_STRUCT(d[dcount+1]);
302 p = strchr(lp, '\\');
303 torture_assert(torture, p, "missing 1st '\\' in line");
305 d[dcount].netbios_name = talloc_strdup(d, lp);
306 torture_assert(torture, strlen(d[dcount].netbios_name) > 0,
307 "empty netbios_name");
310 p = strchr(lp, '\\');
311 torture_assert(torture, p, "missing 2nd '\\' in line");
313 d[dcount].dns_name = talloc_strdup(d, lp);
314 /* it's ok to have an empty dns_name */
317 d[dcount].sid = dom_sid_parse_talloc(d, lp);
318 torture_assert(torture, d[dcount].sid,
319 "failed to parse sid");
323 SAFE_FREE(rep.extra_data.data);
325 torture_assert(torture, dcount >= 2,
326 "The list of trusted domain should contain 2 entries");
332 static bool torture_winbind_struct_list_trustdom(struct torture_context *torture)
334 struct winbindd_request req;
335 struct winbindd_response rep;
339 struct torture_trust_domain *listd = NULL;
342 torture_comment(torture, "Running WINBINDD_LIST_TRUSTDOM (struct based)\n");
347 req.data.list_all_domains = false;
349 DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep);
351 list1 = (char *)rep.extra_data.data;
353 torture_comment(torture, "%s\n", list1);
358 req.data.list_all_domains = true;
360 DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep);
362 list2 = (char *)rep.extra_data.data;
365 * The list_all_domains parameter should be ignored
367 torture_assert_str_equal(torture, list2, list1, "list_all_domains not ignored");
372 ok = get_trusted_domains(torture, &listd);
373 torture_assert(torture, ok, "failed to get trust list");
375 for (i=0; listd && listd[i].netbios_name; i++) {
377 struct dom_sid *builtin_sid;
379 builtin_sid = dom_sid_parse_talloc(torture, SID_BUILTIN);
381 torture_assert_str_equal(torture,
382 listd[i].netbios_name,
384 "first domain should be 'BUILTIN'");
386 torture_assert_str_equal(torture,
389 "BUILTIN domain should not have a dns name");
391 ok = dom_sid_equal(builtin_sid,
393 torture_assert(torture, ok, "BUILTIN domain should have S-1-5-32");
399 * TODO: verify the content of the 2nd and 3rd (in member server mode)
407 static bool torture_winbind_struct_domain_info(struct torture_context *torture)
410 struct torture_trust_domain *listd = NULL;
413 torture_comment(torture, "Running WINBINDD_DOMAIN_INFO (struct based)\n");
415 ok = get_trusted_domains(torture, &listd);
416 torture_assert(torture, ok, "failed to get trust list");
418 for (i=0; listd && listd[i].netbios_name; i++) {
419 struct winbindd_request req;
420 struct winbindd_response rep;
422 char *flagstr = talloc_strdup(torture," ");
427 fstrcpy(req.domain_name, listd[i].netbios_name);
429 DO_STRUCT_REQ_REP(WINBINDD_DOMAIN_INFO, &req, &rep);
431 torture_assert_str_equal(torture,
432 rep.data.domain_info.name,
433 listd[i].netbios_name,
434 "Netbios domain name doesn't match");
436 torture_assert_str_equal(torture,
437 rep.data.domain_info.alt_name,
439 "DNS domain name doesn't match");
441 sid = dom_sid_parse_talloc(torture, rep.data.domain_info.sid);
442 torture_assert(torture, sid, "Failed to parse SID");
444 ok = dom_sid_equal(listd[i].sid, sid);
445 torture_assert(torture, ok, "SID's doesn't match");
447 if (rep.data.domain_info.primary) {
448 flagstr = talloc_strdup_append(flagstr, "PR ");
451 if (rep.data.domain_info.active_directory) {
452 torture_assert(torture,
453 strlen(rep.data.domain_info.alt_name)>0,
454 "Active Directory without DNS name");
455 flagstr = talloc_strdup_append(flagstr, "AD ");
458 if (rep.data.domain_info.native_mode) {
459 torture_assert(torture,
460 rep.data.domain_info.active_directory,
461 "Native-Mode, but no Active Directory");
462 flagstr = talloc_strdup_append(flagstr, "NA ");
465 torture_comment(torture, "DOMAIN '%s' => '%s' [%s]\n",
466 rep.data.domain_info.name,
467 rep.data.domain_info.alt_name,
474 static bool torture_winbind_struct_getdcname(struct torture_context *torture)
477 bool strict = torture_setting_bool(torture, "strict mode", false);
478 struct torture_trust_domain *listd = NULL;
479 uint32_t i, count = 0;
481 torture_comment(torture, "Running WINBINDD_GETDCNAME (struct based)\n");
483 ok = get_trusted_domains(torture, &listd);
484 torture_assert(torture, ok, "failed to get trust list");
486 for (i=0; listd && listd[i].netbios_name; i++) {
487 struct winbindd_request req;
488 struct winbindd_response rep;
493 fstrcpy(req.domain_name, listd[i].netbios_name);
496 DO_STRUCT_REQ_REP_EXT(WINBINDD_GETDCNAME, &req, &rep,
498 (i <2 || strict), ok = false,
499 talloc_asprintf(torture, "DOMAIN '%s'",
503 /* TODO: check rep.data.dc_name; */
504 torture_comment(torture, "DOMAIN '%s' => DCNAME '%s'\n",
505 req.domain_name, rep.data.dc_name);
510 torture_assert(torture, count > 0,
511 "WiNBINDD_GETDCNAME was not tested");
516 static bool torture_winbind_struct_dsgetdcname(struct torture_context *torture)
519 bool strict = torture_setting_bool(torture, "strict mode", false);
520 struct torture_trust_domain *listd = NULL;
524 torture_comment(torture, "Running WINBINDD_DSGETDCNAME (struct based)\n");
526 ok = get_trusted_domains(torture, &listd);
527 torture_assert(torture, ok, "failed to get trust list");
529 for (i=0; listd && listd[i].netbios_name; i++) {
530 struct winbindd_request req;
531 struct winbindd_response rep;
536 if (strlen(listd[i].dns_name) == 0) continue;
539 * TODO: remove this and let winbindd give no dns name
542 if (strcmp(listd[i].dns_name, listd[i].netbios_name) == 0) {
546 fstrcpy(req.domain_name, listd[i].dns_name);
548 /* TODO: test more flag combinations */
549 req.flags = DS_DIRECTORY_SERVICE_REQUIRED;
552 DO_STRUCT_REQ_REP_EXT(WINBINDD_DSGETDCNAME, &req, &rep,
555 talloc_asprintf(torture, "DOMAIN '%s'",
559 /* TODO: check rep.data.dc_name; */
560 torture_comment(torture, "DOMAIN '%s' => DCNAME '%s'\n",
561 req.domain_name, rep.data.dc_name);
567 torture_warning(torture, "WINBINDD_DSGETDCNAME"
568 " was not tested with %d non-AD domains",
573 torture_assert(torture, count > 0,
574 "WiNBINDD_DSGETDCNAME was not tested");
580 static bool get_user_list(struct torture_context *torture, char ***users)
582 struct winbindd_request req;
583 struct winbindd_response rep;
587 const char *extra_data;
592 DO_STRUCT_REQ_REP(WINBINDD_LIST_USERS, &req, &rep);
594 extra_data = (char *)rep.extra_data.data;
595 torture_assert(torture, extra_data, "NULL extra data");
598 next_token(&extra_data, name, ",", sizeof(fstring));
601 u = talloc_realloc(torture, u, char *, count + 2);
603 u[count] = talloc_strdup(u, name);
606 SAFE_FREE(rep.extra_data.data);
612 static bool torture_winbind_struct_list_users(struct torture_context *torture)
618 torture_comment(torture, "Running WINBINDD_LIST_USERS (struct based)\n");
620 ok = get_user_list(torture, &users);
621 torture_assert(torture, ok, "failed to get group list");
623 for (count = 0; users[count]; count++) { }
625 torture_comment(torture, "got %d users\n", count);
630 static bool get_group_list(struct torture_context *torture, char ***groups)
632 struct winbindd_request req;
633 struct winbindd_response rep;
637 const char *extra_data;
642 DO_STRUCT_REQ_REP(WINBINDD_LIST_GROUPS, &req, &rep);
644 extra_data = (char *)rep.extra_data.data;
645 torture_assert(torture, extra_data, "NULL extra data");
648 next_token(&extra_data, name, ",", sizeof(fstring));
651 g = talloc_realloc(torture, g, char *, count + 2);
653 g[count] = talloc_strdup(g, name);
656 SAFE_FREE(rep.extra_data.data);
662 static bool torture_winbind_struct_list_groups(struct torture_context *torture)
668 torture_comment(torture, "Running WINBINDD_LIST_GROUPS (struct based)\n");
670 ok = get_group_list(torture, &groups);
671 torture_assert(torture, ok, "failed to get group list");
673 for (count = 0; groups[count]; count++) { }
675 torture_comment(torture, "got %d groups\n", count);
680 struct torture_domain_sequence {
681 const char *netbios_name;
685 static bool get_sequence_numbers(struct torture_context *torture,
686 struct torture_domain_sequence **seqs)
688 struct winbindd_request req;
689 struct winbindd_response rep;
690 const char *extra_data;
693 struct torture_domain_sequence *s = NULL;
698 DO_STRUCT_REQ_REP(WINBINDD_SHOW_SEQUENCE, &req, &rep);
700 extra_data = (char *)rep.extra_data.data;
701 torture_assert(torture, extra_data, "NULL sequence list");
703 while (next_token(&extra_data, line, "\n", sizeof(fstring))) {
707 s = talloc_realloc(torture, s, struct torture_domain_sequence,
709 ZERO_STRUCT(s[count+1]);
713 torture_assert(torture, p, "invalid line format");
715 s[count].netbios_name = talloc_strdup(s, lp);
718 torture_assert(torture, strncmp(lp, ": ", 2) == 0,
719 "invalid line format");
721 if (strcmp(lp, "DISCONNECTED") == 0) {
724 seq = (uint32_t)strtol(lp, &p, 10);
725 torture_assert(torture, (*p == '\0'),
726 "invalid line format");
727 torture_assert(torture, (seq != (uint32_t)-1),
728 "sequence number -1 encountered");
734 SAFE_FREE(rep.extra_data.data);
736 torture_assert(torture, count >= 2, "The list of domain sequence "
737 "numbers should contain 2 entries");
743 static bool torture_winbind_struct_show_sequence(struct torture_context *torture)
747 struct torture_trust_domain *domlist = NULL;
748 struct torture_domain_sequence *s = NULL;
750 torture_comment(torture, "Running WINBINDD_SHOW_SEQUENCE (struct based)\n");
752 ok = get_sequence_numbers(torture, &s);
753 torture_assert(torture, ok, "failed to get list of sequence numbers");
755 ok = get_trusted_domains(torture, &domlist);
756 torture_assert(torture, ok, "failed to get trust list");
758 for (i=0; domlist[i].netbios_name; i++) {
759 struct winbindd_request req;
760 struct winbindd_response rep;
763 torture_assert(torture, s[i].netbios_name,
764 "more domains recieved in second run");
765 torture_assert_str_equal(torture, domlist[i].netbios_name,
767 "inconsistent order of domain lists");
771 fstrcpy(req.domain_name, domlist[i].netbios_name);
773 DO_STRUCT_REQ_REP(WINBINDD_SHOW_SEQUENCE, &req, &rep);
775 seq = rep.data.sequence_number;
778 torture_assert(torture, (seq != (uint32_t)-1),
779 "BUILTIN domain disconnected");
781 torture_assert(torture, (seq != (uint32_t)-1),
782 "local domain disconnected");
786 if (seq == (uint32_t)-1) {
787 torture_comment(torture, " * %s : DISCONNECTED\n",
790 torture_comment(torture, " * %s : %d\n",
791 req.domain_name, seq);
793 torture_assert(torture, (seq >= s[i].seq),
794 "illegal sequence number encountered");
800 static bool torture_winbind_struct_setpwent(struct torture_context *torture)
802 struct winbindd_request req;
803 struct winbindd_response rep;
805 torture_comment(torture, "Running WINBINDD_SETPWENT (struct based)\n");
810 DO_STRUCT_REQ_REP(WINBINDD_SETPWENT, &req, &rep);
815 static bool torture_winbind_struct_getpwent(struct torture_context *torture)
817 struct winbindd_request req;
818 struct winbindd_response rep;
819 struct winbindd_pw *pwent;
821 torture_comment(torture, "Running WINBINDD_GETPWENT (struct based)\n");
823 torture_comment(torture, " - Running WINBINDD_SETPWENT first\n");
826 DO_STRUCT_REQ_REP(WINBINDD_SETPWENT, &req, &rep);
828 torture_comment(torture, " - Running WINBINDD_GETPWENT now\n");
831 req.data.num_entries = 1;
832 DO_STRUCT_REQ_REP(WINBINDD_GETPWENT, &req, &rep);
833 pwent = (struct winbindd_pw *)rep.extra_data.data;
834 torture_assert(torture, (pwent != NULL), "NULL pwent");
835 torture_comment(torture, "name: %s, uid: %d, gid: %d, shell: %s\n",
836 pwent->pw_name, pwent->pw_uid, pwent->pw_gid,
842 static bool torture_winbind_struct_endpwent(struct torture_context *torture)
844 struct winbindd_request req;
845 struct winbindd_response rep;
847 torture_comment(torture, "Running WINBINDD_ENDPWENT (struct based)\n");
852 DO_STRUCT_REQ_REP(WINBINDD_ENDPWENT, &req, &rep);
857 /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the
858 form DOMAIN/user into a domain and a user */
860 static bool parse_domain_user(struct torture_context *torture,
861 const char *domuser, fstring domain,
864 char *p = strchr(domuser, winbind_separator(torture));
868 /* Maybe it was a UPN? */
869 if ((p = strchr(domuser, '@')) != NULL) {
871 fstrcpy(user, domuser);
875 fstrcpy(user, domuser);
876 get_winbind_domain(torture, &dom);
877 fstrcpy(domain, dom);
882 fstrcpy(domain, domuser);
883 domain[PTR_DIFF(p, domuser)] = 0;
889 static bool lookup_name_sid_list(struct torture_context *torture, char **list)
893 for (count = 0; list[count]; count++) {
894 struct winbindd_request req;
895 struct winbindd_response rep;
902 parse_domain_user(torture, list[count], req.data.name.dom_name,
905 DO_STRUCT_REQ_REP(WINBINDD_LOOKUPNAME, &req, &rep);
907 sid = talloc_strdup(torture, rep.data.sid.sid);
912 fstrcpy(req.data.sid, sid);
914 DO_STRUCT_REQ_REP(WINBINDD_LOOKUPSID, &req, &rep);
916 name = talloc_asprintf(torture, "%s%c%s",
917 rep.data.name.dom_name,
918 winbind_separator(torture),
921 torture_assert_casestr_equal(torture, list[count], name,
922 "LOOKUP_SID after LOOKUP_NAME != id");
925 torture_comment(torture, " %s -> %s -> %s\n", list[count],
936 static bool name_is_in_list(const char *name, const char **list)
940 for (count = 0; list[count]; count++) {
941 if (strequal(name, list[count])) {
948 static bool torture_winbind_struct_lookup_name_sid(struct torture_context *torture)
950 struct winbindd_request req;
951 struct winbindd_response rep;
952 const char *invalid_sid = "S-0-0-7";
954 const char *invalid_user = "noone";
956 bool strict = torture_setting_bool(torture, "strict mode", false);
962 torture_comment(torture, "Running WINBINDD_LOOKUP_NAME_SID (struct based)\n");
964 ok = get_user_list(torture, &users);
965 torture_assert(torture, ok, "failed to retrieve list of users");
966 lookup_name_sid_list(torture, users);
968 ok = get_group_list(torture, &groups);
969 torture_assert(torture, ok, "failed to retrieve list of groups");
970 lookup_name_sid_list(torture, groups);
975 fstrcpy(req.data.sid, invalid_sid);
978 DO_STRUCT_REQ_REP_EXT(WINBINDD_LOOKUPSID, &req, &rep,
982 talloc_asprintf(torture,
983 "invalid sid %s was resolved",
989 /* try to find an invalid name... */
992 get_winbind_domain(torture, &domain);
995 invalid_name = talloc_asprintf(torture, "%s\\%s%u",
997 invalid_user, count);
998 } while(name_is_in_list(invalid_name, (const char **)users) ||
999 name_is_in_list(invalid_name, (const char **)groups));
1001 fstrcpy(req.data.name.dom_name, domain);
1002 fstrcpy(req.data.name.name,
1003 talloc_asprintf(torture, "%s%u", invalid_user,
1007 DO_STRUCT_REQ_REP_EXT(WINBINDD_LOOKUPNAME, &req, &rep,
1008 NSS_STATUS_NOTFOUND,
1011 talloc_asprintf(torture,
1012 "invalid name %s was resolved",
1016 talloc_free(groups);
1021 struct torture_suite *torture_winbind_struct_init(void)
1023 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "STRUCT");
1025 torture_suite_add_simple_test(suite, "INTERFACE_VERSION", torture_winbind_struct_interface_version);
1026 torture_suite_add_simple_test(suite, "PING", torture_winbind_struct_ping);
1027 torture_suite_add_simple_test(suite, "INFO", torture_winbind_struct_info);
1028 torture_suite_add_simple_test(suite, "PRIV_PIPE_DIR", torture_winbind_struct_priv_pipe_dir);
1029 torture_suite_add_simple_test(suite, "NETBIOS_NAME", torture_winbind_struct_netbios_name);
1030 torture_suite_add_simple_test(suite, "DOMAIN_NAME", torture_winbind_struct_domain_name);
1031 torture_suite_add_simple_test(suite, "CHECK_MACHACC", torture_winbind_struct_check_machacc);
1032 torture_suite_add_simple_test(suite, "LIST_TRUSTDOM", torture_winbind_struct_list_trustdom);
1033 torture_suite_add_simple_test(suite, "DOMAIN_INFO", torture_winbind_struct_domain_info);
1034 torture_suite_add_simple_test(suite, "GETDCNAME", torture_winbind_struct_getdcname);
1035 torture_suite_add_simple_test(suite, "DSGETDCNAME", torture_winbind_struct_dsgetdcname);
1036 torture_suite_add_simple_test(suite, "LIST_USERS", torture_winbind_struct_list_users);
1037 torture_suite_add_simple_test(suite, "LIST_GROUPS", torture_winbind_struct_list_groups);
1038 torture_suite_add_simple_test(suite, "SHOW_SEQUENCE", torture_winbind_struct_show_sequence);
1039 torture_suite_add_simple_test(suite, "SETPWENT", torture_winbind_struct_setpwent);
1040 torture_suite_add_simple_test(suite, "GETPWENT", torture_winbind_struct_getpwent);
1041 torture_suite_add_simple_test(suite, "ENDPWENT", torture_winbind_struct_endpwent);
1042 torture_suite_add_simple_test(suite, "LOOKUP_NAME_SID", torture_winbind_struct_lookup_name_sid);
1044 suite->description = talloc_strdup(suite, "WINBIND - struct based protocol tests");