2 #include "libnet/libnet.h"
3 #include "libcli/libcli.h"
5 #include "auth/credentials/credentials.h"
6 #include "torture/rpc/rpc.h"
8 #include "libcli/resolve/resolve.h"
9 #include "param/param.h"
11 #define TORTURE_NETBIOS_NAME "smbtorturejoin"
14 bool torture_rpc_join(struct torture_context *torture)
18 struct cli_credentials *machine_account;
19 struct smbcli_state *cli;
20 const char *host = torture_setting_string(torture, "host", NULL);
21 struct smbcli_options options;
22 struct smbcli_session_options session_options;
24 /* Join domain as a member server. */
25 tj = torture_join_domain(torture,
31 DEBUG(0, ("%s failed to join domain as workstation\n",
32 TORTURE_NETBIOS_NAME));
36 lp_smbcli_options(torture->lp_ctx, &options);
37 lp_smbcli_session_options(torture->lp_ctx, &session_options);
39 status = smbcli_full_connection(tj, &cli, host,
40 lp_smb_ports(torture->lp_ctx),
43 lp_resolve_context(torture->lp_ctx),
44 torture->ev, &options, &session_options);
45 if (!NT_STATUS_IS_OK(status)) {
46 DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
47 TORTURE_NETBIOS_NAME));
53 torture_leave_domain(torture, tj);
55 /* Join domain as a domain controller. */
56 tj = torture_join_domain(torture, TORTURE_NETBIOS_NAME,
60 DEBUG(0, ("%s failed to join domain as domain controller\n",
61 TORTURE_NETBIOS_NAME));
65 status = smbcli_full_connection(tj, &cli, host,
66 lp_smb_ports(torture->lp_ctx),
69 lp_resolve_context(torture->lp_ctx),
70 torture->ev, &options, &session_options);
71 if (!NT_STATUS_IS_OK(status)) {
72 DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
73 TORTURE_NETBIOS_NAME));
80 torture_leave_domain(torture, tj);