diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-22 19:37:05 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-22 19:37:05 +0000 |
commit | 288a5059a24b1b28bef1c28bc831c775977c5876 (patch) | |
tree | 3593a2de91acf715a992cd2b589b142f1fb190b4 /source3/rpcclient | |
parent | bb876dc6c3b6b5f1a89524e97bfafd97237bf0ca (diff) | |
download | samba-288a5059a24b1b28bef1c28bc831c775977c5876.tar.gz samba-288a5059a24b1b28bef1c28bc831c775977c5876.tar.bz2 samba-288a5059a24b1b28bef1c28bc831c775977c5876.zip |
another two.
(This used to be commit b0f8ef6168d04d55d53fc2d02df5f54176e4f893)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_lsarpc.c | 58 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 14 |
2 files changed, 39 insertions, 33 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 079cd803ea..a95b8c077c 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -195,7 +195,7 @@ void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]) int i; fstring srv_name; int num_names = 0; - char *names[10]; + char **names; DOM_SID *sids = NULL; int num_sids = 0; #if 0 @@ -210,13 +210,13 @@ void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]) DEBUG(4,("cmd_lsa_lookup_names: server: %s\n", srv_name)); - while (num_names < 10 && next_token(NULL, temp, NULL, sizeof(temp))) - { - names[num_names] = strdup(temp); - num_names++; - } + argc--; + argv++; + + num_names = argc; + names = argv; - if (num_names == 0) + if (num_names <= 0) { report(out_hnd, "lookupnames <name> [<name> ...]\n"); return; @@ -266,14 +266,6 @@ void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]) } free(sids); } - - for (i = 0; i < num_names; i++) - { - if (names[i] != NULL) - { - free(((char **)names)[i]); - } - } } /**************************************************************************** @@ -282,13 +274,11 @@ lookup sids void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]) { uint16 nt_pipe_fnum; - fstring temp; int i; pstring sid_name; fstring srv_name; - DOM_SID sid[10]; - DOM_SID *sids[10]; - int num_sids = 0; + DOM_SID **sids = NULL; + uint32 num_sids = 0; char **names = NULL; int num_names = 0; @@ -300,11 +290,15 @@ void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]) DEBUG(4,("cmd_lsa_lookup_sids: server: %s\n", srv_name)); - while (num_sids < 10 && next_token(NULL, temp, NULL, sizeof(temp))) + argv++; + argc--; + + while (argc > 0) { - if (strnequal("S-", temp, 2)) + DOM_SID sid; + if (strnequal("S-", argv[0], 2)) { - fstrcpy(sid_name, temp); + fstrcpy(sid_name, argv[0]); } else { @@ -317,11 +311,14 @@ void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]) } fstrcat(sid_name, "-"); - fstrcat(sid_name, temp); + fstrcat(sid_name, argv[0]); } - string_to_sid(&sid[num_sids], sid_name); - sids[num_sids] = &sid[num_sids]; - num_sids++; + string_to_sid(&sid, sid_name); + + add_sid_to_array(&num_sids, &sids, &sid); + + argc--; + argv++; } if (num_sids == 0) @@ -362,6 +359,7 @@ void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]) report(out_hnd, "Lookup SIDS:\n"); for (i = 0; i < num_names; i++) { + fstring temp; sid_to_string(temp, sids[i]); report(out_hnd, "SID: %s -> %s\n", temp, names[i]); if (names[i] != NULL) @@ -371,6 +369,8 @@ void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]) } free(names); } + + free_sid_array(num_sids, sids); } /**************************************************************************** @@ -386,17 +386,19 @@ void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[]) uint32 i; POLICY_HND hnd_secret; - fstring secret_name; + char *secret_name; STRING2 enc_secret; STRING2 secret; NTTIME last_update; - if (!next_token(NULL, secret_name, NULL, sizeof(secret_name))) + if (argc > 2) { report(out_hnd, "querysecret <secret name>\n"); return; } + secret_name = argv[1]; + fstrcpy(srv_name, "\\\\"); fstrcat(srv_name, info->dest_host); strupper(srv_name); diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 91a6ff0966..f9be3be429 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -109,17 +109,19 @@ void cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[ { uint16 nt_pipe_fnum; fstring srv_name; - fstring printer_name; + char *printer_name; PRINTER_HND hnd; BOOL res = True; - if (!next_token(NULL, printer_name, NULL, sizeof(printer_name))) + if (argc < 2) { report(out_hnd, "spoolopen <printer name>\n"); return; } + printer_name = argv[1]; + fstrcpy(srv_name, "\\\\"); fstrcat(srv_name, info->myhostname); strupper(srv_name); @@ -234,18 +236,20 @@ nt spoolss query void cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]) { fstring srv_name; - fstring printer_name; + char *printer_name; void **ctr = NULL; uint32 num = 0; uint32 level = 1; - if (!next_token(NULL, printer_name, NULL, sizeof(printer_name))) + if (argc < 2) { - report(out_hnd, "spoolopen <printer name>\n"); + report(out_hnd, "spoolenum <printer name>\n"); return; } + printer_name = argv[1]; + fstrcpy(srv_name, "\\\\"); fstrcat(srv_name, info->myhostname); strupper(srv_name); |