s3-docs: Adapt version in man ldbrename.
[Samba.git] / source4 / torture / rpc / wkssvc.c
blob3c34229dff6b87def52e576d73a76232fd10aee3
1 /*
2 Unix SMB/CIFS implementation.
3 test suite for wkssvc rpc operations
5 Copyright (C) Andrew Tridgell 2003
6 Copyright (C) Günther Deschner 2007
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "torture/torture.h"
24 #include "librpc/gen_ndr/ndr_wkssvc_c.h"
25 #include "torture/rpc/rpc.h"
26 #include "lib/cmdline/popt_common.h"
27 #include "param/param.h"
28 #include "../lib/crypto/crypto.h"
29 #include "libcli/auth/libcli_auth.h"
31 #define SMBTORTURE_MACHINE_NAME "smbtrt_name"
32 #define SMBTORTURE_ALTERNATE_NAME "smbtrt_altname"
33 #define SMBTORTURE_TRANSPORT_NAME "\\Device\\smbtrt_transport_name"
34 #define SMBTORTURE_USE_NAME "S:"
35 #define SMBTORTURE_MESSAGE "You are currently tortured by Samba"
37 static bool test_NetWkstaGetInfo(struct torture_context *tctx,
38 struct dcerpc_pipe *p)
40 NTSTATUS status;
41 struct wkssvc_NetWkstaGetInfo r;
42 union wkssvc_NetWkstaInfo info;
43 uint16_t levels[] = {100, 101, 102, 502};
44 int i;
46 r.in.server_name = dcerpc_server_name(p);
47 r.out.info = &info;
49 for (i=0;i<ARRAY_SIZE(levels);i++) {
50 r.in.level = levels[i];
51 torture_comment(tctx, "testing NetWkstaGetInfo level %u\n",
52 r.in.level);
53 status = dcerpc_wkssvc_NetWkstaGetInfo(p, tctx, &r);
54 torture_assert_ntstatus_ok(tctx, status,
55 talloc_asprintf(tctx, "NetWkstaGetInfo level %u failed",
56 r.in.level));
57 torture_assert_werr_ok(tctx, r.out.result,
58 talloc_asprintf(tctx, "NetWkstaGetInfo level %u failed",
59 r.in.level));
62 return true;
65 static bool test_NetWkstaTransportEnum(struct torture_context *tctx,
66 struct dcerpc_pipe *p)
68 NTSTATUS status;
69 struct wkssvc_NetWkstaTransportEnum r;
70 uint32_t resume_handle = 0;
71 struct wkssvc_NetWkstaTransportInfo info;
72 union wkssvc_NetWkstaTransportCtr ctr;
73 struct wkssvc_NetWkstaTransportCtr0 ctr0;
74 uint32_t total_entries = 0;
76 ZERO_STRUCT(ctr0);
77 ctr.ctr0 = &ctr0;
79 info.level = 0;
80 info.ctr = ctr;
82 r.in.server_name = dcerpc_server_name(p);
83 r.in.info = &info;
84 r.in.max_buffer = (uint32_t)-1;
85 r.in.resume_handle = &resume_handle;
86 r.out.total_entries = &total_entries;
87 r.out.info = &info;
88 r.out.resume_handle = &resume_handle;
90 torture_comment(tctx, "testing NetWkstaTransportEnum level 0\n");
92 status = dcerpc_wkssvc_NetWkstaTransportEnum(p, tctx, &r);
93 torture_assert_ntstatus_ok(tctx, status,
94 "NetWkstaTransportEnum failed");
95 torture_assert_werr_ok(tctx, r.out.result, talloc_asprintf(tctx,
96 "NetWkstaTransportEnum level %u failed",
97 info.level));
99 return true;
102 static bool test_NetrWkstaTransportAdd(struct torture_context *tctx,
103 struct dcerpc_pipe *p)
105 NTSTATUS status;
106 struct wkssvc_NetrWkstaTransportAdd r;
107 struct wkssvc_NetWkstaTransportInfo0 info0;
108 uint32_t parm_err = 0;
110 ZERO_STRUCT(info0);
112 info0.quality_of_service = 0xffff;
113 info0.vc_count = 0;
114 info0.name = SMBTORTURE_TRANSPORT_NAME;
115 info0.address = "000000000000";
116 info0.wan_link = 0x400;
118 r.in.server_name = dcerpc_server_name(p);
119 r.in.level = 0;
120 r.in.info0 = &info0;
121 r.in.parm_err = r.out.parm_err = &parm_err;
123 torture_comment(tctx, "testing NetrWkstaTransportAdd level 0\n");
125 status = dcerpc_wkssvc_NetrWkstaTransportAdd(p, tctx, &r);
126 torture_assert_ntstatus_ok(tctx, status,
127 "NetrWkstaTransportAdd failed");
128 torture_assert_werr_equal(tctx, r.out.result,
129 WERR_INVALID_PARAM,
130 "NetrWkstaTransportAdd level 0 failed");
132 return true;
135 static bool test_NetrWkstaTransportDel(struct torture_context *tctx,
136 struct dcerpc_pipe *p)
138 NTSTATUS status;
139 struct wkssvc_NetrWkstaTransportDel r;
141 r.in.server_name = dcerpc_server_name(p);
142 r.in.transport_name = SMBTORTURE_TRANSPORT_NAME;
143 r.in.unknown3 = 0;
145 torture_comment(tctx, "testing NetrWkstaTransportDel\n");
147 status = dcerpc_wkssvc_NetrWkstaTransportDel(p, tctx, &r);
148 torture_assert_ntstatus_ok(tctx, status,
149 "NetrWkstaTransportDel failed");
150 torture_assert_werr_ok(tctx, r.out.result,
151 "NetrWkstaTransportDel");
153 return true;
156 static bool test_NetWkstaEnumUsers(struct torture_context *tctx,
157 struct dcerpc_pipe *p)
159 NTSTATUS status;
160 struct wkssvc_NetWkstaEnumUsers r;
161 uint32_t handle = 0;
162 uint32_t entries_read = 0;
163 struct wkssvc_NetWkstaEnumUsersInfo info;
164 struct wkssvc_NetWkstaEnumUsersCtr0 *user0;
165 struct wkssvc_NetWkstaEnumUsersCtr1 *user1;
166 uint32_t levels[] = { 0, 1 };
167 int i;
169 for (i=0; i<ARRAY_SIZE(levels); i++) {
171 ZERO_STRUCT(info);
173 info.level = levels[i];
174 switch (info.level) {
175 case 0:
176 user0 = talloc_zero(tctx,
177 struct wkssvc_NetWkstaEnumUsersCtr0);
178 info.ctr.user0 = user0;
179 break;
180 case 1:
181 user1 = talloc_zero(tctx,
182 struct wkssvc_NetWkstaEnumUsersCtr1);
183 info.ctr.user1 = user1;
184 break;
185 default:
186 break;
189 r.in.server_name = dcerpc_server_name(p);
190 r.in.prefmaxlen = (uint32_t)-1;
191 r.in.info = r.out.info = &info;
192 r.in.resume_handle = r.out.resume_handle = &handle;
194 r.out.entries_read = &entries_read;
196 torture_comment(tctx, "testing NetWkstaEnumUsers level %u\n",
197 levels[i]);
199 status = dcerpc_wkssvc_NetWkstaEnumUsers(p, tctx, &r);
200 torture_assert_ntstatus_ok(tctx, status,
201 "NetWkstaEnumUsers failed");
202 torture_assert_werr_ok(tctx, r.out.result,
203 "NetWkstaEnumUsers failed");
206 return true;
209 static bool test_NetrWkstaUserGetInfo(struct torture_context *tctx,
210 struct dcerpc_pipe *p)
212 NTSTATUS status;
213 struct wkssvc_NetrWkstaUserGetInfo r;
214 union wkssvc_NetrWkstaUserInfo info;
215 const char *dom = lp_workgroup(tctx->lp_ctx);
216 struct cli_credentials *creds = cmdline_credentials;
217 const char *user = cli_credentials_get_username(creds);
218 int i;
220 const struct {
221 const char *unknown;
222 uint32_t level;
223 WERROR result;
224 } tests[] = {
225 { NULL, 0, WERR_NO_SUCH_LOGON_SESSION },
226 { NULL, 1, WERR_NO_SUCH_LOGON_SESSION },
227 { NULL, 1101, WERR_OK },
228 { dom, 0, WERR_INVALID_PARAM },
229 { dom, 1, WERR_INVALID_PARAM },
230 { dom, 1101, WERR_INVALID_PARAM },
231 { user, 0, WERR_INVALID_PARAM },
232 { user, 1, WERR_INVALID_PARAM },
233 { user, 1101, WERR_INVALID_PARAM },
236 for (i=0; i<ARRAY_SIZE(tests); i++) {
237 r.in.unknown = tests[i].unknown;
238 r.in.level = tests[i].level;
239 r.out.info = &info;
241 torture_comment(tctx, "testing NetrWkstaUserGetInfo level %u\n",
242 r.in.level);
244 status = dcerpc_wkssvc_NetrWkstaUserGetInfo(p, tctx, &r);
245 torture_assert_ntstatus_ok(tctx, status,
246 "NetrWkstaUserGetInfo failed");
247 torture_assert_werr_equal(tctx, r.out.result,
248 tests[i].result,
249 "NetrWkstaUserGetInfo failed");
252 return true;
255 static bool test_NetrUseEnum(struct torture_context *tctx,
256 struct dcerpc_pipe *p)
258 NTSTATUS status;
259 struct wkssvc_NetrUseEnum r;
260 uint32_t handle = 0;
261 uint32_t entries_read = 0;
262 struct wkssvc_NetrUseEnumInfo info;
263 struct wkssvc_NetrUseEnumCtr0 *use0;
264 struct wkssvc_NetrUseEnumCtr1 *use1;
265 struct wkssvc_NetrUseEnumCtr2 *use2;
266 uint32_t levels[] = { 0, 1, 2 };
267 int i;
269 for (i=0; i<ARRAY_SIZE(levels); i++) {
271 ZERO_STRUCT(info);
273 info.level = levels[i];
274 switch (info.level) {
275 case 0:
276 use0 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr0);
277 info.ctr.ctr0 = use0;
278 break;
279 case 1:
280 use1 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr1);
281 info.ctr.ctr1 = use1;
282 break;
283 case 2:
284 use2 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr2);
285 info.ctr.ctr2 = use2;
286 break;
287 default:
288 break;
291 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
292 r.in.prefmaxlen = (uint32_t)-1;
293 r.in.info = r.out.info = &info;
294 r.in.resume_handle = r.out.resume_handle = &handle;
296 r.out.entries_read = &entries_read;
298 torture_comment(tctx, "testing NetrUseEnum level %u\n",
299 levels[i]);
301 status = dcerpc_wkssvc_NetrUseEnum(p, tctx, &r);
302 torture_assert_ntstatus_ok(tctx, status,
303 "NetrUseEnum failed");
304 torture_assert_werr_ok(tctx, r.out.result,
305 "NetrUseEnum failed");
308 return true;
311 static bool test_NetrUseAdd(struct torture_context *tctx,
312 struct dcerpc_pipe *p)
314 NTSTATUS status;
315 struct wkssvc_NetrUseAdd r;
316 struct wkssvc_NetrUseInfo0 info0;
317 struct wkssvc_NetrUseInfo1 info1;
318 union wkssvc_NetrUseGetInfoCtr *ctr;
319 uint32_t parm_err = 0;
321 ctr = talloc(tctx, union wkssvc_NetrUseGetInfoCtr);
323 ZERO_STRUCT(info0);
325 info0.local = SMBTORTURE_USE_NAME;
326 info0.remote = "\\\\localhost\\c$";
328 ctr->info0 = &info0;
330 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
331 r.in.level = 0;
332 r.in.ctr = ctr;
333 r.in.parm_err = r.out.parm_err = &parm_err;
335 torture_comment(tctx, "testing NetrUseAdd level %u\n",
336 r.in.level);
338 status = dcerpc_wkssvc_NetrUseAdd(p, tctx, &r);
339 torture_assert_ntstatus_ok(tctx, status,
340 "NetrUseAdd failed");
341 torture_assert_werr_equal(tctx, r.out.result, WERR_UNKNOWN_LEVEL,
342 "NetrUseAdd failed");
344 ZERO_STRUCT(r);
345 ZERO_STRUCT(info1);
347 info1.local = SMBTORTURE_USE_NAME;
348 info1.remote = "\\\\localhost\\sysvol";
349 info1.password = NULL;
351 ctr->info1 = &info1;
353 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
354 r.in.level = 1;
355 r.in.ctr = ctr;
356 r.in.parm_err = r.out.parm_err = &parm_err;
358 torture_comment(tctx, "testing NetrUseAdd level %u\n",
359 r.in.level);
361 status = dcerpc_wkssvc_NetrUseAdd(p, tctx, &r);
362 torture_assert_ntstatus_ok(tctx, status,
363 "NetrUseAdd failed");
364 torture_assert_werr_ok(tctx, r.out.result,
365 "NetrUseAdd failed");
367 return true;
370 static bool test_NetrUseDel(struct torture_context *tctx,
371 struct dcerpc_pipe *p)
373 NTSTATUS status;
374 struct wkssvc_NetrUseDel r;
376 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
377 r.in.use_name = SMBTORTURE_USE_NAME;
378 r.in.force_cond = 0;
380 torture_comment(tctx, "testing NetrUseDel\n");
382 status = dcerpc_wkssvc_NetrUseDel(p, tctx, &r);
383 torture_assert_ntstatus_ok(tctx, status,
384 "NetrUseDel failed");
385 torture_assert_werr_ok(tctx, r.out.result,
386 "NetrUseDel failed");
387 return true;
390 static bool test_NetrUseGetInfo_level(struct torture_context *tctx,
391 struct dcerpc_pipe *p,
392 const char *use_name,
393 uint32_t level,
394 WERROR werr)
396 NTSTATUS status;
397 struct wkssvc_NetrUseGetInfo r;
398 union wkssvc_NetrUseGetInfoCtr ctr;
400 ZERO_STRUCT(ctr);
402 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
403 r.in.use_name = use_name;
404 r.in.level = level;
405 r.out.ctr = &ctr;
406 status = dcerpc_wkssvc_NetrUseGetInfo(p, tctx, &r);
408 torture_assert_ntstatus_ok(tctx, status,
409 "NetrUseGetInfo failed");
410 torture_assert_werr_equal(tctx, r.out.result, werr,
411 "NetrUseGetInfo failed");
412 return true;
415 static bool test_NetrUseGetInfo(struct torture_context *tctx,
416 struct dcerpc_pipe *p)
418 NTSTATUS status;
419 struct wkssvc_NetrUseEnum r;
420 uint32_t handle = 0;
421 uint32_t entries_read = 0;
422 struct wkssvc_NetrUseEnumInfo info;
423 struct wkssvc_NetrUseEnumCtr0 *use0;
424 uint32_t levels[] = { 0, 1, 2 };
425 const char *use_name = NULL;
426 int i, k;
428 ZERO_STRUCT(info);
430 info.level = 0;
431 use0 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr0);
432 info.ctr.ctr0 = use0;
434 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
435 r.in.prefmaxlen = (uint32_t)-1;
436 r.in.info = r.out.info = &info;
437 r.in.resume_handle = r.out.resume_handle = &handle;
438 r.out.entries_read = &entries_read;
440 status = dcerpc_wkssvc_NetrUseEnum(p, tctx, &r);
441 torture_assert_ntstatus_ok(tctx, status,
442 "NetrUseEnum failed");
443 torture_assert_werr_ok(tctx, r.out.result,
444 "NetrUseEnum failed");
446 for (k=0; k < r.out.info->ctr.ctr0->count; k++) {
448 use_name = r.out.info->ctr.ctr0->array[k].local;
450 for (i=0; i<ARRAY_SIZE(levels); i++) {
452 if (!test_NetrUseGetInfo_level(tctx, p, use_name,
453 levels[i],
454 WERR_OK))
456 if (levels[i] != 0) {
457 return false;
462 use_name = r.out.info->ctr.ctr0->array[k].remote;
464 for (i=0; i<ARRAY_SIZE(levels); i++) {
466 if (!test_NetrUseGetInfo_level(tctx, p, use_name,
467 levels[i],
468 WERR_NOT_CONNECTED))
470 if (levels[i] != 0) {
471 return false;
477 return true;
480 static bool test_NetrLogonDomainNameAdd(struct torture_context *tctx,
481 struct dcerpc_pipe *p)
483 NTSTATUS status;
484 struct wkssvc_NetrLogonDomainNameAdd r;
486 r.in.domain_name = lp_workgroup(tctx->lp_ctx);
488 torture_comment(tctx, "testing NetrLogonDomainNameAdd\n");
490 status = dcerpc_wkssvc_NetrLogonDomainNameAdd(p, tctx, &r);
491 torture_assert_ntstatus_ok(tctx, status,
492 "NetrLogonDomainNameAdd failed");
493 torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED,
494 "NetrLogonDomainNameAdd failed");
495 return true;
498 static bool test_NetrLogonDomainNameDel(struct torture_context *tctx,
499 struct dcerpc_pipe *p)
501 NTSTATUS status;
502 struct wkssvc_NetrLogonDomainNameDel r;
504 r.in.domain_name = lp_workgroup(tctx->lp_ctx);
506 torture_comment(tctx, "testing NetrLogonDomainNameDel\n");
508 status = dcerpc_wkssvc_NetrLogonDomainNameDel(p, tctx, &r);
509 torture_assert_ntstatus_ok(tctx, status,
510 "NetrLogonDomainNameDel failed");
511 torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED,
512 "NetrLogonDomainNameDel failed");
513 return true;
516 static bool test_NetrEnumerateComputerNames_level(struct torture_context *tctx,
517 struct dcerpc_pipe *p,
518 uint16_t level,
519 const char ***names,
520 int *num_names)
522 NTSTATUS status;
523 struct wkssvc_NetrEnumerateComputerNames r;
524 struct wkssvc_ComputerNamesCtr *ctr;
525 int i;
527 ctr = talloc_zero(tctx, struct wkssvc_ComputerNamesCtr);
529 r.in.server_name = dcerpc_server_name(p);
530 r.in.name_type = level;
531 r.in.Reserved = 0;
532 r.out.ctr = &ctr;
534 torture_comment(tctx, "testing NetrEnumerateComputerNames level %u\n",
535 r.in.name_type);
537 status = dcerpc_wkssvc_NetrEnumerateComputerNames(p, tctx, &r);
538 torture_assert_ntstatus_ok(tctx, status,
539 "NetrEnumerateComputerNames failed");
540 torture_assert_werr_ok(tctx, r.out.result,
541 "NetrEnumerateComputerNames failed");
543 if ((level == NetPrimaryComputerName) && ctr->count != 1) {
544 torture_comment(tctx,
545 "NetrEnumerateComputerNames did not return one "
546 "name but %u\n", ctr->count);
547 return false;
550 if (names && num_names) {
551 *num_names = 0;
552 *names = NULL;
553 for (i=0; i<ctr->count; i++) {
554 if (!add_string_to_array(tctx,
555 ctr->computer_name[i].string,
556 names,
557 num_names))
559 return false;
564 return true;
567 static bool test_NetrEnumerateComputerNames(struct torture_context *tctx,
568 struct dcerpc_pipe *p)
570 uint16_t levels[] = {0,1,2};
571 int i;
573 for (i=0; i<ARRAY_SIZE(levels); i++) {
575 if (!test_NetrEnumerateComputerNames_level(tctx,
577 levels[i],
578 NULL, NULL))
580 return false;
584 return true;
587 static bool test_NetrValidateName(struct torture_context *tctx,
588 struct dcerpc_pipe *p)
590 NTSTATUS status;
591 struct wkssvc_NetrValidateName r;
592 uint16_t levels[] = {0,1,2,3,4,5};
593 int i;
595 for (i=0; i<ARRAY_SIZE(levels); i++) {
597 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
598 r.in.name = lp_workgroup(tctx->lp_ctx);
599 r.in.Account = NULL;
600 r.in.Password = NULL;
601 r.in.name_type = levels[i];
603 torture_comment(tctx, "testing NetrValidateName level %u\n",
604 r.in.name_type);
606 status = dcerpc_wkssvc_NetrValidateName(p, tctx, &r);
607 torture_assert_ntstatus_ok(tctx, status,
608 "NetrValidateName failed");
609 torture_assert_werr_equal(tctx, r.out.result,
610 WERR_NOT_SUPPORTED,
611 "NetrValidateName failed");
614 return true;
617 static bool test_NetrValidateName2(struct torture_context *tctx,
618 struct dcerpc_pipe *p)
620 NTSTATUS status;
621 struct wkssvc_NetrValidateName2 r;
622 uint16_t levels[] = {0,1,2,3,4,5};
623 int i;
625 for (i=0; i<ARRAY_SIZE(levels); i++) {
627 r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
628 r.in.name = lp_workgroup(tctx->lp_ctx);
629 r.in.Account = NULL;
630 r.in.EncryptedPassword = NULL;
631 r.in.name_type = levels[i];
633 torture_comment(tctx, "testing NetrValidateName2 level %u\n",
634 r.in.name_type);
636 status = dcerpc_wkssvc_NetrValidateName2(p, tctx, &r);
637 torture_assert_ntstatus_ok(tctx, status,
638 "NetrValidateName2 failed");
639 torture_assert_werr_equal(tctx, r.out.result,
640 WERR_RPC_E_REMOTE_DISABLED,
641 "NetrValidateName2 failed");
644 return true;
647 static bool test_NetrAddAlternateComputerName(struct torture_context *tctx,
648 struct dcerpc_pipe *p)
650 NTSTATUS status;
651 struct wkssvc_NetrAddAlternateComputerName r;
652 const char **names = NULL;
653 int num_names = 0;
654 int i;
656 r.in.server_name = dcerpc_server_name(p);
657 r.in.NewAlternateMachineName = SMBTORTURE_ALTERNATE_NAME;
658 r.in.Account = NULL;
659 r.in.EncryptedPassword = NULL;
660 r.in.Reserved = 0;
662 torture_comment(tctx, "testing NetrAddAlternateComputerName\n");
664 status = dcerpc_wkssvc_NetrAddAlternateComputerName(p, tctx, &r);
665 torture_assert_ntstatus_ok(tctx, status,
666 "NetrAddAlternateComputerName failed");
667 torture_assert_werr_ok(tctx, r.out.result,
668 "NetrAddAlternateComputerName failed");
670 if (!test_NetrEnumerateComputerNames_level(tctx, p,
671 NetAlternateComputerNames,
672 &names, &num_names))
674 return false;
677 for (i=0; i<num_names; i++) {
678 if (strequal(names[i], SMBTORTURE_ALTERNATE_NAME)) {
679 return true;
683 torture_comment(tctx, "new alternate name not set\n");
685 return false;
688 static bool test_NetrRemoveAlternateComputerName(struct torture_context *tctx,
689 struct dcerpc_pipe *p)
691 NTSTATUS status;
692 struct wkssvc_NetrRemoveAlternateComputerName r;
693 const char **names = NULL;
694 int num_names = 0;
695 int i;
697 r.in.server_name = dcerpc_server_name(p);
698 r.in.AlternateMachineNameToRemove = SMBTORTURE_ALTERNATE_NAME;
699 r.in.Account = NULL;
700 r.in.EncryptedPassword = NULL;
701 r.in.Reserved = 0;
703 torture_comment(tctx, "testing NetrRemoveAlternateComputerName\n");
705 status = dcerpc_wkssvc_NetrRemoveAlternateComputerName(p, tctx, &r);
706 torture_assert_ntstatus_ok(tctx, status,
707 "NetrRemoveAlternateComputerName failed");
708 torture_assert_werr_ok(tctx, r.out.result,
709 "NetrRemoveAlternateComputerName failed");
711 if (!test_NetrEnumerateComputerNames_level(tctx, p,
712 NetAlternateComputerNames,
713 &names, &num_names))
715 return false;
718 for (i=0; i<num_names; i++) {
719 if (strequal(names[i], SMBTORTURE_ALTERNATE_NAME)) {
720 return false;
724 return true;
727 static bool test_NetrSetPrimaryComputername_name(struct torture_context *tctx,
728 struct dcerpc_pipe *p,
729 const char *name)
731 NTSTATUS status;
732 struct wkssvc_NetrSetPrimaryComputername r;
734 r.in.server_name = dcerpc_server_name(p);
735 r.in.primary_name = name;
736 r.in.Account = NULL;
737 r.in.EncryptedPassword = NULL;
738 r.in.Reserved = 0;
740 status = dcerpc_wkssvc_NetrSetPrimaryComputername(p, tctx, &r);
741 torture_assert_ntstatus_ok(tctx, status,
742 "NetrSetPrimaryComputername failed");
743 torture_assert_werr_ok(tctx, r.out.result,
744 "NetrSetPrimaryComputername failed");
745 return true;
749 static bool test_NetrSetPrimaryComputername(struct torture_context *tctx,
750 struct dcerpc_pipe *p)
753 add alternate,
754 check if there
755 store old primary
756 set new primary (alternate)
757 check if there
758 later: check if del is possible
759 set primary back to origin
760 check if there
761 del alternate
764 const char **names_o = NULL, **names = NULL;
765 int num_names_o = 0, num_names = 0;
767 torture_comment(tctx, "testing NetrSetPrimaryComputername\n");
769 if (!test_NetrAddAlternateComputerName(tctx, p)) {
770 return false;
773 if (!test_NetrEnumerateComputerNames_level(tctx, p,
774 NetPrimaryComputerName,
775 &names_o, &num_names_o))
777 return false;
780 if (num_names_o != 1) {
781 return false;
784 if (!test_NetrSetPrimaryComputername_name(tctx, p,
785 SMBTORTURE_ALTERNATE_NAME))
787 return false;
790 if (!test_NetrEnumerateComputerNames_level(tctx, p,
791 NetPrimaryComputerName,
792 &names, &num_names))
794 return false;
797 if (num_names != 1) {
798 return false;
801 if (!strequal(names[0], SMBTORTURE_ALTERNATE_NAME)) {
802 torture_comment(tctx,
803 "name mismatch (%s != %s) after NetrSetPrimaryComputername!\n",
804 names[0], SMBTORTURE_ALTERNATE_NAME);
805 /*return false */;
808 if (!test_NetrSetPrimaryComputername_name(tctx, p,
809 names_o[0]))
811 return false;
814 if (!test_NetrRemoveAlternateComputerName(tctx, p)) {
815 return false;
819 return true;
822 static bool test_NetrRenameMachineInDomain(struct torture_context *tctx,
823 struct dcerpc_pipe *p)
825 NTSTATUS status;
826 struct wkssvc_NetrRenameMachineInDomain r;
828 r.in.server_name = dcerpc_server_name(p);
829 r.in.NewMachineName = SMBTORTURE_MACHINE_NAME;
830 r.in.Account = NULL;
831 r.in.password = NULL;
832 r.in.RenameOptions = 0;
834 torture_comment(tctx, "testing NetrRenameMachineInDomain\n");
836 status = dcerpc_wkssvc_NetrRenameMachineInDomain(p, tctx, &r);
837 torture_assert_ntstatus_ok(tctx, status,
838 "NetrRenameMachineInDomain failed");
839 torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED,
840 "NetrRenameMachineInDomain failed");
841 return true;
844 static bool test_NetrRenameMachineInDomain2_name(struct torture_context *tctx,
845 struct dcerpc_pipe *p,
846 const char *new_name)
848 NTSTATUS status;
849 struct wkssvc_NetrRenameMachineInDomain2 r;
851 r.in.server_name = dcerpc_server_name(p);
852 r.in.NewMachineName = new_name;
853 r.in.Account = NULL;
854 r.in.EncryptedPassword = NULL;
855 r.in.RenameOptions = 0;
857 status = dcerpc_wkssvc_NetrRenameMachineInDomain2(p, tctx, &r);
858 torture_assert_ntstatus_ok(tctx, status,
859 "NetrRenameMachineInDomain2 failed");
860 torture_assert_werr_ok(tctx, r.out.result,
861 "NetrRenameMachineInDomain2 failed");
862 return true;
865 static bool test_NetrRenameMachineInDomain2(struct torture_context *tctx,
866 struct dcerpc_pipe *p)
868 const char **names_o = NULL, **names = NULL;
869 int num_names_o = 0, num_names = 0;
871 torture_comment(tctx, "testing NetrRenameMachineInDomain2\n");
873 if (!test_NetrEnumerateComputerNames_level(tctx, p,
874 NetPrimaryComputerName,
875 &names_o, &num_names_o))
877 return false;
880 if (num_names_o != 1) {
881 return false;
884 if (!test_NetrRenameMachineInDomain2_name(tctx, p,
885 SMBTORTURE_MACHINE_NAME))
887 return false;
890 if (!test_NetrEnumerateComputerNames_level(tctx, p,
891 NetPrimaryComputerName,
892 &names, &num_names))
894 return false;
897 if (num_names != 1) {
898 return false;
901 if (strequal(names[0], names_o[0])) {
902 test_NetrRenameMachineInDomain2_name(tctx, p, names_o[0]);
903 return false;
906 if (!strequal(names[0], SMBTORTURE_MACHINE_NAME)) {
907 test_NetrRenameMachineInDomain2_name(tctx, p, names_o[0]);
908 return false;
911 if (!test_NetrRenameMachineInDomain2_name(tctx, p, names_o[0]))
913 return false;
916 if (!test_NetrEnumerateComputerNames_level(tctx, p,
917 NetPrimaryComputerName,
918 &names, &num_names))
920 return false;
923 if (num_names != 1) {
924 return false;
927 if (!strequal(names[0], names_o[0])) {
928 return false;
931 return true;
934 static bool test_NetrWorkstationStatisticsGet(struct torture_context *tctx,
935 struct dcerpc_pipe *p)
937 NTSTATUS status;
938 struct wkssvc_NetrWorkstationStatisticsGet r;
939 struct wkssvc_NetrWorkstationStatistics *info;
941 ZERO_STRUCT(r);
943 info = talloc_zero(tctx, struct wkssvc_NetrWorkstationStatistics);
945 r.in.server_name = dcerpc_server_name(p);
946 r.out.info = &info;
948 torture_comment(tctx, "testing NetrWorkstationStatisticsGet\n");
950 status = dcerpc_wkssvc_NetrWorkstationStatisticsGet(p, tctx, &r);
951 torture_assert_ntstatus_ok(tctx, status,
952 "NetrWorkstationStatisticsGet failed");
953 torture_assert_werr_ok(tctx, r.out.result,
954 "NetrWorkstationStatisticsGet failed");
955 return true;
958 /* only succeeds as long as the local messenger service is running - Guenther */
960 static bool test_NetrMessageBufferSend(struct torture_context *tctx,
961 struct dcerpc_pipe *p)
963 NTSTATUS status;
964 struct wkssvc_NetrMessageBufferSend r;
965 const char *message = SMBTORTURE_MESSAGE;
966 size_t size;
967 uint8_t *msg;
969 push_ucs2_talloc(tctx, (void **)&msg, message, &size);
971 r.in.server_name = dcerpc_server_name(p);
972 r.in.message_name = dcerpc_server_name(p);
973 r.in.message_sender_name = dcerpc_server_name(p);
974 r.in.message_buffer = msg;
975 r.in.message_size = size;
977 torture_comment(tctx, "testing NetrMessageBufferSend\n");
979 status = dcerpc_wkssvc_NetrMessageBufferSend(p, tctx, &r);
980 torture_assert_ntstatus_ok(tctx, status,
981 "NetrMessageBufferSend failed");
982 torture_assert_werr_ok(tctx, r.out.result,
983 "NetrMessageBufferSend failed");
984 return true;
987 static bool test_NetrGetJoinInformation(struct torture_context *tctx,
988 struct dcerpc_pipe *p)
990 NTSTATUS status;
991 struct wkssvc_NetrGetJoinInformation r;
992 enum wkssvc_NetJoinStatus join_status;
993 const char *name_buffer = "";
995 r.in.server_name = dcerpc_server_name(p);
996 r.in.name_buffer = r.out.name_buffer = &name_buffer;
997 r.out.name_type = &join_status;
999 torture_comment(tctx, "testing NetrGetJoinInformation\n");
1001 status = dcerpc_wkssvc_NetrGetJoinInformation(p, tctx, &r);
1002 torture_assert_ntstatus_ok(tctx, status,
1003 "NetrGetJoinInformation failed");
1004 torture_assert_werr_ok(tctx, r.out.result,
1005 "NetrGetJoinInformation failed");
1006 return true;
1009 static bool test_GetJoinInformation(struct torture_context *tctx,
1010 struct dcerpc_pipe *p,
1011 enum wkssvc_NetJoinStatus *join_status_p,
1012 const char **name)
1014 NTSTATUS status;
1015 struct wkssvc_NetrGetJoinInformation r;
1016 enum wkssvc_NetJoinStatus join_status;
1017 const char *name_buffer = "";
1019 r.in.server_name = dcerpc_server_name(p);
1020 r.in.name_buffer = r.out.name_buffer = &name_buffer;
1021 r.out.name_type = &join_status;
1023 status = dcerpc_wkssvc_NetrGetJoinInformation(p, tctx, &r);
1024 torture_assert_ntstatus_ok(tctx, status,
1025 "NetrGetJoinInformation failed");
1026 torture_assert_werr_ok(tctx, r.out.result,
1027 "NetrGetJoinInformation failed");
1029 if (join_status_p) {
1030 *join_status_p = join_status;
1033 if (*name) {
1034 *name = talloc_strdup(tctx, name_buffer);
1037 return true;
1041 static bool test_NetrGetJoinableOus(struct torture_context *tctx,
1042 struct dcerpc_pipe *p)
1044 NTSTATUS status;
1045 struct wkssvc_NetrGetJoinableOus r;
1046 uint32_t num_ous = 0;
1047 const char **ous = NULL;
1049 r.in.server_name = dcerpc_server_name(p);
1050 r.in.domain_name = lp_workgroup(tctx->lp_ctx);
1051 r.in.Account = NULL;
1052 r.in.unknown = NULL;
1053 r.in.num_ous = r.out.num_ous = &num_ous;
1054 r.out.ous = &ous;
1056 torture_comment(tctx, "testing NetrGetJoinableOus\n");
1058 status = dcerpc_wkssvc_NetrGetJoinableOus(p, tctx, &r);
1059 torture_assert_ntstatus_ok(tctx, status, "NetrGetJoinableOus failed");
1060 torture_assert_werr_equal(tctx, r.out.result,
1061 WERR_NOT_SUPPORTED,
1062 "NetrGetJoinableOus failed");
1064 return true;
1067 static bool test_NetrGetJoinableOus2(struct torture_context *tctx,
1068 struct dcerpc_pipe *p)
1070 NTSTATUS status;
1071 struct wkssvc_NetrGetJoinableOus2 r;
1072 uint32_t num_ous = 0;
1073 const char **ous = NULL;
1075 r.in.server_name = dcerpc_server_name(p);
1076 r.in.domain_name = lp_workgroup(tctx->lp_ctx);
1077 r.in.Account = NULL;
1078 r.in.EncryptedPassword = NULL;
1079 r.in.num_ous = r.out.num_ous = &num_ous;
1080 r.out.ous = &ous;
1082 torture_comment(tctx, "testing NetrGetJoinableOus2\n");
1084 status = dcerpc_wkssvc_NetrGetJoinableOus2(p, tctx, &r);
1085 torture_assert_ntstatus_ok(tctx, status, "NetrGetJoinableOus2 failed");
1086 torture_assert_werr_equal(tctx, r.out.result,
1087 WERR_RPC_E_REMOTE_DISABLED,
1088 "NetrGetJoinableOus2 failed");
1090 return true;
1093 static bool test_NetrUnjoinDomain(struct torture_context *tctx,
1094 struct dcerpc_pipe *p)
1096 NTSTATUS status;
1097 struct wkssvc_NetrUnjoinDomain r;
1098 struct cli_credentials *creds = cmdline_credentials;
1099 const char *user = cli_credentials_get_username(creds);
1100 const char *admin_account = NULL;
1102 admin_account = talloc_asprintf(tctx, "%s\\%s",
1103 lp_workgroup(tctx->lp_ctx),
1104 user);
1106 r.in.server_name = dcerpc_server_name(p);
1107 r.in.Account = admin_account;
1108 r.in.password = NULL;
1109 r.in.unjoin_flags = 0;
1111 torture_comment(tctx, "testing NetrUnjoinDomain\n");
1113 status = dcerpc_wkssvc_NetrUnjoinDomain(p, tctx, &r);
1114 torture_assert_ntstatus_ok(tctx, status,
1115 "NetrUnjoinDomain failed");
1116 torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED,
1117 "NetrUnjoinDomain failed");
1118 return true;
1121 static bool test_NetrJoinDomain(struct torture_context *tctx,
1122 struct dcerpc_pipe *p)
1124 NTSTATUS status;
1125 struct wkssvc_NetrJoinDomain r;
1126 struct cli_credentials *creds = cmdline_credentials;
1127 const char *user = cli_credentials_get_username(creds);
1128 const char *admin_account = NULL;
1130 admin_account = talloc_asprintf(tctx, "%s\\%s",
1131 lp_workgroup(tctx->lp_ctx),
1132 user);
1134 r.in.server_name = dcerpc_server_name(p);
1135 r.in.domain_name = lp_realm(tctx->lp_ctx);
1136 r.in.account_ou = NULL;
1137 r.in.Account = admin_account;
1138 r.in.password = NULL;
1139 r.in.join_flags = 0;
1141 torture_comment(tctx, "testing NetrJoinDomain\n");
1143 status = dcerpc_wkssvc_NetrJoinDomain(p, tctx, &r);
1144 torture_assert_ntstatus_ok(tctx, status,
1145 "NetrJoinDomain failed");
1146 torture_assert_werr_equal(tctx, r.out.result, WERR_NOT_SUPPORTED,
1147 "NetrJoinDomain failed");
1148 return true;
1151 /* encode a wkssvc_PasswordBuffer for remote joining/unjoining:
1153 * similar to samr_CryptPasswordEx. Different: 8byte confounder (instead of
1154 * 16byte), confounder in front of the 516 byte buffer (instead of after that
1155 * buffer), calling MD5Update() first with session_key and then with confounder
1156 * (vice versa in samr) - Guenther */
1158 static void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx,
1159 const char *pwd,
1160 DATA_BLOB *session_key,
1161 struct wkssvc_PasswordBuffer *pwd_buf)
1163 uint8_t buffer[516];
1164 struct MD5Context ctx;
1166 DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
1168 int confounder_len = 8;
1169 uint8_t confounder[8];
1171 encode_pw_buffer(buffer, pwd, STR_UNICODE);
1173 generate_random_buffer((uint8_t *)confounder, confounder_len);
1175 MD5Init(&ctx);
1176 MD5Update(&ctx, session_key->data, session_key->length);
1177 MD5Update(&ctx, confounder, confounder_len);
1178 MD5Final(confounded_session_key.data, &ctx);
1180 arcfour_crypt_blob(buffer, 516, &confounded_session_key);
1182 memcpy(&pwd_buf->data[0], confounder, confounder_len);
1183 memcpy(&pwd_buf->data[8], buffer, 516);
1185 data_blob_free(&confounded_session_key);
1189 * prerequisites for remotely joining an unjoined XP SP2 workstation:
1190 * - firewall needs to be disabled (or open for ncacn_np access)
1191 * - HKLM\System\CurrentControlSet\Control\Lsa\forceguest needs to 0
1192 * see also:
1193 * http://support.microsoft.com/kb/294355/EN-US/ and
1194 * http://support.microsoft.com/kb/290403/EN-US/
1197 static bool test_NetrJoinDomain2(struct torture_context *tctx,
1198 struct dcerpc_pipe *p)
1200 NTSTATUS status;
1201 struct wkssvc_NetrJoinDomain2 r;
1202 const char *domain_admin_account = NULL;
1203 const char *domain_admin_password = NULL;
1204 const char *domain_name = NULL;
1205 struct wkssvc_PasswordBuffer pwd_buf;
1206 enum wkssvc_NetJoinStatus join_status;
1207 const char *join_name = NULL;
1208 WERROR expected_err;
1209 DATA_BLOB session_key;
1211 /* FIXME: this test assumes to join workstations / servers and does not
1212 * handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
1214 if (!test_GetJoinInformation(tctx, p, &join_status, &join_name))
1216 return false;
1219 switch (join_status) {
1220 case NET_SETUP_DOMAIN_NAME:
1221 expected_err = WERR_SETUP_ALREADY_JOINED;
1222 break;
1223 case NET_SETUP_UNKNOWN_STATUS:
1224 case NET_SETUP_UNJOINED:
1225 case NET_SETUP_WORKGROUP_NAME:
1226 default:
1227 expected_err = WERR_OK;
1228 break;
1231 domain_admin_account = torture_setting_string(tctx, "domain_admin_account", NULL);
1233 domain_admin_password = torture_setting_string(tctx, "domain_admin_password", NULL);
1235 domain_name = torture_setting_string(tctx, "domain_name", NULL);
1237 if ((domain_admin_account == NULL) ||
1238 (domain_admin_password == NULL) ||
1239 (domain_name == NULL)) {
1240 torture_comment(tctx, "not enough input parameter\n");
1241 return false;
1244 status = dcerpc_fetch_session_key(p, &session_key);
1245 if (!NT_STATUS_IS_OK(status)) {
1246 return false;
1249 encode_wkssvc_join_password_buffer(tctx, domain_admin_password,
1250 &session_key, &pwd_buf);
1252 r.in.server_name = dcerpc_server_name(p);
1253 r.in.domain_name = domain_name;
1254 r.in.account_ou = NULL;
1255 r.in.admin_account = domain_admin_account;
1256 r.in.encrypted_password = &pwd_buf;
1257 r.in.join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE |
1258 WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE;
1260 torture_comment(tctx, "testing NetrJoinDomain2 (assuming non-DC)\n");
1262 status = dcerpc_wkssvc_NetrJoinDomain2(p, tctx, &r);
1263 torture_assert_ntstatus_ok(tctx, status,
1264 "NetrJoinDomain2 failed");
1265 torture_assert_werr_equal(tctx, r.out.result, expected_err,
1266 "NetrJoinDomain2 failed");
1268 if (!test_GetJoinInformation(tctx, p, &join_status, &join_name))
1270 return false;
1273 if (join_status != NET_SETUP_DOMAIN_NAME) {
1274 torture_comment(tctx,
1275 "Join verify failed: got %d\n", join_status);
1276 return false;
1279 return true;
1282 static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
1283 struct dcerpc_pipe *p)
1285 NTSTATUS status;
1286 struct wkssvc_NetrUnjoinDomain2 r;
1287 const char *domain_admin_account = NULL;
1288 const char *domain_admin_password = NULL;
1289 struct wkssvc_PasswordBuffer pwd_buf;
1290 enum wkssvc_NetJoinStatus join_status;
1291 const char *join_name = NULL;
1292 WERROR expected_err;
1293 DATA_BLOB session_key;
1295 /* FIXME: this test assumes to join workstations / servers and does not
1296 * handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
1298 if (!test_GetJoinInformation(tctx, p, &join_status, &join_name))
1300 return false;
1303 switch (join_status) {
1304 case NET_SETUP_UNJOINED:
1305 expected_err = WERR_SETUP_NOT_JOINED;
1306 break;
1307 case NET_SETUP_DOMAIN_NAME:
1308 case NET_SETUP_UNKNOWN_STATUS:
1309 case NET_SETUP_WORKGROUP_NAME:
1310 default:
1311 expected_err = WERR_OK;
1312 break;
1315 domain_admin_account = torture_setting_string(tctx, "domain_admin_account", NULL);
1317 domain_admin_password = torture_setting_string(tctx, "domain_admin_password", NULL);
1319 if ((domain_admin_account == NULL) ||
1320 (domain_admin_password == NULL)) {
1321 torture_comment(tctx, "not enough input parameter\n");
1322 return false;
1325 status = dcerpc_fetch_session_key(p, &session_key);
1326 if (!NT_STATUS_IS_OK(status)) {
1327 return false;
1330 encode_wkssvc_join_password_buffer(tctx, domain_admin_password,
1331 &session_key, &pwd_buf);
1333 r.in.server_name = dcerpc_server_name(p);
1334 r.in.account = domain_admin_account;
1335 r.in.encrypted_password = &pwd_buf;
1336 r.in.unjoin_flags = 0;
1338 torture_comment(tctx, "testing NetrUnjoinDomain2 (assuming non-DC)\n");
1340 status = dcerpc_wkssvc_NetrUnjoinDomain2(p, tctx, &r);
1341 torture_assert_ntstatus_ok(tctx, status,
1342 "NetrUnjoinDomain2 failed");
1343 torture_assert_werr_equal(tctx, r.out.result, expected_err,
1344 "NetrUnjoinDomain2 failed");
1346 if (!test_GetJoinInformation(tctx, p, &join_status, &join_name))
1348 return false;
1351 switch (join_status) {
1352 case NET_SETUP_UNJOINED:
1353 case NET_SETUP_WORKGROUP_NAME:
1354 break;
1355 case NET_SETUP_UNKNOWN_STATUS:
1356 case NET_SETUP_DOMAIN_NAME:
1357 default:
1358 torture_comment(tctx,
1359 "Unjoin verify failed: got %d\n", join_status);
1360 return false;
1363 return true;
1367 struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
1369 struct torture_suite *suite;
1370 struct torture_rpc_tcase *tcase;
1371 struct torture_test *test;
1373 suite = torture_suite_create(mem_ctx, "WKSSVC");
1374 tcase = torture_suite_add_rpc_iface_tcase(suite, "wkssvc",
1375 &ndr_table_wkssvc);
1377 torture_rpc_tcase_add_test(tcase, "NetWkstaGetInfo",
1378 test_NetWkstaGetInfo);
1380 torture_rpc_tcase_add_test(tcase, "NetWkstaTransportEnum",
1381 test_NetWkstaTransportEnum);
1382 torture_rpc_tcase_add_test(tcase, "NetrWkstaTransportDel",
1383 test_NetrWkstaTransportDel);
1384 torture_rpc_tcase_add_test(tcase, "NetrWkstaTransportAdd",
1385 test_NetrWkstaTransportAdd);
1387 torture_rpc_tcase_add_test(tcase, "NetWkstaEnumUsers",
1388 test_NetWkstaEnumUsers);
1389 torture_rpc_tcase_add_test(tcase, "NetrWkstaUserGetInfo",
1390 test_NetrWkstaUserGetInfo);
1392 torture_rpc_tcase_add_test(tcase, "NetrUseDel",
1393 test_NetrUseDel);
1394 torture_rpc_tcase_add_test(tcase, "NetrUseGetInfo",
1395 test_NetrUseGetInfo);
1396 torture_rpc_tcase_add_test(tcase, "NetrUseEnum",
1397 test_NetrUseEnum);
1398 torture_rpc_tcase_add_test(tcase, "NetrUseAdd",
1399 test_NetrUseAdd);
1401 torture_rpc_tcase_add_test(tcase, "NetrValidateName",
1402 test_NetrValidateName);
1403 torture_rpc_tcase_add_test(tcase, "NetrValidateName2",
1404 test_NetrValidateName2);
1405 torture_rpc_tcase_add_test(tcase, "NetrLogonDomainNameDel",
1406 test_NetrLogonDomainNameDel);
1407 torture_rpc_tcase_add_test(tcase, "NetrLogonDomainNameAdd",
1408 test_NetrLogonDomainNameAdd);
1409 torture_rpc_tcase_add_test(tcase, "NetrRemoveAlternateComputerName",
1410 test_NetrRemoveAlternateComputerName);
1411 torture_rpc_tcase_add_test(tcase, "NetrAddAlternateComputerName",
1412 test_NetrAddAlternateComputerName);
1413 test = torture_rpc_tcase_add_test(tcase, "NetrSetPrimaryComputername",
1414 test_NetrSetPrimaryComputername);
1415 test->dangerous = true;
1416 test = torture_rpc_tcase_add_test(tcase, "NetrRenameMachineInDomain",
1417 test_NetrRenameMachineInDomain);
1418 test->dangerous = true;
1419 test = torture_rpc_tcase_add_test(tcase, "NetrRenameMachineInDomain2",
1420 test_NetrRenameMachineInDomain2);
1421 test->dangerous = true;
1422 torture_rpc_tcase_add_test(tcase, "NetrEnumerateComputerNames",
1423 test_NetrEnumerateComputerNames);
1425 test = torture_rpc_tcase_add_test(tcase, "NetrJoinDomain2",
1426 test_NetrJoinDomain2);
1427 test->dangerous = true;
1428 test = torture_rpc_tcase_add_test(tcase, "NetrUnjoinDomain2",
1429 test_NetrUnjoinDomain2);
1430 test->dangerous = true;
1432 torture_rpc_tcase_add_test(tcase, "NetrJoinDomain",
1433 test_NetrJoinDomain);
1434 test->dangerous = true;
1435 torture_rpc_tcase_add_test(tcase, "NetrUnjoinDomain",
1436 test_NetrUnjoinDomain);
1437 test->dangerous = true;
1438 torture_rpc_tcase_add_test(tcase, "NetrGetJoinInformation",
1439 test_NetrGetJoinInformation);
1440 torture_rpc_tcase_add_test(tcase, "NetrGetJoinableOus",
1441 test_NetrGetJoinableOus);
1442 torture_rpc_tcase_add_test(tcase, "NetrGetJoinableOus2",
1443 test_NetrGetJoinableOus2);
1445 torture_rpc_tcase_add_test(tcase, "NetrWorkstationStatisticsGet",
1446 test_NetrWorkstationStatisticsGet);
1447 torture_rpc_tcase_add_test(tcase, "NetrMessageBufferSend",
1448 test_NetrMessageBufferSend);
1450 return suite;