diff options
author | Jean-François Micouleau <jfm@samba.org> | 2001-10-22 06:13:38 +0000 |
---|---|---|
committer | Jean-François Micouleau <jfm@samba.org> | 2001-10-22 06:13:38 +0000 |
commit | 0968ee87e14f33a87f7ad361dc5d915c24215ce7 (patch) | |
tree | aad7b041381a06f985f7e5549215e85ecd1e8807 /source3 | |
parent | fba157123ed1d6f59d40aa9161218fbfcf71253f (diff) | |
download | samba-0968ee87e14f33a87f7ad361dc5d915c24215ce7.tar.gz samba-0968ee87e14f33a87f7ad361dc5d915c24215ce7.tar.bz2 samba-0968ee87e14f33a87f7ad361dc5d915c24215ce7.zip |
allow the samr commands to work back and the help too ;-)
J.F.
(This used to be commit 0157fdc8a291ba9872757fb6cf5e16e98058a034)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 50 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 20 |
2 files changed, 24 insertions, 46 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 9a4b87e11a..4e112c90e4 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -157,8 +157,6 @@ static NTSTATUS cmd_samr_query_user(struct cli_state *cli, sscanf(argv[1], "%i", &user_rid); - fetch_domain_sid(cli); - slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost); strupper (server); @@ -260,8 +258,6 @@ static NTSTATUS cmd_samr_query_group(struct cli_state *cli, group_rid = atoi(argv[1]); - fetch_domain_sid(cli); - slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost); strupper (server); @@ -322,8 +318,6 @@ static NTSTATUS cmd_samr_query_usergroups(struct cli_state *cli, sscanf(argv[1], "%i", &user_rid); - fetch_domain_sid(cli); - slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost); strupper (server); @@ -381,8 +375,6 @@ static NTSTATUS cmd_samr_query_groupmem(struct cli_state *cli, sscanf(argv[1], "%i", &group_rid); - fetch_domain_sid(cli); - slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost); strupper (server); @@ -438,8 +430,6 @@ static NTSTATUS cmd_samr_enum_dom_groups(struct cli_state *cli, return NT_STATUS_OK; } - fetch_domain_sid(cli); - /* Get sam policy handle */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -492,8 +482,6 @@ static NTSTATUS cmd_samr_query_aliasmem(struct cli_state *cli, sscanf(argv[1], "%i", &alias_rid); - fetch_domain_sid(cli); - /* Open SAMR handle */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -555,8 +543,6 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, return NT_STATUS_OK; } - fetch_domain_sid(cli); - /* Get sam policy handle */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -616,8 +602,6 @@ static NTSTATUS cmd_samr_query_dominfo(struct cli_state *cli, if (argc == 2) switch_value = atoi(argv[1]); - fetch_domain_sid(cli); - /* Get sam policy handle */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -678,8 +662,6 @@ static NTSTATUS cmd_samr_create_dom_user(struct cli_state *cli, acct_name = argv[1]; - fetch_domain_sid(cli); - /* Get sam policy handle */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -731,8 +713,6 @@ static NTSTATUS cmd_samr_lookup_names(struct cli_state *cli, return NT_STATUS_OK; } - fetch_domain_sid(cli); - /* Get sam policy and domain handles */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -794,8 +774,6 @@ static NTSTATUS cmd_samr_lookup_rids(struct cli_state *cli, return NT_STATUS_OK; } - fetch_domain_sid(cli); - /* Get sam policy and domain handles */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -852,8 +830,6 @@ static NTSTATUS cmd_samr_delete_dom_user(struct cli_state *cli, return NT_STATUS_OK; } - fetch_domain_sid(cli); - /* Get sam policy and domain handles */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -915,19 +891,19 @@ struct cmd_set samr_commands[] = { { "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", "" }, + { "queryuser", cmd_samr_query_user, PIPE_SAMR, "Query user info", "" }, + { "querygroup", cmd_samr_query_group, PIPE_SAMR, "Query group info", "" }, + { "queryusergroups", cmd_samr_query_usergroups, PIPE_SAMR, "Query user groups", "" }, + { "querygroupmem", cmd_samr_query_groupmem, PIPE_SAMR, "Query group membership", "" }, + { "queryaliasmem", cmd_samr_query_aliasmem, PIPE_SAMR, "Query alias membership", "" }, + { "querydispinfo", cmd_samr_query_dispinfo, PIPE_SAMR, "Query display info", "" }, + { "querydominfo", cmd_samr_query_dominfo, PIPE_SAMR, "Query domain info", "" }, + { "enumdomgroups", cmd_samr_enum_dom_groups, PIPE_SAMR, "Enumerate domain groups", "" }, + + { "createdomuser", cmd_samr_create_dom_user, PIPE_SAMR, "Create domain user", "" }, + { "samlookupnames", cmd_samr_lookup_names, PIPE_SAMR, "Look up names", "" }, + { "samlookuprids", cmd_samr_lookup_rids, PIPE_SAMR, "Look up names", "" }, + { "deletedomuser", cmd_samr_delete_dom_user, PIPE_SAMR, "Delete domain user", "" }, { NULL } }; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 77bf413723..be1be0fd51 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -187,9 +187,9 @@ static void get_username (char *username) return; } -/* Fetch the SID for this domain */ +/* Fetch the SID for this computer */ -void fetch_domain_sid(struct cli_state *cli) +void fetch_machine_sid(struct cli_state *cli) { POLICY_HND pol; NTSTATUS result = NT_STATUS_OK; @@ -356,17 +356,17 @@ static struct cmd_set rpcclient_commands[] = { { "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", "" }, + { "help", cmd_help, NULL, "Get help on commands", "[command]" }, + { "?", cmd_help, NULL, "Get help on commands", "[command]" }, + { "debuglevel", cmd_debuglevel, NULL, "Set debug level", "level" }, + { "exit", cmd_quit, NULL, "Exit program", "" }, + { "quit", cmd_quit, NULL, "Exit program", "" }, { NULL } }; static struct cmd_set separator_command[] = { - { "---------------", NULL, "----------------------" }, + { "---------------", NULL, NULL, "----------------------" }, { NULL } }; @@ -756,7 +756,9 @@ static void usage(void) cmd_set++; } - /* Do anything specified with -c */ + fetch_machine_sid(&cli); + + /* Do anything specified with -c */ if (cmdstr[0]) { char *cmd; char *p = cmdstr; |