2 Unix SMB/CIFS implementation.
3 SMB torture tester - winbind struct based protocol
4 Copyright (C) Stefan Metzmacher 2007
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "torture/torture.h"
23 #include "torture/winbind/proto.h"
24 #include "nsswitch/winbind_client.h"
25 #include "param/param.h"
27 #define DO_STRUCT_REQ_REP(op,req,rep) do { \
29 _result = winbindd_request_response(op, req, rep); \
30 torture_assert_int_equal(torture, _result, NSS_STATUS_SUCCESS, \
31 __STRING(op) "(struct based)"); \
34 static bool torture_winbind_struct_ping(struct torture_context *torture)
36 struct timeval tv = timeval_current();
37 int timelimit = torture_setting_int(torture, "timelimit", 5);
40 torture_comment(torture,
41 "Running WINBINDD_PING (struct based) for %d seconds\n",
44 while (timeval_elapsed(&tv) < timelimit) {
45 DO_STRUCT_REQ_REP(WINBINDD_PING, NULL, NULL);
49 torture_comment(torture,
50 "%u (%.1f/s) WINBINDD_PING (struct based)\n",
51 total, total / timeval_elapsed(&tv));
56 static bool torture_winbind_struct_getdcname(struct torture_context *torture)
58 struct winbindd_request req;
59 struct winbindd_response rep;
64 fstrcpy(req.domain_name, lp_workgroup());
66 DO_STRUCT_REQ_REP(WINBINDD_GETDCNAME, &req, &rep);
69 * TODO: test all trusted domains
75 struct torture_suite *torture_winbind_struct_init(void)
77 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "STRUCT");
79 torture_suite_add_simple_test(suite, "PING", torture_winbind_struct_ping);
80 torture_suite_add_simple_test(suite, "GETDCNAME", torture_winbind_struct_getdcname);
82 suite->description = talloc_strdup(suite, "WINBIND - struct based protocol tests");