]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix SAMBA driver export - the Win95 export commands weren't right,
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 9 Nov 2001 17:19:44 +0000 (17:19 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 9 Nov 2001 17:19:44 +0000 (17:19 +0000)
and the options need to come before the server name for rpcclient.

CUPS-Move-Job didn't update the dest field of a job that was held.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@1943 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
man/cupsaddsmb.man
scheduler/ipp.c
scheduler/job.c
systemv/cupsaddsmb.c

index a8f2ac42e42749ea50be05822f764ba97d40616a..5e8aff765d8ef996e818ffea5190abe2dea3ee88 100644 (file)
@@ -118,6 +118,10 @@ CHANGES IN CUPS V1.1.11
          named "cupsd", not just any program with "cupsd" in
          the name (this caused the apcupsd UPS monitoring
          daemon to be stopped/restarted...)
+       - The CUPS-Move-Job operation did not change the internal
+         destination name for held jobs, so moved (but held)
+         jobs would print on the correct printer but show up
+         as queued on the original destination.
 
 
 CHANGES IN CUPS V1.1.10-1
index 40a08a62c382a53a1e3cf46ffa7e744e91438ce8..4d7da8879b95de3b46272e76dba3ecd324562898 100644 (file)
@@ -1,5 +1,5 @@
 .\"
-.\" "$Id: cupsaddsmb.man,v 1.1 2001/09/18 19:14:47 mike Exp $"
+.\" "$Id: cupsaddsmb.man,v 1.2 2001/11/09 17:19:41 mike Exp $"
 .\"
 .\"   cupsaddsmb man page for the Common UNIX Printing System (CUPS).
 .\"
 .\"       EMail: cups-info@cups.org
 .\"         WWW: http://www.cups.org
 .\"
-.TH cupsaddsmb 8 "Common UNIX Printing System" "18 September 2001" "Easy Software Products"
+.TH cupsaddsmb 8 "Common UNIX Printing System" "9 November 2001" "Easy Software Products"
 .SH NAME
 cupsaddsmb \- export printers to samba for windows clients
 .SH SYNOPSIS
 .B cupsaddsmb
-[ -a ]
+[ -a ] [ -U
+.I user
+] [ -v ]
 .br
 .B cupsaddsmb
-[ printer1 ... printerN ]
+[ -u
+.I user
+] [ -v ] [ printer1 ... printerN ]
 .SH DESCRIPTION
 \fIcupsaddsmb\fR exports printers to the SAMBA software (version
 2.2.0 or higher) for use with Windows clients. Depending on the
@@ -39,6 +43,12 @@ printer driver files described below.
 .LP
 The \fI-a\fR option exports all known printers. Otherwise, only
 the named printers are exported.
+.LP
+The \fI-U\fR option specifies the print admin username which defaults
+to your current username.
+.LP
+The \fI-v\fR option specifies that verbose information should be
+shown and is useful for debugging SAMBA configuration problems.
 .SH SAMBA CONFIGURATION
 \fIcupsaddsmb\fR uses the new RPC-based printing support in
 SAMBA 2.2.x to provide printer drivers and PPD files to Windows
@@ -100,5 +110,5 @@ http://localhost:631/documentation.html
 .SH COPYRIGHT
 Copyright 1993-2001 by Easy Software Products, All Rights Reserved.
 .\"
-.\" End of "$Id: cupsaddsmb.man,v 1.1 2001/09/18 19:14:47 mike Exp $".
+.\" End of "$Id: cupsaddsmb.man,v 1.2 2001/11/09 17:19:41 mike Exp $".
 .\"
index 88cc66ac0fdf0fdc6badb7cad4c22e5ef7a31a54..65baf053d3ac34a653a160a577295d9ee066883b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c,v 1.146 2001/10/22 21:04:08 mike Exp $"
+ * "$Id: ipp.c,v 1.147 2001/11/09 17:19:42 mike Exp $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -53,7 +53,7 @@
  *   get_printer_attrs()         - Get printer attributes.
  *   get_printers()              - Get a list of printers.
  *   hold_job()                  - Hold a print job.
- *   move_job()                  - Move a job.
+ *   move_job()                  - Move a job to a new destination.
  *   print_job()                 - Print a file to a printer or class.
  *   reject_jobs()               - Reject print jobs to a printer.
  *   release_job()               - Release a held print job.
@@ -3517,7 +3517,7 @@ hold_job(client_t        *con,    /* I - Client connection */
 
 
 /*
- * 'move_job()' - Set job attributes.
+ * 'move_job()' - Move a job to a new destination.
  */
 
 static void
@@ -5581,5 +5581,5 @@ validate_user(client_t   *con,            /* I - Client connection */
 
 
 /*
- * End of "$Id: ipp.c,v 1.146 2001/10/22 21:04:08 mike Exp $".
+ * End of "$Id: ipp.c,v 1.147 2001/11/09 17:19:42 mike Exp $".
  */
index 4e5c870689a9260e10ed63f84a0d8bae0d119dc7..ce27063f3e264c417b35f404099804e5653be604 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: job.c,v 1.138 2001/10/30 18:56:30 mike Exp $"
+ * "$Id: job.c,v 1.139 2001/11/09 17:19:43 mike Exp $"
  *
  *   Job management routines for the Common UNIX Printing System (CUPS).
  *
@@ -721,8 +721,10 @@ MoveJob(int        id,             /* I - Job ID */
   for (current = Jobs; current != NULL; current = current->next)
     if (current->id == id)
     {
-      if (current->state->values[0].integer == IPP_JOB_PENDING)
-        strncpy(current->dest, dest, sizeof(current->dest) - 1);
+      if (current->state->values[0].integer >= IPP_JOB_PROCESSING)
+        break;
+
+      strncpy(current->dest, dest, sizeof(current->dest) - 1);
 
       if ((attr = ippFindAttribute(current->attrs, "job-printer-uri", IPP_TAG_URI)) != NULL)
       {
@@ -2981,5 +2983,5 @@ start_process(const char *command,        /* I - Full path to command */
 
 
 /*
- * End of "$Id: job.c,v 1.138 2001/10/30 18:56:30 mike Exp $".
+ * End of "$Id: job.c,v 1.139 2001/11/09 17:19:43 mike Exp $".
  */
index d36a6bc9450976a67aef20b8474a4b8a8fe38fdf..dc949eb68dd2cecdfe36df155343cfd7c977d99b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cupsaddsmb.c,v 1.1 2001/09/18 19:14:47 mike Exp $"
+ * "$Id: cupsaddsmb.c,v 1.2 2001/11/09 17:19:44 mike Exp $"
  *
  *   "cupsaddsmb" command for the Common UNIX Printing System (CUPS).
  *
@@ -23,6 +23,9 @@
  *
  * Contents:
  *
+ *   main()             - Export printers on the command-line.
+ *   do_samba_command() - Do a SAMBA command, asking for a password as needed.
+ *   export_dest()      - Export a destination to SAMBA.
  */
 
 /*
 #include <errno.h>
 
 
+/*
+ * Local globals...
+ */
+
+int    Verbosity = 0;
+
+
 /*
  * Local functions...
  */
 
-int    do_samba_command(const char *, const char *);
+int    do_samba_command(const char *, const char *, const char *);
 int    export_dest(const char *);
 
 
@@ -76,6 +86,19 @@ main(int  argc,              /* I - Number of command-line arguments */
       if (status)
         return (status);
     }
+    else if (strcmp(argv[i], "-U") == 0)
+    {
+      i ++;
+      if (i >= argc)
+      {
+       puts("Usage: cupsaddsmb [-a] [-U user] [-v] [printer1 ... printerN]");
+       return (1);
+      }
+
+      cupsSetUser(argv[i]);
+    }
+    else if (strcmp(argv[i], "-v") == 0)
+      Verbosity = 1;
     else if (argv[i][0] != '-')
     {
       if ((status = export_dest(argv[i])) != 0)
@@ -83,7 +106,7 @@ main(int  argc,              /* I - Number of command-line arguments */
     }
     else
     {
-      puts("Usage: cupsaddsmb [-a] [printer1 ... printerN]");
+      puts("Usage: cupsaddsmb [-a] [-U user] [-v] [printer1 ... printerN]");
       return (1);
     }
 
@@ -98,6 +121,7 @@ main(int  argc,              /* I - Number of command-line arguments */
 
 int                                    /* O - Status of command */
 do_samba_command(const char *command,  /* I - Command to run */
+                 const char *args,     /* I - Argument(s) for command */
                  const char *filename) /* I - File to use as input */
 {
   int          status;                 /* Status of command */
@@ -108,22 +132,52 @@ do_samba_command(const char *command,     /* I - Command to run */
   for (status = 1;;)
   {
     if (p)
-      snprintf(temp, sizeof(temp), "%s -N -U%s%%%s <%s >/dev/null 2>/dev/null",
-               command, cupsUser(), p, filename ? filename : "/dev/null");
+      snprintf(temp, sizeof(temp), "%s -N -U \'%s%%%s\' %s <%s",
+               command, cupsUser(), p, args, filename ? filename : "/dev/null");
+    else
+      snprintf(temp, sizeof(temp), "%s -N -U \'%s\' %s <%s",
+               command, cupsUser(), args, filename ? filename : "/dev/null");
+
+    if (Verbosity)
+    {
+      printf("Running the following command:\n\n    %s\n", temp);
+
+      if (filename)
+      {
+        char cat[1024];
+
+
+        puts("\nwith the following input:\n");
+
+        snprintf(cat, sizeof(cat), "cat %s", filename);
+        system(cat);
+      }
+    }
     else
-      snprintf(temp, sizeof(temp), "%s -N -U%s <%s >/dev/null 2>/dev/null",
-               command, cupsUser(), filename ? filename : "/dev/null");
+    {
+      strncat(temp, " >/dev/null 2>/dev/null", sizeof(temp) - 1);
+      temp[sizeof(temp) - 1] = '\0';
+    }
 
     if ((status = system(temp)) != 0)
     {
+      if (Verbosity)
+        puts("");
+
       snprintf(temp, sizeof(temp),
-               "Password required to access %s via SAMBA.", cupsServer());
+               "Password for %s required to access %s via SAMBA: ",
+              cupsUser(), cupsServer());
 
       if ((p = cupsGetPassword(temp)) == NULL)
         break;
     }
     else
+    {
+      if (Verbosity)
+        puts("");
+
       break;
+    }
   }
 
   return (status);
@@ -196,7 +250,7 @@ export_dest(const char *dest)       /* I - Destination to export */
   /* Run the smbclient command to copy the Windows drivers... */
   snprintf(command, sizeof(command), "smbclient //%s/print\\$", cupsServer());
 
-  if ((status = do_samba_command(command, tempfile)) != 0)
+  if ((status = do_samba_command(command, "", tempfile)) != 0)
   {
     fprintf(stderr, "ERROR: Unable to copy Windows printer driver files (%d)!\n",
             status);
@@ -221,18 +275,24 @@ export_dest(const char *dest)     /* I - Destination to export */
              "NULL:RAW:NULL\"\n",
           dest, dest);
   fprintf(fp, "addprinter %s %s \"%s\" \"\"\n", dest, dest, dest);
+
+ /*
+  * MRS: For some reason, SAMBA doesn't like to install Win9x drivers
+  *      with aux files.  They are currently commented out but further
+  *      investigation is required...
+  */
+
   fprintf(fp, "adddriver \"Windows 4.0\" "
               "\"%s:ADOBEPS4.DRV:%s.PPD:NULL:ADOBEPS4.HLP:"
-             "PSMON.DLL:RAW:ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL\"\n",
+             "PSMON.DLL:RAW:NULL\"\n",
+             /*"PSMON.DLL:RAW:ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL\"\n",*/
              dest, dest);
   fputs("quit\n", fp);
 
   fclose(fp);
 
   /* Run the rpcclient command to install the Windows drivers... */
-  snprintf(command, sizeof(command), "rpcclient %s", cupsServer());
-
-  if ((status = do_samba_command(command, tempfile)) != 0)
+  if ((status = do_samba_command("rpcclient", cupsServer(), tempfile)) != 0)
   {
     fprintf(stderr, "ERROR: Unable to install Windows printer driver files (%d)!\n",
             status);
@@ -247,5 +307,5 @@ export_dest(const char *dest)       /* I - Destination to export */
 
 
 /*
- * End of "$Id: cupsaddsmb.c,v 1.1 2001/09/18 19:14:47 mike Exp $".
+ * End of "$Id: cupsaddsmb.c,v 1.2 2001/11/09 17:19:44 mike Exp $".
  */