diff options
author | Tim Potter <tpot@samba.org> | 2001-10-29 05:38:02 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-10-29 05:38:02 +0000 |
commit | 879ecfae58ea47c7130aab53a44ab158d4667b5b (patch) | |
tree | 90269bc234dcf2d24b9ddc0d81f9607a27c99857 /source3 | |
parent | 7c98cf29f3a72993d0c7c0a76d843aa44536af03 (diff) | |
download | samba-879ecfae58ea47c7130aab53a44ab158d4667b5b.tar.gz samba-879ecfae58ea47c7130aab53a44ab158d4667b5b.tar.bz2 samba-879ecfae58ea47c7130aab53a44ab158d4667b5b.zip |
Converted a bunch of functions to use sscanf %i instead of atoi to
allow hex or decimal rids to be specified.
(This used to be commit d93488b953337890a17de124f88cf2066f733c40)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 3432c8c61b..68a75a70c9 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -268,7 +268,7 @@ static NTSTATUS cmd_samr_query_group(struct cli_state *cli, return NT_STATUS_OK; } - group_rid = atoi(argv[1]); + sscanf(argv[1], "%i", &group_rid); slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost); strupper (server); @@ -546,7 +546,7 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32 start_idx=0, max_entries=250, num_entries, i; - uint16 info_level = 1; + int info_level = 1; SAM_DISPINFO_CTR ctr; SAM_DISPINFO_1 info1; @@ -556,13 +556,13 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, } if (argc >= 2) - info_level = atoi(argv[1]); - + sscanf(argv[1], "%i", &info_level); + if (argc >= 3) - start_idx = atoi(argv[2]); - + sscanf(argv[2], "%i", &start_idx); + if (argc >= 4) - max_entries = atoi(argv[3]); + sscanf(argv[3], "%i", &max_entries); /* Get sam policy handle */ @@ -591,6 +591,9 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, &start_idx, info_level, &num_entries, max_entries, &ctr); + if (!NT_STATUS_IS_OK(result)) + goto done; + for (i = 0; i < num_entries; i++) { switch (info_level) { case 1: @@ -614,7 +617,7 @@ static NTSTATUS cmd_samr_query_dominfo(struct cli_state *cli, { POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint16 switch_value = 2; + int switch_value = 2; SAM_UNK_CTR ctr; if (argc > 2) { @@ -623,7 +626,7 @@ static NTSTATUS cmd_samr_query_dominfo(struct cli_state *cli, } if (argc == 2) - switch_value = atoi(argv[1]); + sscanf(argv[1], "%i", &switch_value); /* Get sam policy handle */ @@ -820,7 +823,7 @@ static NTSTATUS cmd_samr_lookup_rids(struct cli_state *cli, rids = (uint32 *)talloc(mem_ctx, sizeof(uint32) * num_rids); for (i = 0; i < argc - 1; i++) - rids[i] = atoi(argv[i + 1]); + sscanf(argv[i + 1], "%i", &rids[i]); result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol, flags, num_rids, rids, @@ -833,7 +836,7 @@ static NTSTATUS cmd_samr_lookup_rids(struct cli_state *cli, /* Display results */ for (i = 0; i < num_names; i++) - printf("rid %x: %s (%d)\n", rids[i], names[i], name_types[i]); + printf("rid 0x%x: %s (%d)\n", rids[i], names[i], name_types[i]); done: return result; |