From df316e3cd931baaa3793a260b5f2e70cb8235580 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 29 Sep 2002 06:07:58 +0000 Subject: Remove sam/api.c. In order to reduce complexity, this patch removes the upper layer of the SAM API. Also, we remove the function pointers on the sam context - there really is no point making these replaceable - that's for the modules. Move a number of functions in include/interface.c around to allow for use of 'static' and to keep the external API in one chunk, at the bottem. All these functions were renamed to remove the context_sam -> sam Consequential changes in the samtest module, and back out metze's change for ACB filtering, becouse I think it belongs in the SAM backeds. (But I will take debate on this one). Changes to the lib/util_sid.c code to create a 'system' token, and make it a SAM_ASSERT() enforced requirement to have a token on those calls that specify it. samtest now uses this. We should have a samtest call to set your own token. We also need to extend our se_access code to cover the things that Win2k is returning in it's access tokens. Currently our system token doesn't pass, due to unexpected flags. (When running sam_ads against Win2k) Andrew Bartlett (This used to be commit b9036900d0bb227ec16c6a5792c18ef943dcf015) --- source3/torture/cmd_sam.c | 25 ++++++++++++------------- source3/torture/samtest.c | 3 ++- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/torture') diff --git a/source3/torture/cmd_sam.c b/source3/torture/cmd_sam.c index 9f162f2a07..0cd219cb45 100644 --- a/source3/torture/cmd_sam.c +++ b/source3/torture/cmd_sam.c @@ -104,8 +104,8 @@ static NTSTATUS cmd_lookup_sid(struct samtest_state *st, TALLOC_CTX *mem_ctx, in return NT_STATUS_INVALID_PARAMETER; } - if (!NT_STATUS_IS_OK(status = context_sam_lookup_sid(st->context, st->token, mem_ctx, &sid, &name, &type))) { - printf("context_sam_lookup_sid failed!\n"); + if (!NT_STATUS_IS_OK(status = sam_lookup_sid(st->context, st->token, mem_ctx, &sid, &name, &type))) { + printf("sam_lookup_sid failed!\n"); return status; } @@ -125,8 +125,8 @@ static NTSTATUS cmd_lookup_name(struct samtest_state *st, TALLOC_CTX *mem_ctx, i return NT_STATUS_INVALID_PARAMETER; } - if (!NT_STATUS_IS_OK(status = context_sam_lookup_name(st->context, st->token, argv[1], argv[2], &sid, &type))) { - printf("context_sam_lookup_name failed!\n"); + if (!NT_STATUS_IS_OK(status = sam_lookup_name(st->context, st->token, argv[1], argv[2], &sid, &type))) { + printf("sam_lookup_name failed!\n"); return status; } @@ -155,8 +155,8 @@ static NTSTATUS cmd_lookup_domain(struct samtest_state *st, TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - if (!NT_STATUS_IS_OK(status = context_sam_lookup_domain(st->context, st->token, argv[1], &sid))) { - printf("context_sam_lookup_name failed!\n"); + if (!NT_STATUS_IS_OK(status = sam_lookup_domain(st->context, st->token, argv[1], &sid))) { + printf("sam_lookup_name failed!\n"); return status; } @@ -172,8 +172,8 @@ static NTSTATUS cmd_enum_domains(struct samtest_state *st, TALLOC_CTX *mem_ctx, char **domain_names; NTSTATUS status; - if (!NT_STATUS_IS_OK(status = context_sam_enum_domains(st->context, st->token, &domain_count, &domain_sids, &domain_names))) { - printf("context_sam_enum_domains failed!\n"); + if (!NT_STATUS_IS_OK(status = sam_enum_domains(st->context, st->token, &domain_count, &domain_sids, &domain_names))) { + printf("sam_enum_domains failed!\n"); return status; } @@ -218,8 +218,8 @@ static NTSTATUS cmd_show_domain(struct samtest_state *st, TALLOC_CTX *mem_ctx, i return NT_STATUS_INVALID_PARAMETER; } - if (!NT_STATUS_IS_OK(status = context_sam_get_domain_by_sid(st->context, st->token, DOMAIN_ALL_ACCESS, &sid, &domain))) { - printf("context_sam_get_domain_by_sid failed\n"); + if (!NT_STATUS_IS_OK(status = sam_get_domain_by_sid(st->context, st->token, DOMAIN_ALL_ACCESS, &sid, &domain))) { + printf("sam_get_domain_by_sid failed\n"); return status; } @@ -331,7 +331,6 @@ static NTSTATUS cmd_enum_accounts(struct samtest_state *st, TALLOC_CTX *mem_ctx, DOM_SID sid; int32 account_count, i; SAM_ACCOUNT_ENUM *accounts; - uint16 acct_ctrl = (ACB_NORMAL |ACB_WSTRUST |ACB_SVRTRUST |ACB_DOMTRUST | ACB_MNS); if (argc != 2) { printf("Usage: enum_accounts \n"); @@ -343,8 +342,8 @@ static NTSTATUS cmd_enum_accounts(struct samtest_state *st, TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - if (!NT_STATUS_IS_OK(status = context_sam_enum_accounts(st->context, st->token, &sid, acct_ctrl, &account_count, &accounts))) { - printf("context_sam_enum_accounts failed: %s\n", nt_errstr(status)); + if (!NT_STATUS_IS_OK(status = sam_enum_accounts(st->context, st->token, &sid, 0, &account_count, &accounts))) { + printf("sam_enum_accounts failed: %s\n", nt_errstr(status)); return status; } diff --git a/source3/torture/samtest.c b/source3/torture/samtest.c index b5f7ed9f76..d3268d8b5b 100644 --- a/source3/torture/samtest.c +++ b/source3/torture/samtest.c @@ -360,7 +360,6 @@ int main(int argc, char *argv[]) struct cmd_set **cmd_set; struct samtest_state st; - /* make sure the vars that get altered (4th field) are in a fixed location or certain compilers complain */ poptContext pc; @@ -375,6 +374,8 @@ int main(int argc, char *argv[]) ZERO_STRUCT(st); + st.token = get_system_token(); + setlinebuf(stdout); DEBUGLEVEL = 1; -- cgit