Modified argc passed to rpc_client cmd_* functions to include argv[0].
authorTim Potter <tpot@samba.org>
Fri, 8 Dec 2000 03:24:38 +0000 (03:24 +0000)
committerTim Potter <tpot@samba.org>
Fri, 8 Dec 2000 03:24:38 +0000 (03:24 +0000)
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
source3/rpcclient/cmd_spoolss.c

index 8951db10cfa9537ebede4ffc3f50876f7e9ab694..15fa49d1ada954457370c92845420ed1820681d6 100644 (file)
@@ -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;
 
index 392f31b625d3b17535059d3530601f06225c8a33..58ee1ca0c11d9cdc0a3250b9cc7f37e1a21459e1 100644 (file)
@@ -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 <level>\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 <printer name>\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 <printer name>\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 <printer name>\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 <printer name>\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 <printer name> <value name>\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 <printer name>\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 <arch>\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 <name> <shared name> <driver> <port>\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 <arch>\\\n");
                report (out_hnd, "\t<Long Printer Name>:<Driver File Name>:<Data File Name>:\\\n");