summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/join.c
blob: 7aed76abf4688983bda0272916ddc8c5e3cdd1e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "includes.h"
#include "lib/cmdline/popt_common.h"
#include "libnet/libnet.h"
#include "lib/ldb/include/ldb.h"

#define TORTURE_NETBIOS_NAME "smbtorturejoin"


BOOL torture_rpc_join(void)
{  
	struct test_join *tj;
	struct cli_credentials *machine_account;

	/* Join domain as a member server. */
	tj = torture_join_domain(TORTURE_NETBIOS_NAME,
				 ACB_WSTRUST,
				 &machine_account);

	if (!tj) {
		DEBUG(0, ("%s failed to join domain\n",
			  TORTURE_NETBIOS_NAME));
		return False;
	}
        
	/* Leave domain. */                          
	torture_leave_domain(tj);
        
	/* Join domain as a domain controller. */
	tj = torture_join_domain(TORTURE_NETBIOS_NAME,
				 ACB_SVRTRUST,
				 &machine_account);
	if (!tj) {
		DEBUG(0, ("%s failed to join domain\n",
			  TORTURE_NETBIOS_NAME));
		return False;
	}

	/* Leave domain. */
	torture_leave_domain(tj);

	return True;
}