From 2cca804e61dc1a5efbc40a44fc4a5823074bc78e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 18 Jan 2005 20:51:06 +0000 Subject: r4827: add 'net rpc rights list accounts' & update help text (This used to be commit 002ece931917e2952ed795939384764d14f93ce9) --- source3/utils/net_rpc_rights.c | 75 +++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 15 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index 5547925bc0..d5652b8247 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -46,8 +46,11 @@ static NTSTATUS name_to_sid(struct cli_state *cli, result = cli_lsa_lookup_names(cli, mem_ctx, &pol, 1, &name, &sids, &sid_types); - if (!NT_STATUS_IS_OK(result)) + if (!NT_STATUS_IS_OK(result)) { + d_printf("Failed to convert \"%s\" to a SID [%s]\n", + name, nt_errstr(result)); goto done; + } sid_copy( sid, &sids[0] ); @@ -117,9 +120,45 @@ static NTSTATUS enum_privileges_for_user( TALLOC_CTX *ctx, struct cli_state *cli if (!NT_STATUS_IS_OK(result)) return result; + + if ( count == 0 ) + d_printf("No privileges assigned\n"); for (i = 0; i < count; i++) { - printf("%30s\n", rights[i]); + printf("%s\n", rights[i]); + } + + return NT_STATUS_OK; +} + +/******************************************************************** +********************************************************************/ + +static NTSTATUS enum_privileges_for_accounts( TALLOC_CTX *ctx, struct cli_state *cli, + POLICY_HND *pol ) +{ + NTSTATUS result; + uint32 enum_context=0; + uint32 pref_max_length=0x1000; + DOM_SID *sids; + uint32 count=0; + int i; + + result = cli_lsa_enum_sids(cli, ctx, pol, &enum_context, + pref_max_length, &count, &sids); + + if (!NT_STATUS_IS_OK(result)) + return result; + + for ( i=0; i Assign privilege[s]\n"); + d_printf("net rpc rights revoke Revoke privilege[s]\n"); - d_printf("Both 'grant' and 'revoke' require a SID and a commaa separated\n"); - d_printf("list of privilege names. For example\n"); - d_printf(" net rpc grant S-1-5-32-550 SePrintOperatorsPrivilege\n"); - d_printf("would grant the printer admin right to the 'BUILTIN\\Print Operators' group\n"); + d_printf("\nBoth 'grant' and 'revoke' require a SID and a list of privilege names.\n"); + d_printf("For example\n"); + d_printf("\n net rpc grant 'VALE\\biddle' SePrintOperatorPrivilege SeDiskOperatorPrivlege\n"); + d_printf("\nwould grant the printer admin and disk manager rights to the user 'VALE\\biddle'\n\n"); return -1; -- cgit