s4:torture/netlogon: add/use test_SetupCredentialsPipe() helper function
[samba.git] / source4 / torture / rpc / join.c
index d0ad97110a28576f2940851fb10b6664874df794..6e0afcac28187ed2436288867f68a2729388e580 100644 (file)
@@ -1,9 +1,10 @@
 #include "includes.h"
-#include "libnet/libnet.h"
 #include "libcli/libcli.h"
 
-#include "auth/credentials/credentials.h"
-#include "torture/rpc/rpc.h"
+#include "torture/rpc/torture_rpc.h"
+
+#include "libcli/resolve/resolve.h"
+#include "param/param.h"
 
 #define TORTURE_NETBIOS_NAME "smbtorturejoin"
 
@@ -15,9 +16,12 @@ bool torture_rpc_join(struct torture_context *torture)
        struct cli_credentials *machine_account;
        struct smbcli_state *cli;
        const char *host = torture_setting_string(torture, "host", NULL);
+       struct smbcli_options options;
+       struct smbcli_session_options session_options;
 
        /* Join domain as a member server. */
-       tj = torture_join_domain(TORTURE_NETBIOS_NAME,
+       tj = torture_join_domain(torture,
+                                TORTURE_NETBIOS_NAME,
                                 ACB_WSTRUST,
                                 &machine_account);
 
@@ -27,10 +31,17 @@ bool torture_rpc_join(struct torture_context *torture)
                return false;
        }
 
+       lpcfg_smbcli_options(torture->lp_ctx, &options);
+       lpcfg_smbcli_session_options(torture->lp_ctx, &session_options);
+
        status = smbcli_full_connection(tj, &cli, host,
+                                       lpcfg_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL,
+                                       lpcfg_socket_options(torture->lp_ctx),
                                        machine_account,
-                                       NULL);
+                                       lpcfg_resolve_context(torture->lp_ctx),
+                                       torture->ev, &options, &session_options,
+                                       lpcfg_gensec_settings(torture, torture->lp_ctx));
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
@@ -39,10 +50,10 @@ bool torture_rpc_join(struct torture_context *torture)
        smbcli_tdis(cli);
         
        /* Leave domain. */                          
-       torture_leave_domain(tj);
+       torture_leave_domain(torture, tj);
         
        /* Join domain as a domain controller. */
-       tj = torture_join_domain(TORTURE_NETBIOS_NAME,
+       tj = torture_join_domain(torture, TORTURE_NETBIOS_NAME,
                                 ACB_SVRTRUST,
                                 &machine_account);
        if (!tj) {
@@ -52,9 +63,13 @@ bool torture_rpc_join(struct torture_context *torture)
        }
 
        status = smbcli_full_connection(tj, &cli, host,
+                                       lpcfg_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL,
+                                       lpcfg_socket_options(torture->lp_ctx),
                                        machine_account,
-                                       NULL);
+                                       lpcfg_resolve_context(torture->lp_ctx),
+                                       torture->ev, &options, &session_options,
+                                       lpcfg_gensec_settings(torture, torture->lp_ctx));
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
@@ -64,7 +79,7 @@ bool torture_rpc_join(struct torture_context *torture)
        smbcli_tdis(cli);
 
        /* Leave domain. */
-       torture_leave_domain(tj);
+       torture_leave_domain(torture, tj);
 
        return true;
 }