2 #include "libcli/libcli.h"
4 #include "torture/rpc/torture_rpc.h"
6 #include "libcli/resolve/resolve.h"
7 #include "param/param.h"
9 #define TORTURE_NETBIOS_NAME "smbtorturejoin"
12 bool torture_rpc_join(struct torture_context *torture)
16 struct cli_credentials *machine_account;
17 struct smbcli_state *cli;
18 const char *host = torture_setting_string(torture, "host", NULL);
19 struct smbcli_options options;
20 struct smbcli_session_options session_options;
22 /* Join domain as a member server. */
23 tj = torture_join_domain(torture,
29 DEBUG(0, ("%s failed to join domain as workstation\n",
30 TORTURE_NETBIOS_NAME));
34 lpcfg_smbcli_options(torture->lp_ctx, &options);
35 lpcfg_smbcli_session_options(torture->lp_ctx, &session_options);
37 status = smbcli_full_connection(tj, &cli, host,
38 lpcfg_smb_ports(torture->lp_ctx),
40 lpcfg_socket_options(torture->lp_ctx),
42 lpcfg_resolve_context(torture->lp_ctx),
43 torture->ev, &options, &session_options,
44 lpcfg_gensec_settings(torture, torture->lp_ctx));
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 lpcfg_smb_ports(torture->lp_ctx),
68 lpcfg_socket_options(torture->lp_ctx),
70 lpcfg_resolve_context(torture->lp_ctx),
71 torture->ev, &options, &session_options,
72 lpcfg_gensec_settings(torture, torture->lp_ctx));
73 if (!NT_STATUS_IS_OK(status)) {
74 DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
75 TORTURE_NETBIOS_NAME));
82 torture_leave_domain(torture, tj);