r25398: Parse loadparm context to all lp_*() functions.
[kai/samba.git] / source / torture / rpc / samba3rpc.c
index 9e5eedab3a54a1325fa0fcec98c9bea952b8f51a..75a7d760d91008eee2642866a42d0e56c8fe3342 100644 (file)
@@ -48,6 +48,7 @@
 #include "libcli/auth/libcli_auth.h"
 #include "lib/crypto/crypto.h"
 #include "libcli/security/proto.h"
+#include "param/param.h"
 
 static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx)
 {
@@ -57,7 +58,7 @@ static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx)
                return NULL;
        }
 
-       cli_credentials_set_conf(result);
+       cli_credentials_set_conf(result, global_loadparm);
        cli_credentials_set_anonymous(result);
 
        return result;
@@ -113,7 +114,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture)
                goto done;
        }
 
-       status = dcerpc_bind_auth_none(lsa_pipe, &dcerpc_table_lsarpc);
+       status = dcerpc_bind_auth_none(lsa_pipe, &ndr_table_lsarpc);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("dcerpc_bind_auth_none failed: %s\n",
                         nt_errstr(status));
@@ -229,7 +230,7 @@ static BOOL bindtest(struct smbcli_state *cli,
                goto done;
        }
 
-       status = dcerpc_bind_auth(lsa_pipe, &dcerpc_table_lsarpc,
+       status = dcerpc_bind_auth(lsa_pipe, &ndr_table_lsarpc,
                                  credentials, auth_type, auth_level,
                                  NULL);
        if (!NT_STATUS_IS_OK(status)) {
@@ -369,7 +370,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli,
        }
 
        if (admin_creds != NULL) {
-               status = dcerpc_bind_auth(samr_pipe, &dcerpc_table_samr,
+               status = dcerpc_bind_auth(samr_pipe, &ndr_table_samr,
                                          admin_creds, auth_type, auth_level,
                                          NULL);
                if (!NT_STATUS_IS_OK(status)) {
@@ -379,7 +380,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli,
                }
        } else {
                /* We must have an authenticated SMB connection */
-               status = dcerpc_bind_auth_none(samr_pipe, &dcerpc_table_samr);
+               status = dcerpc_bind_auth_none(samr_pipe, &ndr_table_samr);
                if (!NT_STATUS_IS_OK(status)) {
                        d_printf("dcerpc_bind_auth_none failed: %s\n",
                                 nt_errstr(status));
@@ -834,7 +835,7 @@ static BOOL auth2(struct smbcli_state *cli,
                goto done;
        }
 
-       status = dcerpc_bind_auth_none(net_pipe, &dcerpc_table_netlogon);
+       status = dcerpc_bind_auth_none(net_pipe, &ndr_table_netlogon);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("dcerpc_bind_auth_none failed: %s\n",
                         nt_errstr(status));
@@ -941,12 +942,12 @@ static BOOL schan(struct smbcli_state *cli,
 #endif
 #if 1
        net_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
-       status = dcerpc_bind_auth(net_pipe, &dcerpc_table_netlogon,
+       status = dcerpc_bind_auth(net_pipe, &ndr_table_netlogon,
                                  wks_creds, DCERPC_AUTH_TYPE_SCHANNEL,
                                  DCERPC_AUTH_LEVEL_PRIVACY,
                                  NULL);
 #else
-       status = dcerpc_bind_auth_none(net_pipe, &dcerpc_table_netlogon);
+       status = dcerpc_bind_auth_none(net_pipe, &ndr_table_netlogon);
 #endif
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("schannel bind failed: %s\n", nt_errstr(status));
@@ -1162,7 +1163,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture)
                goto done;
        }
 
-       cli_credentials_set_conf(wks_creds);
+       cli_credentials_set_conf(wks_creds, global_loadparm);
        cli_credentials_set_secure_channel_type(wks_creds, SEC_CHAN_WKSTA);
        cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED);
        cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED);
@@ -1229,7 +1230,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx,
        struct cli_credentials *wks_creds;
 
        status = smbcli_full_connection(mem_ctx, &cli,
-                                       lp_parm_string(-1, "torture", "host"),
+                                       lp_parm_string(NULL, "torture", "host"),
                                        "IPC$", NULL, smb_creds, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
@@ -1243,7 +1244,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       cli_credentials_set_conf(wks_creds);
+       cli_credentials_set_conf(wks_creds, global_loadparm);
        cli_credentials_set_secure_channel_type(wks_creds, SEC_CHAN_WKSTA);
        cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED);
        cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED);
@@ -1368,7 +1369,7 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture)
 static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx,
                              struct smbcli_tree *tree,
                              const char *pipe_name,
-                             const struct dcerpc_interface_table *iface,
+                             const struct ndr_interface_table *iface,
                              struct dcerpc_pipe **p)
 {
        struct dcerpc_pipe *result;
@@ -1500,7 +1501,7 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree)
        struct dom_sid *result;
 
        status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\lsarpc",
-                              &dcerpc_table_lsarpc, &lsa);
+                              &ndr_table_lsarpc, &lsa);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) Could not bind to LSA: %s\n",
                         __location__, nt_errstr(status));
@@ -1647,7 +1648,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture)
                goto done;
        }
 
-       cli_credentials_set_conf(user_creds);
+       cli_credentials_set_conf(user_creds, global_loadparm);
        cli_credentials_set_username(user_creds, "torture_username",
                                     CRED_SPECIFIED);
        cli_credentials_set_password(user_creds,
@@ -1838,7 +1839,7 @@ BOOL torture_samba3_rpc_srvsvc(struct torture_context *torture)
        }
 
        status = pipe_bind_smb(mem_ctx, cli->tree, "\\pipe\\srvsvc",
-                              &dcerpc_table_srvsvc, &p);
+                              &ndr_table_srvsvc, &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) could not bind to srvsvc pipe: %s\n",
                         __location__, nt_errstr(status));
@@ -1881,7 +1882,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
        }
 
        status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
-                              &dcerpc_table_srvsvc, &p);
+                              &ndr_table_srvsvc, &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) could not bind to srvsvc pipe: %s\n",
                         __location__, nt_errstr(status));
@@ -1936,7 +1937,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
        }
 
        status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
-                              &dcerpc_table_srvsvc, &p);
+                              &ndr_table_srvsvc, &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) could not bind to srvsvc pipe: %s\n",
                         __location__, nt_errstr(status));
@@ -2126,7 +2127,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture)
        }
 
        status = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc",
-                              &dcerpc_table_lsarpc, &p);
+                              &ndr_table_lsarpc, &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
                         nt_errstr(status));
@@ -2223,7 +2224,7 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree,
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = pipe_bind_smb(mem_ctx, tree, "\\srvsvc", &dcerpc_table_srvsvc,
+       status = pipe_bind_smb(mem_ctx, tree, "\\srvsvc", &ndr_table_srvsvc,
                               &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("could not bind to srvsvc pipe\n");
@@ -2424,7 +2425,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture)
        }
 
        status = pipe_bind_smb(mem_ctx, cli->tree, "\\spoolss",
-                              &dcerpc_table_spoolss, &p);
+                              &ndr_table_spoolss, &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
                         nt_errstr(status));
@@ -2434,7 +2435,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture)
 
        ZERO_STRUCT(userlevel1);
        userlevel1.client = talloc_asprintf(
-               mem_ctx, "\\\\%s", lp_netbios_name());
+               mem_ctx, "\\\\%s", lp_netbios_name(global_loadparm));
        userlevel1.user = cli_credentials_get_username(cmdline_credentials);
        userlevel1.build = 2600;
        userlevel1.major = 3;
@@ -2598,7 +2599,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture)
        }
 
        status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc",
-                              &dcerpc_table_wkssvc, &p);
+                              &ndr_table_wkssvc, &p);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
                         nt_errstr(status));
@@ -2824,7 +2825,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture)
 
        mem_ctx = talloc_init("torture_rpc_winreg");
 
-       status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_winreg);
+       status = torture_rpc_connection(torture, &p, &ndr_table_winreg);
 
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(mem_ctx);