summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-09-25 17:10:58 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-09-25 17:10:58 +0000
commit07d7643a6e99ba07ecade2156f09a5bd20bdf695 (patch)
treeb5f780370d621ad172ec279faabe2550c6d1de69
parent956767fdc4107dbc44dae6402d4a8d404625b853 (diff)
downloadsamba-07d7643a6e99ba07ecade2156f09a5bd20bdf695.tar.gz
samba-07d7643a6e99ba07ecade2156f09a5bd20bdf695.tar.bz2
samba-07d7643a6e99ba07ecade2156f09a5bd20bdf695.zip
Add samtest command 'enum_accounts' + few typo fixes in sam/interface.c
(This used to be commit 81156d6556dab2ea23dea69da6940a0482d79d9b)
-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)