summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/sam/interface.c4
-rw-r--r--source3/torture/cmd_sam.c30
2 files changed, 30 insertions, 4 deletions
diff --git a/source3/sam/interface.c b/source3/sam/interface.c
index bb7b88b240..320e39dbb4 100644
--- a/source3/sam/interface.c
+++ b/source3/sam/interface.c
@@ -904,7 +904,7 @@ void free_sam_context(SAM_CONTEXT **context)
}
/******************************************************************
- Make a sam_methods from scratch
+ Make a backend_entry from scratch
*******************************************************************/
static NTSTATUS make_backend_entry(SAM_BACKEND_ENTRY *backend_entry, char *sam_backend_string)
@@ -1175,8 +1175,6 @@ NTSTATUS make_sam_context(SAM_CONTEXT **context)
(*context)->mem_ctx = mem_ctx;
- /* FIXME */
-
(*context)->free_fn = free_sam_context;
return NT_STATUS_OK;
diff --git a/source3/torture/cmd_sam.c b/source3/torture/cmd_sam.c
index 535711bb12..caa63f1302 100644
--- a/source3/torture/cmd_sam.c
+++ b/source3/torture/cmd_sam.c
@@ -317,7 +317,35 @@ static NTSTATUS cmd_delete_account(struct samtest_state *st, TALLOC_CTX *mem_ctx
static NTSTATUS cmd_enum_accounts(struct samtest_state *st, TALLOC_CTX *mem_ctx, int argc, char **argv)
{
- return NT_STATUS_NOT_IMPLEMENTED;
+ NTSTATUS status;
+ DOM_SID sid;
+ int32 account_count, i;
+ SAM_ACCOUNT_ENUM *accounts;
+
+ if (argc != 2) {
+ printf("Usage: enum_accounts <domain-sid>\n");
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (!string_to_sid(&sid, argv[1])){
+ printf("Unparseable SID specified!\n");
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (!NT_STATUS_IS_OK(status = context_sam_enum_accounts(st->context, st->token, &sid, 0, &account_count, &accounts))) {
+ printf("context_sam_enum_accounts failed: %s\n", nt_errstr(status));
+ return status;
+ }
+
+ for (i = 0; i < account_count; i++)
+ printf("%s\t%s\t%s\t%s\t%d\n",
+ sid_string_static(&accounts[i].sid), accounts[i].account_name,
+ accounts[i].full_name, accounts[i].account_desc,
+ accounts[i].acct_ctrl);
+
+ SAFE_FREE(accounts);
+
+ return NT_STATUS_OK;
}
static NTSTATUS cmd_lookup_account_sid(struct samtest_state *st, TALLOC_CTX *mem_ctx, int argc, char **argv)