[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cups-commit
Subject:    [cups.commit] [CUPS] r8805 - in branches/branch-1.4: . backend conf
From:       cups-dev () easysw ! com
Date:       2009-08-31 16:34:19
Message-ID: 9576-cups.commit () news ! easysw ! com
[Download RAW message or body]

Author: mike
Date: 2009-08-31 09:34:06 -0700 (Mon, 31 Aug 2009)
New Revision: 8805
Log:
Mirror fixes from trunk.


Modified:
   branches/branch-1.4/CHANGES.txt
   branches/branch-1.4/backend/ipp.c
   branches/branch-1.4/backend/snmp-supplies.c
   branches/branch-1.4/backend/usb-darwin.c
   branches/branch-1.4/conf/cupsd.conf.in
   branches/branch-1.4/cups/snmp.c

Modified: branches/branch-1.4/CHANGES.txt
===================================================================
--- branches/branch-1.4/CHANGES.txt	2009-08-31 16:32:19 UTC (rev 8804)
+++ branches/branch-1.4/CHANGES.txt	2009-08-31 16:34:06 UTC (rev 8805)
@@ -4,6 +4,8 @@
 CHANGES IN CUPS V1.4.1
 
 	- Documention fixes (STR #3296)
+	- SNMP supply levels and states were wrong for some printers.
+	- The IPP backend did not update the auth-info-required value.
 	- The libusb-based USB backend would hang at the end of the job
 	  (STR #3315)
 	- DNS-SD registrations for raw queues had an empty "ty" key (STR #3299)

Modified: branches/branch-1.4/backend/ipp.c
===================================================================
--- branches/branch-1.4/backend/ipp.c	2009-08-31 16:32:19 UTC (rev 8804)
+++ branches/branch-1.4/backend/ipp.c	2009-08-31 16:34:06 UTC (rev 8805)
@@ -45,6 +45,8 @@
 
 static char	*password = NULL;	/* Password for device URI */
 static int	password_tries = 0;	/* Password tries */
+static const char *auth_info_required = "none";
+					/* New auth-info-required value */
 #ifdef __APPLE__
 static char	pstmpname[1024] = "";	/* Temporary PostScript file name */
 #endif /* __APPLE__ */
@@ -1049,16 +1051,21 @@
         _cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
 			cupsLastErrorString());
 
-	if (ipp_status == IPP_NOT_AUTHORIZED)
+	if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
 	{
 	  fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
 		  httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
 
+         /*
+	  * Normal authentication goes through the password callback, which sets
+	  * auth_info_required to "username,password".  Kerberos goes directly
+	  * through GSSAPI, so look for Negotiate in the WWW-Authenticate header
+	  * here and set auth_info_required as needed...
+	  */
+
 	  if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
 		       "Negotiate", 9))
-	    fputs("ATTR: auth-info-required=negotiate\n", stderr);
-	  else
-	    fputs("ATTR: auth-info-required=username,password\n", stderr);
+	    auth_info_required = "negotiate";
 	}
       }
     }
@@ -1296,7 +1303,16 @@
       page_count > start_count)
     fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
 
+#ifdef HAVE_GSSAPI
  /*
+  * See if we used Kerberos at all...
+  */
+
+  if (http->gssctx)
+    auth_info_required = "negotiate";
+#endif /* HAVE_GSSAPI */
+
+ /*
   * Free memory...
   */
 
@@ -1328,7 +1344,9 @@
   * Return the queue status...
   */
 
-  if (ipp_status == IPP_NOT_AUTHORIZED)
+  fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
+
+  if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
     return (CUPS_BACKEND_AUTH_REQUIRED);
   else if (ipp_status == IPP_INTERNAL_ERROR)
     return (CUPS_BACKEND_STOP);
@@ -1532,6 +1550,12 @@
 {
   (void)prompt;
 
+ /*
+  * Remember that we need to authenticate...
+  */
+
+  auth_info_required = "username,password";
+
   if (password && *password && password_tries < 3)
   {
     password_tries ++;
@@ -1541,23 +1565,10 @@
   else
   {
    /*
-    * If there is no password set in the device URI, return the
-    * "authentication required" exit code...
+    * Give up after 3 tries or if we don't have a password to begin with...
     */
 
-    if (tmpfilename[0])
-      unlink(tmpfilename);
-
-#ifdef __APPLE__
-    if (pstmpname[0])
-      unlink(pstmpname);
-#endif /* __APPLE__ */
-
-    fputs("ATTR: auth-info-required=username,password\n", stderr);
-
-    exit(CUPS_BACKEND_AUTH_REQUIRED);
-
-    return (NULL);			/* Eliminate compiler warning */
+    return (NULL);
   }
 }
 

Modified: branches/branch-1.4/backend/snmp-supplies.c
===================================================================
--- branches/branch-1.4/backend/snmp-supplies.c	2009-08-31 16:32:19 UTC (rev 8804)
+++ branches/branch-1.4/backend/snmp-supplies.c	2009-08-31 16:34:06 UTC (rev 8805)
@@ -229,8 +229,11 @@
         packet.object_type != CUPS_ASN1_OCTET_STRING)
       return (-1);
 
-    new_state = (packet.object_value.string.bytes[0] << 8) |
-		packet.object_value.string.bytes[1];
+    if (packet.object_value.string.num_bytes == 2)
+      new_state = (packet.object_value.string.bytes[0] << 8) |
+		  packet.object_value.string.bytes[1];
+    else
+      new_state = 0;
 
     if (current_state < 0)
       change_state = 0xffff;

Modified: branches/branch-1.4/backend/usb-darwin.c
===================================================================
--- branches/branch-1.4/backend/usb-darwin.c	2009-08-31 16:32:19 UTC (rev 8804)
+++ branches/branch-1.4/backend/usb-darwin.c	2009-08-31 16:34:06 UTC (rev 8805)
@@ -292,9 +292,8 @@
 #if defined(__i386__) || defined(__x86_64__)
 static pid_t	child_pid;		/* Child PID */
 static void run_legacy_backend(int argc, char *argv[], int fd);	/* Starts child \
                backend process running as a ppc executable */
-#endif /* __i386__ || __x86_64__ */
-static int	job_canceled = 0;	/* Was the job canceled? */
 static void sigterm_handler(int sig);	/* SIGTERM handler */
+#endif /* __i386__ || __x86_64__ */
 
 #ifdef PARSE_PS_ERRORS
 static const char *next_line (const char *buffer);
@@ -461,9 +460,9 @@
   fputs("STATE: -connecting-to-device\n", stderr);
 
   /*
-   * Now that we are "connected" to the port, catch SIGTERM so that we
+   * Now that we are "connected" to the port, ignore SIGTERM so that we
    * can finish out any page data the driver sends (e.g. to eject the
-   * current page...  Only catch SIGTERM if we are printing data from
+   * current page...  Only ignore SIGTERM if we are printing data from
    * stdin (otherwise you can't cancel raw jobs...)
    */
 
@@ -475,7 +474,7 @@
     memset(&action, 0, sizeof(action));
 
     sigemptyset(&action.sa_mask);
-    action.sa_handler = sigterm_handler;
+    action.sa_handler = SIG_IGN;
     sigaction(SIGTERM, &action, NULL);
   }
 
@@ -725,7 +724,7 @@
 	  fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n",
 	          err);
 
-	  status = job_canceled ? CUPS_BACKEND_FAILED : CUPS_BACKEND_STOP;
+	  status = CUPS_BACKEND_FAILED;
 	  break;
 	}
 	else if (bytes > 0)
@@ -2020,9 +2019,7 @@
 
   exit(exitstatus);
 }
-#endif /* __i386__ || __x86_64__ */
 
-
 /*
  * 'sigterm_handler()' - SIGTERM handler.
  */
@@ -2030,7 +2027,8 @@
 static void
 sigterm_handler(int sig)		/* I - Signal */
 {
-#if defined(__i386__) || defined(__x86_64__)
+  /* If we started a child process pass the signal on to it...
+   */
   if (child_pid)
   {
    /*
@@ -2052,16 +2050,11 @@
       exit(CUPS_BACKEND_STOP);
     }
   }
-#endif /* __i386__ || __x86_64__ */
-
- /*
-  * Otherwise just flag that the job has been canceled...
-  */
-
-  job_canceled = 1;
 }
 
+#endif /* __i386__ || __x86_64__ */
 
+
 #ifdef PARSE_PS_ERRORS
 /*
  * 'next_line()' - Find the next line in a buffer.

Modified: branches/branch-1.4/conf/cupsd.conf.in
===================================================================
--- branches/branch-1.4/conf/cupsd.conf.in	2009-08-31 16:32:19 UTC (rev 8804)
+++ branches/branch-1.4/conf/cupsd.conf.in	2009-08-31 16:34:06 UTC (rev 8805)
@@ -1,9 +1,8 @@
 #
 # "$Id$"
 #
-#   Sample configuration file for the Common UNIX Printing System (CUPS)
-#   scheduler.  See "man cupsd.conf" for a complete description of this
-#   file.
+# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
+# complete description of this file.
 #
 
 # Log general information in error_log - change "@CUPS_LOG_LEVEL@" to "debug"

Modified: branches/branch-1.4/cups/snmp.c
===================================================================
--- branches/branch-1.4/cups/snmp.c	2009-08-31 16:32:19 UTC (rev 8804)
+++ branches/branch-1.4/cups/snmp.c	2009-08-31 16:34:06 UTC (rev 8805)
@@ -1280,7 +1280,7 @@
   int	value;				/* Integer value */
 
 
-  for (value = 0;
+  for (value = (**buffer & 0x80) ? -1 : 0;
        length > 0 && *buffer < bufend;
        length --, (*buffer) ++)
     value = (value << 8) | **buffer;

_______________________________________________
cups-commit mailing list
cups-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/cups-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic