mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
Started adding some help/usage info for rpcclient commands.
This commit is contained in:
parent
2accab2589
commit
37052a1bcc
@ -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 }
|
||||
};
|
||||
|
@ -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 }
|
||||
};
|
||||
|
@ -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 }
|
||||
};
|
||||
|
@ -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" },
|
||||
{ "SAMR" },
|
||||
|
||||
{ "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 }
|
||||
{ "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 }
|
||||
};
|
||||
|
@ -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 }
|
||||
};
|
||||
|
@ -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 }
|
||||
};
|
||||
|
@ -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 }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user