summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-07-20 04:38:58 +0000
committerTim Potter <tpot@samba.org>2001-07-20 04:38:58 +0000
commit8db78af9702dab2e89f1f7adf56996a20a8cb2f4 (patch)
tree999554eb81aaba3e118902697d0a41debbecb466 /source3/rpcclient
parent31fe984d2fc7a2813404a8c25816bb6bb25adfe9 (diff)
downloadsamba-8db78af9702dab2e89f1f7adf56996a20a8cb2f4.tar.gz
samba-8db78af9702dab2e89f1f7adf56996a20a8cb2f4.tar.bz2
samba-8db78af9702dab2e89f1f7adf56996a20a8cb2f4.zip
Started adding some help/usage info for rpcclient commands.
(This used to be commit 37052a1bcc5cd049918c3d5ac4c41c3a669290af)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_dfs.c15
-rw-r--r--source3/rpcclient/cmd_lsarpc.c15
-rw-r--r--source3/rpcclient/cmd_netlogon.c11
-rw-r--r--source3/rpcclient/cmd_samr.c34
-rw-r--r--source3/rpcclient/cmd_spoolss.c34
-rw-r--r--source3/rpcclient/cmd_srvsvc.c9
-rw-r--r--source3/rpcclient/rpcclient.c78
7 files changed, 128 insertions, 68 deletions
diff --git a/source3/rpcclient/cmd_dfs.c b/source3/rpcclient/cmd_dfs.c
index 59e35bad2e..b4914f665c 100644
--- a/source3/rpcclient/cmd_dfs.c
+++ b/source3/rpcclient/cmd_dfs.c
@@ -311,13 +311,14 @@ static uint32 cmd_dfs_getinfo(struct cli_state *cli, int argc, char **argv)
/* List of commands exported by this module */
struct cmd_set dfs_commands[] = {
- { "DFS", NULL, "" },
- { "dfsexist", cmd_dfs_exist, "Query DFS support" },
- { "dfsadd", cmd_dfs_add, "Add a DFS share" },
- { "dfsremove", cmd_dfs_remove, "Remove a DFS share" },
- { "dfsgetinfo", cmd_dfs_getinfo, "Query DFS share info" },
- { "dfsenum", cmd_dfs_enum, "Enumerate dfs shares" },
+ { "DFS" },
- { NULL, NULL, NULL }
+ { "dfsexist", cmd_dfs_exist, "Query DFS support", "" },
+ { "dfsadd", cmd_dfs_add, "Add a DFS share", "" },
+ { "dfsremove", cmd_dfs_remove, "Remove a DFS share", "" },
+ { "dfsgetinfo", cmd_dfs_getinfo, "Query DFS share info", "" },
+ { "dfsenum", cmd_dfs_enum, "Enumerate dfs shares", "" },
+
+ { NULL }
};
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index f531fe9250..4b07333074 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -322,10 +322,13 @@ static uint32 cmd_lsa_enum_trust_dom(struct cli_state *cli, int argc, char **arg
/* List of commands exported by this module */
struct cmd_set lsarpc_commands[] = {
- { "LSARPC", NULL, "" },
- { "lsaquery", cmd_lsa_query_info_policy, "Query info policy" },
- { "lookupsids", cmd_lsa_lookup_sids, "Convert SIDs to names" },
- { "lookupnames",cmd_lsa_lookup_names, "Convert names to SIDs" },
- { "enumtrust", cmd_lsa_enum_trust_dom, "Enumerate trusted domains" },
- { NULL, NULL, NULL }
+
+ { "LSARPC" },
+
+ { "lsaquery", cmd_lsa_query_info_policy, "Query info policy", "" },
+ { "lookupsids", cmd_lsa_lookup_sids, "Convert SIDs to names", "" },
+ { "lookupnames", cmd_lsa_lookup_names, "Convert names to SIDs", "" },
+ { "enumtrust", cmd_lsa_enum_trust_dom, "Enumerate trusted domains", "" },
+
+ { NULL }
};
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 93f6f1c395..549e21e25e 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -101,8 +101,11 @@ static uint32 cmd_netlogon_logon_ctrl(struct cli_state *cli, int argc,
/* List of commands exported by this module */
struct cmd_set netlogon_commands[] = {
- { "NETLOGON", NULL, "" },
- { "logonctrl2", cmd_netlogon_logon_ctrl2, "Logon Control 2" },
- { "logonctrl", cmd_netlogon_logon_ctrl, "Logon Control" },
- { NULL, NULL, NULL }
+
+ { "NETLOGON" },
+
+ { "logonctrl2", cmd_netlogon_logon_ctrl2, "Logon Control 2", "" },
+ { "logonctrl", cmd_netlogon_logon_ctrl, "Logon Control", "" },
+
+ { NULL }
};
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index b3ab1a14c3..dee466ffea 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1194,20 +1194,22 @@ static uint32 cmd_samr_delete_dom_user(struct cli_state *cli, int argc,
/* List of commands exported by this module */
struct cmd_set samr_commands[] = {
- { "SAMR", NULL, "" },
-
- { "queryuser", cmd_samr_query_user, "Query user info" },
- { "querygroup", cmd_samr_query_group, "Query group info" },
- { "queryusergroups", cmd_samr_query_usergroups, "Query user groups" },
- { "querygroupmem", cmd_samr_query_groupmem, "Query group membership" },
- { "queryaliasmem", cmd_samr_query_aliasmem, "Query alias membership" },
- { "querydispinfo", cmd_samr_query_dispinfo, "Query display info" },
- { "querydominfo", cmd_samr_query_dominfo, "Query domain info" },
- { "enumdomgroups", cmd_samr_enum_dom_groups, "Enumerate domain groups" },
-
- { "createdomuser", cmd_samr_create_dom_user, "Create domain user" },
- { "samlookupnames", cmd_samr_lookup_names, "Look up names" },
- { "samlookuprids", cmd_samr_lookup_rids, "Look up names" },
- { "deletedomuser", cmd_samr_delete_dom_user, "Delete domain user" },
- { NULL, NULL, NULL }
+
+ { "SAMR" },
+
+ { "queryuser", cmd_samr_query_user, "Query user info", "" },
+ { "querygroup", cmd_samr_query_group, "Query group info", "" },
+ { "queryusergroups", cmd_samr_query_usergroups, "Query user groups", "" },
+ { "querygroupmem", cmd_samr_query_groupmem, "Query group membership", "" },
+ { "queryaliasmem", cmd_samr_query_aliasmem, "Query alias membership", "" },
+ { "querydispinfo", cmd_samr_query_dispinfo, "Query display info", "" },
+ { "querydominfo", cmd_samr_query_dominfo, "Query domain info", "" },
+ { "enumdomgroups", cmd_samr_enum_dom_groups, "Enumerate domain groups", "" },
+
+ { "createdomuser", cmd_samr_create_dom_user, "Create domain user", "" },
+ { "samlookupnames", cmd_samr_lookup_names, "Look up names", "" },
+ { "samlookuprids", cmd_samr_lookup_rids, "Look up names", "" },
+ { "deletedomuser", cmd_samr_delete_dom_user, "Delete domain user", "" },
+
+ { NULL }
};
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 30c1616779..1f46ed1bf9 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1362,20 +1362,22 @@ static uint32 cmd_spoolss_deletedriver (struct cli_state *cli, int argc, char **
/* List of commands exported by this module */
struct cmd_set spoolss_commands[] = {
- { "SPOOLSS", NULL, "" },
- { "adddriver", cmd_spoolss_addprinterdriver, "Add a print driver" },
- { "addprinter", cmd_spoolss_addprinterex, "Add a printer" },
- { "deldriver", cmd_spoolss_deletedriver, "Delete a printer driver" },
- { "enumdata", cmd_spoolss_not_implemented, "Enumerate printer data (*)" },
- { "enumjobs", cmd_spoolss_not_implemented, "Enumerate print jobs (*)" },
- { "enumports", cmd_spoolss_enum_ports, "Enumerate printer ports" },
- { "enumdrivers", cmd_spoolss_enum_drivers, "Enumerate installed printer drivers" },
- { "enumprinters", cmd_spoolss_enum_printers, "Enumerate printers" },
- { "getdata", cmd_spoolss_not_implemented, "Get print driver data (*)" },
- { "getdriver", cmd_spoolss_getdriver, "Get print driver information" },
- { "getdriverdir", cmd_spoolss_getdriverdir, "Get print driver upload directory" },
- { "getprinter", cmd_spoolss_getprinter, "Get printer info" },
- { "openprinter", cmd_spoolss_open_printer_ex, "Open printer handle" },
- { "setdriver", cmd_spoolss_setdriver, "Set printer driver" },
- { NULL, NULL, NULL }
+ { "SPOOLSS" },
+
+ { "adddriver", cmd_spoolss_addprinterdriver, "Add a print driver", "" },
+ { "addprinter", cmd_spoolss_addprinterex, "Add a printer", "" },
+ { "deldriver", cmd_spoolss_deletedriver, "Delete a printer driver", "" },
+ { "enumdata", cmd_spoolss_not_implemented, "Enumerate printer data (*)", "" },
+ { "enumjobs", cmd_spoolss_not_implemented, "Enumerate print jobs (*)", "" },
+ { "enumports", cmd_spoolss_enum_ports, "Enumerate printer ports", "" },
+ { "enumdrivers", cmd_spoolss_enum_drivers, "Enumerate installed printer drivers", "" },
+ { "enumprinters", cmd_spoolss_enum_printers, "Enumerate printers", "" },
+ { "getdata", cmd_spoolss_not_implemented, "Get print driver data (*)", "" },
+ { "getdriver", cmd_spoolss_getdriver, "Get print driver information", "" },
+ { "getdriverdir", cmd_spoolss_getdriverdir, "Get print driver upload directory", "" },
+ { "getprinter", cmd_spoolss_getprinter, "Get printer info", "" },
+ { "openprinter", cmd_spoolss_open_printer_ex, "Open printer handle", "" },
+ { "setdriver", cmd_spoolss_setdriver, "Set printer driver", "" },
+
+ { NULL }
};
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index b804cc383d..c097f5325d 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -237,7 +237,10 @@ static uint32 cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
/* List of commands exported by this module */
struct cmd_set srvsvc_commands[] = {
- { "SRVSVC", NULL, "" },
- { "srvinfo", cmd_srvsvc_srv_query_info, "Server query info" },
- { NULL, NULL, NULL }
+
+ { "SRVSVC" },
+
+ { "srvinfo", cmd_srvsvc_srv_query_info, "Server query info", "" },
+
+ { NULL }
};
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 6420dbbdb5..1ab88747ea 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -188,6 +188,7 @@ static void get_username (char *username)
}
/* Fetch the SID for this domain */
+
void fetch_domain_sid(struct cli_state *cli)
{
POLICY_HND pol;
@@ -262,23 +263,66 @@ void init_rpcclient_creds(struct ntuser_creds *creds, char* username,
}
+/* Display help on commands */
+
static uint32 cmd_help(struct cli_state *cli, int argc, char **argv)
{
- struct cmd_list *temp_list;
+ struct cmd_list *tmp;
+ struct cmd_set *tmp_set;
- for (temp_list = cmd_list; temp_list; temp_list = temp_list->next) {
- struct cmd_set *temp_set = temp_list->cmd_set;
+ /* Usage */
- while(temp_set->name) {
- printf("%15s\t\t%s\n", temp_set->name,
- temp_set->description);
- temp_set++;
+ if (argc > 2) {
+ printf("Usage: %s [command]\n", argv[0]);
+ return 0;
+ }
+
+ /* Help on one command */
+
+ if (argc == 2) {
+ for (tmp = cmd_list; tmp; tmp = tmp->next) {
+
+ tmp_set = tmp->cmd_set;
+
+ while(tmp_set->name) {
+ if (strequal(argv[1], tmp_set->name)) {
+ if (tmp_set->usage &&
+ tmp_set->usage[0])
+ printf("%s\n", tmp_set->usage);
+ else
+ printf("No help for %s\n", tmp_set->name);
+
+ return 0;
+ }
+
+ tmp_set++;
+ }
+ }
+
+ printf("No such command: %s\n", argv[1]);
+ return 0;
+ }
+
+ /* List all commands */
+
+ for (tmp = cmd_list; tmp; tmp = tmp->next) {
+
+ tmp_set = tmp->cmd_set;
+
+ while(tmp_set->name) {
+
+ printf("%15s\t\t%s\n", tmp_set->name,
+ tmp_set->description);
+
+ tmp_set++;
}
}
return 0;
}
+/* Change the debug level */
+
static uint32 cmd_debuglevel(struct cli_state *cli, int argc, char **argv)
{
if (argc > 2) {
@@ -304,19 +348,21 @@ static uint32 cmd_quit(struct cli_state *cli, int argc, char **argv)
/* Build in rpcclient commands */
static struct cmd_set rpcclient_commands[] = {
- { "GENERAL OPTIONS", NULL, "" },
- { "help", cmd_help, "Print list of commands" },
- { "?", cmd_help, "Print list of commands" },
- { "debuglevel", cmd_debuglevel, "Set debug level" },
- { "exit", cmd_quit, "Exit program" },
- { "quit", cmd_quit, "Exit program" },
-
- { NULL, NULL, NULL }
+
+ { "GENERAL OPTIONS" },
+
+ { "help", cmd_help, "Get help on commands", "[command]" },
+ { "?", cmd_help, "Get help on commands", "[command]" },
+ { "debuglevel", cmd_debuglevel, "Set debug level", "level" },
+ { "exit", cmd_quit, "Exit program", "" },
+ { "quit", cmd_quit, "Exit program", "" },
+
+ { NULL }
};
static struct cmd_set separator_command[] = {
{ "---------------", NULL, "----------------------" },
- { NULL, NULL, NULL }
+ { NULL }
};