summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc_rights.c
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2008-05-21 10:34:34 +0200
committerKai Blin <kai@samba.org>2008-06-10 09:47:48 +0200
commitedf23f17fd1a89d3c60e2f0d5b251cd3400fa97f (patch)
tree3a86f9454a02fdcf6ed4192fdd197253d3f7630c /source3/utils/net_rpc_rights.c
parent238c7d0be3a26e27c184ad5666438b77ddc68771 (diff)
downloadsamba-edf23f17fd1a89d3c60e2f0d5b251cd3400fa97f.tar.gz
samba-edf23f17fd1a89d3c60e2f0d5b251cd3400fa97f.tar.bz2
samba-edf23f17fd1a89d3c60e2f0d5b251cd3400fa97f.zip
net: Make "net rpc rights" use functable3
(This used to be commit b0e373e595d66bd92b685dd98fc8967d45532e41)
Diffstat (limited to 'source3/utils/net_rpc_rights.c')
-rw-r--r--source3/utils/net_rpc_rights.c85
1 files changed, 59 insertions, 26 deletions
diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c
index 7a969a7a63..c359f97bd0 100644
--- a/source3/utils/net_rpc_rights.c
+++ b/source3/utils/net_rpc_rights.c
@@ -564,6 +564,14 @@ done:
static int rpc_rights_list(struct net_context *c, int argc, const char **argv )
{
+ if (c->display_usage) {
+ d_printf("Usage:\n"
+ "net rpc rights list [{accounts|privileges} "
+ "[name|SID]]\n"
+ " View available/assigned privileges\n");
+ return 0;
+ }
+
return run_rpc_command(c, NULL, PI_LSARPC, 0,
rpc_rights_list_internal, argc, argv );
}
@@ -573,6 +581,18 @@ static int rpc_rights_list(struct net_context *c, int argc, const char **argv )
static int rpc_rights_grant(struct net_context *c, int argc, const char **argv )
{
+ if (c->display_usage) {
+ d_printf("Usage:\n"
+ "net rpc rights grant <name|SID> <right>\n"
+ " Assign privilege[s]\n");
+ d_printf("For example:\n");
+ d_printf(" net rpc rights grant 'VALE\\biddle' "
+ "SePrintOperatorPrivilege SeDiskOperatorPrivilege\n");
+ d_printf(" would grant the printer admin and disk manager "
+ "rights to the user 'VALE\\biddle'\n");
+ return 0;
+ }
+
return run_rpc_command(c, NULL, PI_LSARPC, 0,
rpc_rights_grant_internal, argc, argv );
}
@@ -582,6 +602,18 @@ static int rpc_rights_grant(struct net_context *c, int argc, const char **argv )
static int rpc_rights_revoke(struct net_context *c, int argc, const char **argv)
{
+ if (c->display_usage) {
+ d_printf("Usage:\n"
+ "net rpc rights revoke <name|SID> <right>\n"
+ " Revoke privilege[s]\n");
+ d_printf("For example:\n");
+ d_printf(" net rpc rights revoke 'VALE\\biddle' "
+ "SePrintOperatorPrivilege SeDiskOperatorPrivilege\n");
+ d_printf(" would revoke the printer admin and disk manager "
+ "rights from the user 'VALE\\biddle'\n");
+ return 0;
+ }
+
return run_rpc_command(c, NULL, PI_LSARPC, 0,
rpc_rights_revoke_internal, argc, argv );
}
@@ -589,36 +621,37 @@ static int rpc_rights_revoke(struct net_context *c, int argc, const char **argv)
/********************************************************************
********************************************************************/
-static int net_help_rights(struct net_context *c, int argc, const char **argv )
-{
- d_printf("net rpc rights list [{accounts|privileges} [name|SID]] View available or assigned privileges\n");
- d_printf("net rpc rights grant <name|SID> <right> Assign privilege[s]\n");
- d_printf("net rpc rights revoke <name|SID> <right> Revoke privilege[s]\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 rights grant 'VALE\\biddle' SePrintOperatorPrivilege SeDiskOperatorPrivilege\n");
- d_printf("\nwould grant the printer admin and disk manager rights to the user 'VALE\\biddle'\n\n");
-
- return -1;
-}
-
-/********************************************************************
-********************************************************************/
-
int net_rpc_rights(struct net_context *c, int argc, const char **argv)
{
- struct functable func[] = {
- {"list", rpc_rights_list},
- {"grant", rpc_rights_grant},
- {"revoke", rpc_rights_revoke},
- {NULL, NULL}
+ struct functable3 func[] = {
+ {
+ "list",
+ rpc_rights_list,
+ NET_TRANSPORT_RPC,
+ "View available/assigned privileges",
+ "net rpc rights list\n"
+ " View available/assigned privileges"
+ },
+ {
+ "grant",
+ rpc_rights_grant,
+ NET_TRANSPORT_RPC,
+ "Assign privilege[s]",
+ "net rpc rights grant\n"
+ " Assign privilege[s]"
+ },
+ {
+ "revoke",
+ rpc_rights_revoke,
+ NET_TRANSPORT_RPC,
+ "Revoke privilege[s]",
+ "net rpc rights revoke\n"
+ " Revoke privilege[s]"
+ },
+ {NULL, NULL, 0, NULL, NULL}
};
- if ( argc )
- return net_run_function(c, argc, argv, func, net_help_rights );
-
- return net_help_rights(c, argc, argv );
+ return net_run_function3(c, argc, argv, "net rpc rights", func);
}
static NTSTATUS rpc_sh_rights_list(struct net_context *c,