From cf9443677d8e82f978194c43a8275e7e937e890a Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 8 Dec 2000 03:24:38 +0000 Subject: Modified argc passed to rpc_client cmd_* functions to include argv[0]. Gerald, could you check to see I haven't introduced any bugs into rpcclient/cmd_spoolss.c? (This used to be commit 77b0bda4df3217cd186d5b8f902a50f35346d98d) --- source3/lib/cmd_interp.c | 6 +++--- source3/rpcclient/cmd_spoolss.c | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source3') diff --git a/source3/lib/cmd_interp.c b/source3/lib/cmd_interp.c index 8951db10cf..15fa49d1ad 100644 --- a/source3/lib/cmd_interp.c +++ b/source3/lib/cmd_interp.c @@ -226,9 +226,9 @@ static uint32 cmd_help(struct client_info *info, int argc, char *argv[]) int i = 0; /* get help on a specific command */ - if (argc > 0) + if (argc > 1) { - if ((i = process_tok(argv[1])) >= 0) + if ((i = process_tok(argv[0])) >= 0) { fprintf(out_hnd, "HELP %s:\n\t%s\n\n", commands[i]->name, commands[i]->description); @@ -333,7 +333,7 @@ static uint32 do_command(struct client_info *info, char *line) i = process_tok(cmd_argv[0]); if (i >= 0) { - int argc = ((int)cmd_argc)-1; + int argc = ((int)cmd_argc); char **argv = cmd_argv; optind = 0; diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 392f31b625..58ee1ca0c1 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -149,7 +149,7 @@ uint32 cmd_spoolss_enum_ports(struct client_info *info, int argc, char *argv[]) uint32 level; fstring srv_name; - if (argc < 1) + if (argc < 2) { report (out_hnd, "spoolenumports \n"); return NT_STATUS_INVALID_PARAMETER; @@ -179,7 +179,7 @@ uint32 cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *ar fstring station; char *printer_name; - if (argc < 1) { + if (argc < 2) { report(out_hnd, "spoolenumdata \n"); return NT_STATUS_INVALID_PARAMETER; } @@ -224,7 +224,7 @@ uint32 cmd_spoolss_getprinter(struct client_info *info, int argc, char *argv[]) char *printer_name; uint32 level; - if (argc < 1) { + if (argc < 2) { report(out_hnd, "spoolgetprinter \n"); return NT_STATUS_INVALID_PARAMETER; } @@ -246,7 +246,7 @@ uint32 cmd_spoolss_getprinter(struct client_info *info, int argc, char *argv[]) printer_name = srv_name; } - if (argc < 3) + if (argc < 4) level=2; else level = atoi(argv[2]); @@ -282,7 +282,7 @@ uint32 cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]) void **ctr = NULL; uint32 level = 1; - if (argc < 1) { + if (argc < 2) { report(out_hnd, "spooljobs \n"); return NT_STATUS_INVALID_PARAMETER; } @@ -330,7 +330,7 @@ uint32 cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *arg BOOL res = True; - if (argc < 1) + if (argc < 2) { report(out_hnd, "spoolopen \n"); return NT_STATUS_INVALID_PARAMETER; @@ -385,7 +385,7 @@ uint32 cmd_spoolss_getprinterdata(struct client_info *info, int argc, char *argv uint32 status; uint32 type = 1; - if (argc < 2) { + if (argc < 3) { report(out_hnd, "spoolgetdata \n"); return NT_STATUS_INVALID_PARAMETER; } @@ -441,7 +441,7 @@ uint32 cmd_spoolss_getprinterdriver(struct client_info *info, int argc, char *ar fstring environment; uint32 level; - if (argc < 1) { + if (argc < 2) { report(out_hnd, "spoolgetprinterdriver \n"); return NT_STATUS_INVALID_PARAMETER; } @@ -524,14 +524,14 @@ uint32 cmd_spoolss_getprinterdriverdir(struct client_info *info, int argc, char fstrcat(srv_name, info->dest_host); strupper(srv_name); - if (argc < 1) { + if (argc < 2) { report(out_hnd, "spoolgetprinterdriverdir \n"); return NT_STATUS_NOPROBLEMO; } fstrcpy(env, argv[1]); - for (i=2; i<=argc; i++) { + for (i=3; i<=argc; i++) { fstrcat(env, " "); fstrcat(env, argv[i]); } @@ -571,7 +571,7 @@ uint32 cmd_spoolss_addprinterex(struct client_info *info, int argc, char *argv[] strupper(srv_name); /* check (and copy) the command line arguments */ - if (argc < 4) { + if (argc < 5) { report(out_hnd, "spooladdprinterex \n"); return NT_STATUS_INVALID_PARAMETER; } @@ -701,7 +701,7 @@ uint32 cmd_spoolss_addprinterdriver(struct client_info *info, int argc, char *ar uint32 result = NT_STATUS_NO_PROBLEMO; /* parse the command arguements */ - if (argc < 2) + if (argc < 3) { report (out_hnd, "spooladdprinterdriver \\\n"); report (out_hnd, "\t:::\\\n"); -- cgit