r14720: Add torture_context argument to all torture tests
[kai/samba.git] / source4 / torture / rpc / join.c
1 #include "includes.h"
2 #include "libnet/libnet.h"
3
4 #include "auth/credentials/credentials.h"
5 #include "torture/rpc/rpc.h"
6
7 #define TORTURE_NETBIOS_NAME "smbtorturejoin"
8
9
10 BOOL torture_rpc_join(struct torture_context *torture)
11 {  
12         struct test_join *tj;
13         struct cli_credentials *machine_account;
14
15         /* Join domain as a member server. */
16         tj = torture_join_domain(TORTURE_NETBIOS_NAME,
17                                  ACB_WSTRUST,
18                                  &machine_account);
19
20         if (!tj) {
21                 DEBUG(0, ("%s failed to join domain\n",
22                           TORTURE_NETBIOS_NAME));
23                 return False;
24         }
25         
26         /* Leave domain. */                          
27         torture_leave_domain(tj);
28         
29         /* Join domain as a domain controller. */
30         tj = torture_join_domain(TORTURE_NETBIOS_NAME,
31                                  ACB_SVRTRUST,
32                                  &machine_account);
33         if (!tj) {
34                 DEBUG(0, ("%s failed to join domain\n",
35                           TORTURE_NETBIOS_NAME));
36                 return False;
37         }
38
39         /* Leave domain. */
40         torture_leave_domain(tj);
41
42         return True;
43 }
44