summaryrefslogtreecommitdiff
path: root/source3/torture/cmd_sam.c
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 /source3/torture/cmd_sam.c
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)
Diffstat (limited to 'source3/torture/cmd_sam.c')
-rw-r--r--source3/torture/cmd_sam.c30
1 files changed, 29 insertions, 1 deletions
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)