2 #include "libnet/libnet.h"
3 #include "libcli/libcli.h"
5 #include "auth/credentials/credentials.h"
6 #include "torture/rpc/rpc.h"
8 #include "param/param.h"
10 #define TORTURE_NETBIOS_NAME "smbtorturejoin"
13 bool torture_rpc_join(struct torture_context *torture)
17 struct cli_credentials *machine_account;
18 struct smbcli_state *cli;
19 const char *host = torture_setting_string(torture, "host", NULL);
21 /* Join domain as a member server. */
22 tj = torture_join_domain(torture,
28 DEBUG(0, ("%s failed to join domain as workstation\n",
29 TORTURE_NETBIOS_NAME));
33 status = smbcli_full_connection(tj, &cli, host,
34 lp_smb_ports(torture->lp_ctx),
38 if (!NT_STATUS_IS_OK(status)) {
39 DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
40 TORTURE_NETBIOS_NAME));
46 torture_leave_domain(tj);
48 /* Join domain as a domain controller. */
49 tj = torture_join_domain(torture, TORTURE_NETBIOS_NAME,
53 DEBUG(0, ("%s failed to join domain as domain controller\n",
54 TORTURE_NETBIOS_NAME));
58 status = smbcli_full_connection(tj, &cli, host,
59 lp_smb_ports(torture->lp_ctx),
63 if (!NT_STATUS_IS_OK(status)) {
64 DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
65 TORTURE_NETBIOS_NAME));
72 torture_leave_domain(tj);