summaryrefslogtreecommitdiff
path: root/source4/torture/unix
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-03 00:28:22 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:20 +0100
commitbbdfbf8d9d486aee51117976b8f825759a4c4a37 (patch)
treec0f97e145aae09c3e7e5387471fb3fb0ab839596 /source4/torture/unix
parent291ddf433685ee5c25e172885045a4b60d7bb1ee (diff)
downloadsamba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.tar.gz
samba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.tar.bz2
samba-bbdfbf8d9d486aee51117976b8f825759a4c4a37.zip
r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm.
(This used to be commit a33a5530545086b81a3b205aa109dff11c546926)
Diffstat (limited to 'source4/torture/unix')
-rw-r--r--source4/torture/unix/whoami.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c
index f45d2345db..422e2abcbf 100644
--- a/source4/torture/unix/whoami.c
+++ b/source4/torture/unix/whoami.c
@@ -66,16 +66,16 @@ struct smb_whoami
struct dom_sid ** sid_list;
};
-static struct smbcli_state *connect_to_server(void *mem_ctx,
+static struct smbcli_state *connect_to_server(struct torture_context *tctx,
struct cli_credentials *creds)
{
NTSTATUS status;
struct smbcli_state *cli;
- const char *host = lp_parm_string(global_loadparm, NULL, "torture", "host");
- const char *share = lp_parm_string(global_loadparm, NULL, "torture", "share");
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
- status = smbcli_full_connection(mem_ctx, &cli,
+ status = smbcli_full_connection(tctx, &cli,
host, share, NULL,
creds, NULL);
@@ -270,29 +270,25 @@ bool torture_unix_whoami(struct torture_context *torture)
struct smbcli_state *cli;
struct cli_credentials *anon_credentials;
struct smb_whoami whoami;
- void *mem_ctx;
- mem_ctx = talloc_init("smb_query_posix_whoami");
- torture_assert(torture, mem_ctx != NULL, "malloc failed");
-
- if (!(cli = connect_to_server(mem_ctx, cmdline_credentials))) {
- goto fail;
+ if (!(cli = connect_to_server(torture, cmdline_credentials))) {
+ return false;
}
/* Test basic authenticated mapping. */
printf("calling SMB_QFS_POSIX_WHOAMI on an authenticated connection\n");
- if (!smb_raw_query_posix_whoami(mem_ctx, torture,
+ if (!smb_raw_query_posix_whoami(torture, torture,
cli, &whoami, 0xFFFF)) {
smbcli_tdis(cli);
- goto fail;
+ return false;
}
/* Test that the server drops the UID and GID list. */
printf("calling SMB_QFS_POSIX_WHOAMI with a small buffer\n");
- if (!smb_raw_query_posix_whoami(mem_ctx, torture,
+ if (!smb_raw_query_posix_whoami(torture, torture,
cli, &whoami, 0x40)) {
smbcli_tdis(cli);
- goto fail;
+ return false;
}
torture_assert_int_equal(torture, whoami.num_gids, 0,
@@ -305,16 +301,16 @@ bool torture_unix_whoami(struct torture_context *torture)
smbcli_tdis(cli);
printf("calling SMB_QFS_POSIX_WHOAMI on an anonymous connection\n");
- anon_credentials = cli_credentials_init_anon(mem_ctx);
+ anon_credentials = cli_credentials_init_anon(torture);
- if (!(cli = connect_to_server(mem_ctx, anon_credentials))) {
- goto fail;
+ if (!(cli = connect_to_server(torture, anon_credentials))) {
+ return false;
}
- if (!smb_raw_query_posix_whoami(mem_ctx, torture,
+ if (!smb_raw_query_posix_whoami(torture, torture,
cli, &whoami, 0xFFFF)) {
smbcli_tdis(cli);
- goto fail;
+ return false;
}
smbcli_tdis(cli);
@@ -331,13 +327,7 @@ bool torture_unix_whoami(struct torture_context *torture)
printf("server does not support SMB_WHOAMI_GUEST flag\n");
}
- talloc_free(mem_ctx);
return true;
-
-fail:
- talloc_free(mem_ctx);
- return false;
-
}
/* vim: set sts=8 sw=8 : */