From 05afe9624ff16d716562cc19417f4b4cbef4189b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 11 Jan 2019 14:16:11 +0100 Subject: [PATCH] s3:rpcclient: Use C99 initializer for cmd_set in rpcclient Signed-off-by: Andreas Schneider Reviewed-by: Douglas Bagnall --- source3/rpcclient/rpcclient.c | 182 ++++++++++++++++++++++++++++++---- 1 file changed, 163 insertions(+), 19 deletions(-) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 6cfacb19cfe..4497bb62242 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -608,30 +608,174 @@ static NTSTATUS cmd_choose_transport(struct rpc_pipe_client *cli, TALLOC_CTX *me static struct cmd_set rpcclient_commands[] = { - { "GENERAL OPTIONS" }, + { + .name = "GENERAL OPTIONS", + }, - { "help", RPC_RTYPE_NTSTATUS, cmd_help, NULL, NULL, NULL, "Get help on commands", "[command]" }, - { "?", RPC_RTYPE_NTSTATUS, cmd_help, NULL, NULL, NULL, "Get help on commands", "[command]" }, - { "debuglevel", RPC_RTYPE_NTSTATUS, cmd_debuglevel, NULL, NULL, NULL, "Set debug level", "level" }, - { "debug", RPC_RTYPE_NTSTATUS, cmd_debuglevel, NULL, NULL, NULL, "Set debug level", "level" }, - { "list", RPC_RTYPE_NTSTATUS, cmd_listcommands, NULL, NULL, NULL, "List available commands on ", "pipe" }, - { "exit", RPC_RTYPE_NTSTATUS, cmd_quit, NULL, NULL, NULL, "Exit program", "" }, - { "quit", RPC_RTYPE_NTSTATUS, cmd_quit, NULL, NULL, NULL, "Exit program", "" }, - { "sign", RPC_RTYPE_NTSTATUS, cmd_sign, NULL, NULL, NULL, "Force RPC pipe connections to be signed", "" }, - { "seal", RPC_RTYPE_NTSTATUS, cmd_seal, NULL, NULL, NULL, "Force RPC pipe connections to be sealed", "" }, - { "packet", RPC_RTYPE_NTSTATUS, cmd_packet, NULL, NULL, NULL, "Force RPC pipe connections with packet authentication level", "" }, - { "schannel", RPC_RTYPE_NTSTATUS, cmd_schannel, NULL, NULL, NULL, "Force RPC pipe connections to be sealed with 'schannel'. Assumes valid machine account to this domain controller.", "" }, - { "schannelsign", RPC_RTYPE_NTSTATUS, cmd_schannel_sign, NULL, NULL, NULL, "Force RPC pipe connections to be signed (not sealed) with 'schannel'. Assumes valid machine account to this domain controller.", "" }, - { "timeout", RPC_RTYPE_NTSTATUS, cmd_timeout, NULL, NULL, NULL, "Set timeout (in milliseconds) for RPC operations", "" }, - { "transport", RPC_RTYPE_NTSTATUS, cmd_choose_transport, NULL, NULL, NULL, "Choose ncacn transport for RPC operations", "" }, - { "none", RPC_RTYPE_NTSTATUS, cmd_none, NULL, NULL, NULL, "Force RPC pipe connections to have no special properties", "" }, + { + .name = "help", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_help, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Get help on commands", + .usage = "[command]", + }, + { + .name = "?", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_help, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Get help on commands", + .usage = "[command]", + }, + { + .name = "debuglevel", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_debuglevel, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Set debug level", + .usage = "level", + }, + { + .name = "debug", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_debuglevel, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Set debug level", + .usage = "level", + }, + { + .name = "list", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_listcommands, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "List available commands on ", + .usage = "pipe", + }, + { + .name = "exit", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_quit, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Exit program", + .usage = "", + }, + { + .name = "quit", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_quit, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Exit program", + .usage = "", + }, + { + .name = "sign", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_sign, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Force RPC pipe connections to be signed", + .usage = "", + }, + { + .name = "seal", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_seal, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Force RPC pipe connections to be sealed", + .usage = "", + }, + { + .name = "packet", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_packet, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Force RPC pipe connections with packet authentication level", + .usage = "", + }, + { + .name = "schannel", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_schannel, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Force RPC pipe connections to be sealed with 'schannel'. " + "Assumes valid machine account to this domain controller.", + .usage = "", + }, + { + .name = "schannelsign", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_schannel_sign, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Force RPC pipe connections to be signed (not sealed) with " + "'schannel'. Assumes valid machine account to this domain " + "controller.", + .usage = "", + }, + { + .name = "timeout", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_timeout, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Set timeout (in milliseconds) for RPC operations", + .usage = "", + }, + { + .name = "transport", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_choose_transport, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Choose ncacn transport for RPC operations", + .usage = "", + }, + { + .name = "none", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_none, + .wfn = NULL, + .table = NULL, + .rpc_pipe = NULL, + .description = "Force RPC pipe connections to have no special properties", + .usage = "", + }, - { NULL } + { .name = NULL, }, }; static struct cmd_set separator_command[] = { - { "---------------", MAX_RPC_RETURN_TYPE, NULL, NULL, NULL, NULL, "----------------------" }, - { NULL } + { + .name = "---------------", + .returntype = MAX_RPC_RETURN_TYPE, + .description = "----------------------" + }, + { .name = NULL, }, };