2 Unix SMB/CIFS implementation.
4 Copyright (C) Guenther Deschner 2010
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/>.
21 #include "torture/smbtorture.h"
23 #include "torture/libnetapi/proto.h"
25 #define NETAPI_STATUS(tctx, x,y,fn) \
26 torture_warning(tctx, "FAILURE: line %d: %s failed with status: %s (%d)\n", \
27 __LINE__, fn, libnetapi_get_error_string(x,y), y);
29 bool torture_libnetapi_server(struct torture_context
*tctx
)
31 NET_API_STATUS status
= 0;
32 uint8_t *buffer
= NULL
;
35 const char *hostname
= torture_setting_string(tctx
, "host", NULL
);
36 struct libnetapi_ctx
*ctx
;
38 torture_assert(tctx
, torture_libnetapi_init_context(tctx
, &ctx
),
39 "failed to initialize libnetapi");
41 torture_comment(tctx
, "NetServer tests\n");
43 torture_comment(tctx
, "Testing NetRemoteTOD\n");
45 status
= NetRemoteTOD(hostname
, &buffer
);
47 NETAPI_STATUS(tctx
, ctx
, status
, "NetRemoteTOD");
50 NetApiBufferFree(buffer
);
52 torture_comment(tctx
, "Testing NetRemoteTOD 10 times\n");
54 for (i
=0; i
<10; i
++) {
55 status
= NetRemoteTOD(hostname
, &buffer
);
57 NETAPI_STATUS(tctx
, ctx
, status
, "NetRemoteTOD");
60 NetApiBufferFree(buffer
);
65 torture_comment(tctx
, "NetServer tests succeeded\n");
68 torture_comment(tctx
, "NetServer testsuite failed with: %s\n",
69 libnetapi_get_error_string(ctx
, status
));